Skip to content

Commit

Permalink
chore: better test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
guansss committed Dec 6, 2023
1 parent 4145c9c commit 3b77a30
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ name: Test CI
on:
push:
branches: [ master ]
paths-ignore:
- "docs/**"
- "playground/**"
- "*.md"
pull_request:
branches: [ master ]
workflow_dispatch:
workflow_call:

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -17,7 +22,8 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "npm"

- name: Cache core files
uses: actions/cache@v3
Expand All @@ -26,16 +32,22 @@ jobs:
path: |
core/*
!core/live2d.d.ts
key: ${{ runner.os }}-core-${{ hashFiles('scripts/setup.js') }}
key: ${{ hashFiles('scripts/setup.js') }}

- run: npm ci

- if: steps.cache-core.outputs.cache-hit != 'true'
run: npm run setup
run: |
echo Cache miss: ${{ hashFiles('scripts/setup.js') }}
npm run setup
- uses: GabrielBB/[email protected]
- run: npm run type
- run: npm run build

- name: Run tests
uses: GabrielBB/[email protected]
with:
run: npm run test:ci
run: npm test

- uses: actions/upload-artifact@v3
if: failure()
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
"playground": "vite",
"test": "vitest",
"test:u": "vitest --update",
"test:ci": "npm run type && npm run build && npm run test",
"test:debug": "node scripts/build-tests.js && npx floss --path=test.build -d",
"build": "rimraf dist && node scripts/build.js",
"pretype": "node scripts/patch-dts-generator.js",
"type": "rimraf types && dts-bundle-generator src/index.ts --no-check --project=tsconfig.build.json -o=types/index.d.ts && dts-bundle-generator src/extra.ts --no-check --project=tsconfig.build.json -o=types/extra.d.ts ",
Expand Down

0 comments on commit 3b77a30

Please sign in to comment.