Skip to content

Commit

Permalink
ci: add edge environment unit test (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
maou-shonen authored Nov 7, 2024
1 parent d672f1e commit b4de4cb
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 24 deletions.
54 changes: 35 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,46 +30,41 @@ jobs:
- run: pnpm run typecheck
- run: pnpm run lint

coverage:
unit-test-node:
needs:
- lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Use Node.js
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm install --no-frozen-lockfile
- run: pnpm run test

- run: pnpm run coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

unit-test:
unit-test-edge:
needs:
- coverage
- lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 20
cache: pnpm
- run: pnpm install --no-frozen-lockfile

- run: pnpm run test
- run: pnpm run test:edge

jsr-dry-run:
needs:
- lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -80,3 +75,24 @@ jobs:
cache: pnpm
- run: pnpm install
- run: pnpm exec jsr publish --dry-run

coverage:
needs:
- unit-test-node
- jsr-dry-run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --no-frozen-lockfile

- run: pnpm run coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"lint": "eslint --quiet .",
"test": "vitest run",
"test:watch": "vitest",
"test:edge": "vitest run --environment edge-runtime",
"coverage": "vitest run --coverage"
},
"peerDependencies": {
Expand All @@ -58,6 +59,7 @@
"defu": "^6.1.4"
},
"devDependencies": {
"@edge-runtime/vm": "^4.0.4",
"@eslint/js": "^9.5.0",
"@types/node": "^20.14.2",
"@vitest/coverage-v8": "^2.1.3",
Expand Down
34 changes: 29 additions & 5 deletions pnpm-lock.yaml

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

0 comments on commit b4de4cb

Please sign in to comment.