File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : ' Get and Cache Dependencies'
2+ description : ' Get dependencies via npm and cache them.'
3+ inputs :
4+ caching :
5+ description : ' Decide to cache deps or not.'
6+ required : false
7+ default : ' true'
8+ runs :
9+ using : ' composite'
10+ steps :
11+ - name : Cache dependencies
12+ if : inputs.caching == 'true'
13+ id : cache
14+ uses : actions/cache@v3
15+ with :
16+ path : node_modules
17+ key : deps-node-modules-${{ hashFiles('**/package-lock.json') }}
18+ - name : Install dependencies
19+ if : steps.cache.outputs.cache-hit != 'true' || inputs.caching != 'true'
20+ run : npm ci
21+ shell : bash
Original file line number Diff line number Diff line change 1+ name : Build
2+ on : push
3+ jobs :
4+ lint :
5+ runs-on : ubuntu-latest
6+ steps :
7+ - name : Checkout
8+ uses : actions/checkout@v4
9+ - name : Install and Cache Dependencies
10+ uses : ./.github/actions/cached-deps
11+ with :
12+ caching : ' false'
13+ - name : Lint code
14+ run : npm run lint
15+ test :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v4
20+ - name : Install and Cache Dependencies
21+ uses : ./.github/actions/cached-deps
22+ with :
23+ caching : ' true'
24+ - name : Run tests
25+ id : run-tests
26+ run : npm run test
27+ - name : Upload test report
28+ if : failure() && steps.run-tests.outcome == 'failure'
29+ uses : actions/upload-artifact@v4
30+ with :
31+ name : test-report
32+ path : test.json
33+ build :
34+ needs : test
35+ runs-on : ubuntu-latest
36+ steps :
37+ - name : Checkout
38+ uses : actions/checkout@v4
39+ - name : Install and Cache Dependencies
40+ uses : ./.github/actions/cached-deps
41+ with :
42+ caching : ' true'
43+ - name : Build
44+ run : npm run build
45+ - name : Upload build artifacts
46+ uses : actions/upload-artifact@v4
47+ with :
48+ name : build-artifacts
49+ path : dist
Original file line number Diff line number Diff line change 1+ name : Test Matrix
2+ on : push
3+ jobs :
4+ build :
5+ continue-on-error : true
6+ strategy :
7+ matrix :
8+ node-version : [16, 18, 20]
9+ operating-system : [ubuntu-latest, windows-latest, macos-latest]
10+ runs-on : ${{ matrix.operating-system }}
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v4
14+ - name : Setup Node
15+ uses : actions/setup-node@v4
16+ with :
17+ node-version : ${{ matrix.node-version }}
18+ - name : Install and Cache Dependencies
19+ uses : ./.github/actions/cached-deps
20+ - name : Build
21+ run : npm run build
22+ test :
23+ continue-on-error : true
24+ strategy :
25+ matrix :
26+ node-version : [16, 18, 20]
27+ operating-system : [ubuntu-latest, windows-latest, macos-latest]
28+ runs-on : ${{ matrix.operating-system }}
29+ steps :
30+ - name : Checkout
31+ uses : actions/checkout@v4
32+ - name : Setup Node
33+ uses : actions/setup-node@v4
34+ with :
35+ node-version : ${{ matrix.node-version }}
36+ - name : Install and Cache Dependencies
37+ uses : ./.github/actions/cached-deps
38+ - name : Test
39+ run : npm run test
You can’t perform that action at this time.
0 commit comments