|
| 1 | +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions |
| 3 | + |
| 4 | +name: Test |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [main] |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + name: Unit tests |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v5 |
| 18 | + - uses: actions/setup-node@v5 |
| 19 | + with: |
| 20 | + node-version: 22 |
| 21 | + - run: npm ci --ignore-scripts --no-audit --no-fund |
| 22 | + - run: npm test |
| 23 | + - name: Upload coverage reports to Codecov |
| 24 | + uses: codecov/codecov-action@v5 |
| 25 | + with: |
| 26 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 27 | + |
| 28 | + check-ts: |
| 29 | + name: Check types |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v5 |
| 33 | + - uses: actions/setup-node@v5 |
| 34 | + with: |
| 35 | + node-version: 22 |
| 36 | + - run: npm ci --ignore-scripts --no-audit --no-fund |
| 37 | + - run: npm run check |
| 38 | + |
| 39 | + lint-code: |
| 40 | + name: Lint code (oxlint) |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v5 |
| 44 | + - uses: actions/setup-node@v5 |
| 45 | + with: |
| 46 | + node-version: 22 |
| 47 | + - run: npm ci --ignore-scripts --no-audit --no-fund |
| 48 | + - run: npm run lint |
| 49 | + |
| 50 | + declutter-code: |
| 51 | + name: Declutter code (Knip) |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v5 |
| 55 | + - uses: actions/setup-node@v5 |
| 56 | + with: |
| 57 | + node-version: 22 |
| 58 | + - run: npm ci --ignore-scripts --no-audit --no-fund |
| 59 | + - run: npm run knip |
| 60 | + |
| 61 | + lint-package: |
| 62 | + name: Lint package (publint) |
| 63 | + runs-on: ubuntu-latest |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v5 |
| 66 | + - uses: actions/setup-node@v5 |
| 67 | + with: |
| 68 | + node-version: 22 |
| 69 | + - run: npm ci --ignore-scripts --no-audit --no-fund |
| 70 | + - run: npm run build |
| 71 | + - run: npm run lint-package |
| 72 | + |
| 73 | + bundle-analysis: |
| 74 | + name: Report bundle analysis (codecov) |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v5 |
| 78 | + - uses: actions/setup-node@v5 |
| 79 | + with: |
| 80 | + node-version: 22 |
| 81 | + - run: npm ci --ignore-scripts --no-audit --no-fund |
| 82 | + - run: npm run build |
| 83 | + env: |
| 84 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 85 | + |
| 86 | + npm-audit: |
| 87 | + name: Audit packages |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v5 |
| 91 | + - uses: actions/setup-node@v5 |
| 92 | + with: |
| 93 | + node-version: 22 |
| 94 | + - run: npm audit --audit-level=high |
0 commit comments