|
1 | 1 | name: CI |
| 2 | + |
2 | 3 | on: |
3 | 4 | pull_request: |
4 | 5 | push: |
5 | 6 | branches: |
6 | 7 | - staging |
7 | 8 | - 'v*' |
8 | 9 | env: |
9 | | - node_version: "16.x" |
| 10 | + node_version: "20.x" |
| 11 | + FORCE_COLOR: 3 |
10 | 12 |
|
11 | 13 | jobs: |
12 | 14 | build: # make sure build/ci work properly |
13 | 15 | name: Build |
14 | 16 | runs-on: ubuntu-latest |
15 | 17 | steps: |
16 | | - - uses: actions/checkout@v3 |
| 18 | + - uses: actions/checkout@v4 |
17 | 19 | - name: Set up Node.js |
18 | | - uses: actions/setup-node@v3 |
| 20 | + uses: actions/setup-node@v4 |
19 | 21 | with: |
20 | 22 | node-version: ${{ env.node_version }} |
21 | 23 |
|
22 | | - - name: npm install |
23 | | - run: npm install |
| 24 | + - name: npm ci |
| 25 | + run: npm ci --prefer-offline |
24 | 26 |
|
25 | | - - name: npm run pack |
| 27 | + - name: npm run package |
26 | 28 | run: npm run package |
27 | 29 |
|
| 30 | + - name: Check for any changed files |
| 31 | + run: | |
| 32 | + [[ -z $(git status --untracked-files=no --porcelain) ]] || \ |
| 33 | + (echo "::error title=npm run package::Files in the /dist directory shouldn't have changed. You forgot to run 'npm run package'." && exit 1) |
| 34 | +
|
28 | 35 | audit: |
29 | 36 | name: Audit |
30 | 37 | runs-on: ubuntu-latest |
31 | 38 | steps: |
32 | | - - uses: actions/checkout@v3 |
| 39 | + - uses: actions/checkout@v4 |
33 | 40 |
|
34 | 41 | - name: Set up Node.js |
35 | | - uses: actions/setup-node@v3 |
| 42 | + uses: actions/setup-node@v4 |
36 | 43 | with: |
37 | 44 | node-version: ${{ env.node_version }} |
38 | 45 |
|
| 46 | + # We don't need to install deps to audit them |
| 47 | + |
39 | 48 | - name: npm audit |
40 | 49 | run: npm audit --audit-level=critical |
41 | 50 |
|
42 | 51 | lint: |
43 | 52 | name: Lint |
44 | 53 | runs-on: ubuntu-latest |
45 | 54 | steps: |
46 | | - - uses: actions/checkout@v3 |
| 55 | + - uses: actions/checkout@v4 |
47 | 56 |
|
48 | 57 | - name: Set up Node.js |
49 | | - uses: actions/setup-node@v3 |
| 58 | + uses: actions/setup-node@v4 |
50 | 59 | with: |
51 | 60 | node-version: ${{ env.node_version }} |
| 61 | + cache: npm |
| 62 | + cache-dependency-path: '**/package-lock.json' |
52 | 63 |
|
53 | | - - name: npm install |
54 | | - run: npm install |
| 64 | + - name: npm ci |
| 65 | + run: npm ci --prefer-offline |
55 | 66 |
|
56 | 67 | - name: npm lint |
57 | 68 | run: npm run lint |
58 | 69 |
|
59 | | -# When tests are added to the code uncomment |
60 | | -# test-code: |
| 70 | +# test: |
61 | 71 | # name: Test |
62 | 72 | # runs-on: ubuntu-latest |
63 | 73 | # steps: |
64 | | -# - uses: actions/checkout@v3 |
| 74 | +# - uses: actions/checkout@v4 |
65 | 75 | # |
66 | 76 | # - name: Set up Node.js |
67 | | -# uses: actions/setup-node@v3 |
| 77 | +# uses: actions/setup-node@v4 |
68 | 78 | # with: |
69 | 79 | # node-version: ${{ env.node_version }} |
| 80 | +# cache: npm |
| 81 | +# cache-dependency-path: '**/package-lock.json' |
70 | 82 | # |
71 | | -# - name: npm install |
72 | | -# run: npm install |
| 83 | +# - name: npm ci |
| 84 | +# run: npm ci --prefer-offline |
73 | 85 | # |
74 | 86 | # - name: npm test |
75 | 87 | # run: npm test |
| 88 | +# |
| 89 | +# - name: Report test coverage to Codecov |
| 90 | +# uses: codecov/codecov-action@v3 |
0 commit comments