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