|
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 | 1 | name: Node.js CI |
5 | 2 |
|
6 | 3 | on: |
|
9 | 6 | pull_request: |
10 | 7 | branches: [main] |
11 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
12 | 12 | jobs: |
13 | 13 | lint: |
14 | 14 | name: Lint JS |
15 | 15 | runs-on: ubuntu-latest |
16 | 16 | steps: |
17 | | - - uses: actions/checkout@v6 |
18 | | - - uses: actions/setup-node@v6 |
| 17 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 18 | + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 |
| 19 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
19 | 20 | with: |
20 | 21 | node-version: 22 |
21 | | - - run: npm ci --ignore-scripts --no-audit --no-fund |
22 | | - - run: npm run lint |
| 22 | + cache: pnpm |
| 23 | + - run: pnpm install --frozen-lockfile --ignore-scripts |
| 24 | + - run: pnpm run lint |
23 | 25 |
|
24 | 26 | test: |
25 | 27 | name: Unit tests |
26 | 28 | runs-on: ubuntu-latest |
27 | 29 | steps: |
28 | | - - uses: actions/checkout@v6 |
29 | | - - uses: actions/setup-node@v6 |
| 30 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 31 | + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 |
| 32 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
30 | 33 | with: |
31 | 34 | node-version: 22 |
32 | | - - run: npm ci --ignore-scripts --no-audit --no-fund |
33 | | - - run: npm test |
| 35 | + cache: pnpm |
| 36 | + - run: pnpm install --frozen-lockfile --ignore-scripts |
| 37 | + - run: pnpm test |
34 | 38 |
|
35 | 39 | code-coverage: |
36 | 40 | name: Code coverage |
37 | 41 | runs-on: ubuntu-latest |
38 | 42 | steps: |
39 | | - - uses: actions/checkout@v6 |
40 | | - - uses: actions/setup-node@v6 |
| 43 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 44 | + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 |
| 45 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
41 | 46 | with: |
42 | 47 | node-version: 22 |
43 | | - - run: npm ci --ignore-scripts --no-audit --no-fund |
44 | | - - run: npm test |
| 48 | + cache: pnpm |
| 49 | + - run: pnpm install --frozen-lockfile --ignore-scripts |
| 50 | + - run: pnpm test |
45 | 51 | - name: Upload coverage reports to Codecov |
46 | | - uses: codecov/codecov-action@v6 |
| 52 | + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6 |
47 | 53 | with: |
48 | 54 | token: ${{ secrets.CODECOV_TOKEN }} |
49 | 55 |
|
50 | 56 | build: |
51 | 57 | name: Build |
52 | 58 | runs-on: ubuntu-latest |
53 | 59 | steps: |
54 | | - - uses: actions/checkout@v6 |
55 | | - - uses: actions/setup-node@v6 |
| 60 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 61 | + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 |
| 62 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
56 | 63 | with: |
57 | 64 | node-version: 22 |
58 | | - - run: npm ci --ignore-scripts --no-audit --no-fund |
59 | | - - run: npm run build |
| 65 | + cache: pnpm |
| 66 | + - run: pnpm install --frozen-lockfile --ignore-scripts |
| 67 | + - run: pnpm run build |
60 | 68 | env: |
61 | 69 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
62 | 70 |
|
63 | 71 | knip: |
64 | 72 | name: Lint unused code |
65 | 73 | runs-on: ubuntu-latest |
66 | 74 | steps: |
67 | | - - uses: actions/checkout@v6 |
68 | | - - uses: actions/setup-node@v6 |
| 75 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 76 | + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 |
| 77 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
69 | 78 | with: |
70 | 79 | node-version: 22 |
71 | | - - run: npm ci --ignore-scripts --no-audit --no-fund |
72 | | - - run: npm run knip |
| 80 | + cache: pnpm |
| 81 | + - run: pnpm install --frozen-lockfile --ignore-scripts |
| 82 | + - run: pnpm run knip |
0 commit comments