build: pin node version to 19.7.x CI
[poolifier.git] / .github / workflows / ci.yml
CommitLineData
ac0fc89e
S
1name: CI
2
3on:
4 push:
3273bc66 5 branches: [master]
645d9208 6 pull_request:
4efc9472 7 types: [opened, synchronize, reopened]
2a7a130c
JB
8 merge_group:
9 branches: [master]
253f3064
S
10 workflow_dispatch:
11 inputs:
12 withBenchmark:
13 description: 'With Benchmark?'
14 default: false
ac0fc89e
S
15
16jobs:
17 build:
04ac2d66 18 runs-on: ${{ matrix.os }}
ac0fc89e
S
19
20 strategy:
21 matrix:
5082a5a8 22 os: [windows-latest, macos-latest, ubuntu-latest]
9ea66078 23 node: ['16.x', '18.x', '19.7.x']
ac0fc89e
S
24
25 steps:
26 - name: Checkout
5080f39d 27 uses: actions/checkout@v3
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 30
2c23bc1e 31 - name: Setup node ${{ matrix.node }}
5080f39d 32 uses: actions/setup-node@v3
ac0fc89e 33 with:
5080f39d 34 node-version: ${{ matrix.node }}
ac0fc89e
S
35
36 - name: Install
a357cd2d 37 run: npm ci
ac0fc89e 38
a34ce9a0
JB
39 - name: Build
40 run: npm run build --if-present
41
73db65c0
JB
42 - name: Lint
43 run: npm run lint
44
daa307e5
JB
45 - name: Tests
46 run: npm run test
47
c3d7c4f3 48 - name: Coverage Report
02234757 49 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
c3d7c4f3 50 run: npm run coverage
253f3064 51
515e5da7 52 - name: Sonar Code Analysis
02234757 53 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
645d9208 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