Skip to content

Commit 562e70a

Browse files
author
Gusted
authored
Improve test workflow (darkreader#4689)
- Uses cache to install dependencies. - Only trigger PR on specific types. - Upgrade Node to LTS(14.x)
1 parent 3391960 commit 562e70a

1 file changed

Lines changed: 33 additions & 10 deletions

File tree

.github/workflows/test.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
1-
name: Run tests on Push or Pull Request
1+
name: Run tests on Pull Request or Push
22
on:
33
push:
44
branches:
55
- master
66
pull_request:
77
branches:
88
- master
9+
types:
10+
- opened
11+
- synchronize
12+
- reopened
13+
- ready_for_review
914
jobs:
10-
tests:
11-
name: Run Tests
15+
test:
16+
name: Run tests
1217
runs-on: ubuntu-latest
1318
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v1
16-
with:
17-
node-version: 12.x
18-
- run: npm install
19-
- run: npm test
20-
- run: npm run lint
19+
- name: Clone repository
20+
uses: actions/checkout@v2
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: 14.x
26+
27+
- name: Set up npm cache
28+
uses: actions/cache@v2
29+
with:
30+
path: ~/.npm
31+
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
32+
restore-keys: |
33+
${{ runner.OS }}-${{ hashFiles('package-lock.json') }}
34+
${{ runner.OS }}
35+
36+
- name: Install npm dependencies
37+
run: npm ci
38+
39+
- name: Run test agains code
40+
run: npm run test
41+
42+
- name: Lint code for code-style errors
43+
run: npm run lint

0 commit comments

Comments
 (0)