Skip to content

Commit

Permalink
add ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethnym committed Apr 29, 2024
1 parent 1947873 commit 95a55b1
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish to npm

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 8

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm run test

- name: Publish to npm
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run tests

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm run test
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ function fetchWeather(): Result<Weather, ApiError> {
return ok(json.value)
}
```

## Matching Rust's Implementation

The goal of this library is to match Rust's `Result` as close as possible. If there is anything missing, please file an issue.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
}
},
"scripts": {
"test": "vitest",
"test": "vitest run",
"prepublish": "tsup trycat.ts --dts --format cjs,esm",
"build": "tsup trycat.ts --dts --format cjs,esm"
},
"devDependencies": {
Expand Down

0 comments on commit 95a55b1

Please sign in to comment.