Skip to content

Commit faaa848

Browse files
ci(github): timeout job after 5 min, cache node modules, name steps
https://github.com/actions/cache/blob/main/examples.md#node---npm
1 parent f8d44f1 commit faaa848

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,60 @@
11
name: build
22
on: [push, pull_request]
3+
34
jobs:
45
build:
56
runs-on: ubuntu-latest
7+
timeout-minutes: 5
68
strategy:
79
matrix:
810
node-version: [14]
11+
912
steps:
10-
- uses: actions/checkout@v2
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
1115
with:
1216
fetch-depth: 0
17+
1318
- name: Use Node.js ${{ matrix.node-version }}
14-
uses: actions/setup-node@v1
19+
uses: actions/setup-node@v2
1520
with:
1621
node-version: ${{ matrix.node-version }}
17-
- run: npm install
18-
- run: npx commitlint --from=HEAD~1
19-
- run: npm run lint
20-
- run: npm run lint:dts
21-
- run: npm run test:ci
22-
- run: npm run test:module
23-
- run: npm run test:integration
24-
- run: npm run benchmark
22+
23+
- name: Cache node modules
24+
uses: actions/cache@v2
25+
env:
26+
cache-name: cache-node-modules
27+
with:
28+
# npm cache files are stored in `~/.npm` on Linux/macOS
29+
path: ~/.npm
30+
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-
33+
34+
- name: Install dependencies
35+
run: npm install
36+
37+
- name: Lint commit message
38+
run: npx commitlint --from=HEAD~1
39+
40+
- name: Lint JavaScript files
41+
run: npm run lint
42+
43+
- name: Lint TypeScript declaration files
44+
run: npm run lint:dts
45+
46+
- name: Run unit tests
47+
run: npm run test:ci
48+
49+
- name: Run ES modules tests
50+
run: npm run test:module
51+
52+
- name: Run integration tests
53+
run: npm run test:integration
54+
55+
- name: Run benchmark
56+
run: npm run benchmark
57+
2558
- name: Coveralls
2659
uses: coverallsapp/github-action@master
2760
with:

0 commit comments

Comments
 (0)