-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow: add github actions for CI (#43)
* workflow: add github actions for CI * format run-name * remove chalk * add strategy to run on multiple OS * fix * fix runs-on * fail-fast * config global test timeout
- Loading branch information
Showing
8 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: api-check | ||
run-name: ${{ github.actor }} - api check | ||
on: [pull_request] | ||
jobs: | ||
api-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.17.0' | ||
|
||
- run: npm ci | ||
|
||
- name: Copy old public.d.ts | ||
run: mv ./.api/public.d.ts ./.api/public_old.d.ts | ||
|
||
- run: npm run api | ||
|
||
- name: Compare api | ||
run: node ./.github/workflows/scripts/api-check.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const fs = require('fs'); | ||
const ps = require('path'); | ||
|
||
const oldVer = ps.join(__dirname, '../../../.api/public_old.d.ts'); | ||
const newVer = ps.join(__dirname, '../../../.api/public.d.ts'); | ||
const oldContent = fs.readFileSync(oldVer, 'utf8'); | ||
const newContent = fs.readFileSync(newVer, 'utf8'); | ||
|
||
if (oldContent !== newContent) { | ||
console.error(`please run 'npm run api' to update public.d.ts, and commit this file.`); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: test | ||
run-name: ${{ github.actor }} - test | ||
on: [pull_request] | ||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.17.0' | ||
|
||
- run: npm ci | ||
|
||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters