Commit | Line | Data |
---|---|---|
ac0fc89e S |
1 | name: CI |
2 | ||
3 | on: | |
4 | push: | |
5 | branches: | |
6 | - master | |
7 | pull_request: | |
253f3064 S |
8 | workflow_dispatch: |
9 | inputs: | |
10 | withBenchmark: | |
11 | description: 'With Benchmark?' | |
12 | default: false | |
ac0fc89e S |
13 | |
14 | jobs: | |
15 | build: | |
16 | runs-on: ubuntu-latest | |
17 | ||
18 | strategy: | |
19 | matrix: | |
20 | node-version: [12.x, 14.x] | |
21 | ||
22 | steps: | |
23 | - name: Checkout | |
24 | uses: actions/checkout@v2 | |
515e5da7 APA |
25 | with: |
26 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar | |
ac0fc89e S |
27 | |
28 | - name: Set node version to ${{ matrix.node-version }} | |
022a17cd | 29 | uses: actions/setup-node@v2 |
ac0fc89e S |
30 | with: |
31 | node-version: ${{ matrix.node-version }} | |
32 | ||
33 | - name: Install | |
34 | run: npm ci | |
35 | ||
36 | - name: Build | |
37 | run: npm run build --if-present | |
38 | ||
777b7824 S |
39 | - name: Lint |
40 | run: npm run lint | |
41 | ||
515e5da7 | 42 | - name: Tests & Coverage |
777b7824 | 43 | run: | |
ac0fc89e | 44 | npm run test |
ac0fc89e S |
45 | npm run coverage |
46 | env: | |
47 | CI: true | |
253f3064 | 48 | |
515e5da7 | 49 | - name: Sonar Code Analysis |
0e409a07 | 50 | if: "github.repository == 'pioardi/poolifier' && matrix.node-version == '14.x'" |
515e5da7 APA |
51 | run: | |
52 | npm run sonar | |
53 | env: | |
54 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
55 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
56 | ||
253f3064 S |
57 | - name: Benchmark |
58 | if: github.event.inputs.withBenchmark | |
59 | run: npm run benchmark |