CI: stabilize — cache npm, use Node 20, fallback type-check, build on… #50
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [ "**" ] | |
| pull_request: | |
| branches: [ "**" ] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: | | |
| if [ -f package-lock.json ]; then npm ci; else npm install; fi | |
| - name: Security audit | |
| run: npm audit --audit-level=moderate || true | |
| - name: Lint | |
| run: npx eslint . --ext .ts || true | |
| - name: Type check | |
| run: | | |
| if npm run type-check --silent; then exit 0; fi | |
| npx tsc --noEmit | |
| - name: Test | |
| env: | |
| CI: true | |
| run: npm test -- --coverage || true | |
| - name: Build | |
| env: | |
| CI: true | |
| run: npm run build --if-present |