Add sonarcloud properties
[poolifier.git] / .github / workflows / ci.yml
CommitLineData
ac0fc89e
S
1name: CI
2
3on:
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
14jobs:
15 build:
16 runs-on: ubuntu-latest
17
18 strategy:
19 matrix:
022955bc 20 node-version: [12.x, 14.x, 16.x]
ac0fc89e
S
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
9b2fdd9f
JB
50 if: "github.repository == 'poolifier/poolifier' && matrix.node-version == '14.x'"
51 uses: SonarSource/sonarcloud-github-action@master
515e5da7 52 env:
2ba4f142 53 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
515e5da7
APA
54 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
55
253f3064
S
56 - name: Benchmark
57 if: github.event.inputs.withBenchmark
58 run: npm run benchmark