Skip to content

Commit

Permalink
feat: add test on pull request workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vafanassieff committed Apr 29, 2024
1 parent f8ea88f commit e83de84
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 76 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,24 @@ on:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test
test:
uses: ./.github/workflows/test.yml

publish-npm:
needs: build
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- run: npm ci

- run: npm run build

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pull Request

on:
workflow_call:
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- run: npm ci

- run: npm test
120 changes: 60 additions & 60 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"prepublish": "npm run build",
"test": "tsc --noEmit && vitest",
"test": "tsc --noEmit && vitest --run",
"build": "rimraf dist && tsc -p tsconfig.build.json"
},
"repository": {
Expand Down Expand Up @@ -35,7 +34,7 @@
"rimraf": "^5.0.5",
"superjson": "^2.2.1",
"typescript": "^5.4.5",
"vitest": "^1.5.0",
"vitest": "^1.5.1",
"zod": "^3.23.4"
},
"peerDependencies": {
Expand Down

0 comments on commit e83de84

Please sign in to comment.