Debian Codegraph @

pirates/.github/workflows/build.yml

raw
1
2 name: CI
3
4 on:
5 push:
6 branches:
7 - main
8 - renovate/**
9 pull_request:
10
11 env:
12 NODE_VERSION: 16
13
14 jobs:
15 tests:
16 strategy:
17 matrix:
18 node: [ '6', '8', '10', '12', '14', '16' ]
19 name: Unit tests (Node v${{ matrix.node }})
20 runs-on: ubuntu-latest
21
22 steps:
23 - name: Checkout
24 uses: actions/checkout@v2
25
26 - name: Setup Node.js
27 uses: actions/setup-node@v2
28 with:
29 node-version: ${{ matrix.node }}
30 cache: 'yarn'
31
32 - name: Cache node_modules
33 uses: actions/cache@v2
34 id: cache-nodemodules
35 with:
36 path: node_modules
37 key: ${{ runner.os }}-${{ matrix.node }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
38
39 - name: Install dependencies
40 if: steps.cache-nodemodules.outputs.cache-hit != 'true'
41 run: yarn install --frozen-lockfile --non-interactive
42
43 - name: Unit tests
44 run: yarn test
45
46 - name: Upload code coverage
47 uses: codecov/codecov-action@v2
48 with:
49 files: ./coverage/coverage-final.json
50 name: codecov-umbrella
51 fail_ci_if_error: true
52
53 lint:
54 name: Lint
55 runs-on: ubuntu-latest
56
57 steps:
58 - name: Checkout
59 uses: actions/checkout@v2
60
61 - name: Setup Node.js
62 uses: actions/setup-node@v2
63 with:
64 node-version: ${{ env.NODE_VERSION }}
65 cache: 'yarn'
66
67 - name: Cache node_modules
68 uses: actions/cache@v2
69 id: cache-nodemodules
70 with:
71 path: node_modules
72 key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
73
74 - name: Install dependencies
75 if: steps.cache-nodemodules.outputs.cache-hit != 'true'
76 run: yarn install --frozen-lockfile --non-interactive
77
78 - name: Lint
79 run: yarn lint
80
81 release:
82 needs: [tests, lint]
83 if: github.ref == 'refs/heads/main'
84 name: Release
85 runs-on: ubuntu-latest
86
87 steps:
88 - name: Checkout
89 uses: actions/checkout@v2
90 with:
91 fetch-depth: 0
92
93 - name: Setup Node.js
94 uses: actions/setup-node@v2
95 with:
96 node-version: ${{ env.NODE_VERSION }}
97 cache: 'yarn'
98
99 - name: Cache node_modules
100 uses: actions/cache@v2
101 id: cache-nodemodules
102 with:
103 path: node_modules
104 key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
105
106 - name: Install dependencies
107 if: steps.cache-nodemodules.outputs.cache-hit != 'true'
108 run: yarn install --frozen-lockfile --non-interactive
109
110 - name: Release
111 run: npx semantic-release --branches main
112 env:
113 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}