|
3 | 3 | pull_request: |
4 | 4 | push: |
5 | 5 | branches: |
6 | | - - master |
| 6 | + - staging |
7 | 7 | - 'v*' |
8 | 8 | env: |
9 | 9 | node_version: "12.x" |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - build: # make sure build/ci work properly |
13 | | - name: Build |
| 12 | + package: |
| 13 | + name: Package |
14 | 14 | runs-on: ubuntu-latest |
15 | 15 | steps: |
16 | | - - uses: actions/checkout@v1 |
| 16 | + - uses: actions/checkout@v2 |
17 | 17 | - name: Set up Node.js |
18 | | - uses: actions/setup-node@v1 |
| 18 | + uses: actions/setup-node@v2 |
19 | 19 | with: |
20 | 20 | node-version: ${{ env.node_version }} |
21 | | - |
22 | | - - name: npm install |
23 | | - run: npm install |
24 | | - |
25 | | - - name: npm build |
26 | | - run: npm build |
27 | | - |
28 | | - - name: npm run pack |
29 | | - run: npm run package |
| 21 | + cache: npm |
| 22 | + cache-dependency-path: '**/package-lock.json' |
| 23 | + - run: npm ci --prefer-offline |
| 24 | + - run: npm run package |
| 25 | + # Complain if contents of /dist directory aren't as expected |
| 26 | + - run: git diff --exit-code --compact-summary dist || { echo "::error::/dist directory does not match source code - please run 'npm run package'" && exit 1; } |
30 | 27 |
|
31 | 28 | audit: |
32 | 29 | name: Audit |
33 | 30 | runs-on: ubuntu-latest |
34 | 31 | steps: |
35 | 32 | - uses: actions/checkout@v2 |
36 | | - |
37 | 33 | - name: Set up Node.js |
38 | | - uses: actions/setup-node@v1 |
| 34 | + uses: actions/setup-node@v2 |
39 | 35 | with: |
40 | 36 | node-version: ${{ env.node_version }} |
41 | | - |
42 | | - - name: npm audit |
43 | | - run: npm audit --audit-level=critical |
| 37 | + cache: npm |
| 38 | + cache-dependency-path: '**/package-lock.json' |
| 39 | + - run: npm audit --audit-level=critical |
44 | 40 |
|
45 | 41 | lint: |
46 | 42 | name: Lint |
47 | 43 | runs-on: ubuntu-latest |
48 | 44 | steps: |
49 | 45 | - uses: actions/checkout@v2 |
50 | | - |
51 | 46 | - name: Set up Node.js |
52 | | - uses: actions/setup-node@v1 |
| 47 | + uses: actions/setup-node@v2 |
53 | 48 | with: |
54 | 49 | node-version: ${{ env.node_version }} |
55 | | - |
56 | | - - name: npm install |
57 | | - run: npm install |
58 | | - |
59 | | - - name: npm lint |
60 | | - run: npm run lint |
| 50 | + cache: npm |
| 51 | + cache-dependency-path: '**/package-lock.json' |
| 52 | + - run: npm ci --prefer-offline |
| 53 | + - run: npm run lint |
61 | 54 |
|
62 | 55 | # When tests are added to the code uncomment |
63 | | -# test-code: |
| 56 | +# test: |
64 | 57 | # name: Test |
65 | 58 | # runs-on: ubuntu-latest |
66 | 59 | # steps: |
67 | 60 | # - uses: actions/checkout@v2 |
68 | | -# |
69 | 61 | # - name: Set up Node.js |
70 | | -# uses: actions/setup-node@v1 |
| 62 | +# uses: actions/setup-node@v2 |
71 | 63 | # with: |
72 | 64 | # node-version: ${{ env.node_version }} |
73 | | -# |
74 | | -# - name: npm install |
75 | | -# run: npm install |
76 | | -# |
77 | | -# - name: npm test |
78 | | -# run: npm test |
| 65 | +# cache: npm |
| 66 | +# cache-dependency-path: '**/package-lock.json' |
| 67 | +# - run: npm ci --prefer-offline |
| 68 | +# - run: npm test |
0 commit comments