build(deps-dev): apply updates
[poolifier.git] / .github / workflows / ci.yml
1 name: CI
2
3 on:
4 push:
5 branches: [master]
6 pull_request:
7 types: [opened, synchronize, reopened]
8 merge_group:
9 branches: [master]
10 workflow_dispatch:
11 inputs:
12 withBenchmark:
13 description: 'With Benchmark?'
14 default: false
15
16 jobs:
17 build:
18 runs-on: ${{ matrix.os }}
19
20 strategy:
21 matrix:
22 os: [windows-latest, macos-latest, ubuntu-latest]
23 node: ['16.x', '18.x', '19.x']
24
25 steps:
26 - name: Checkout
27 uses: actions/checkout@v3
28 with:
29 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar
30
31 - name: Setup node ${{ matrix.node }}
32 uses: actions/setup-node@v3
33 with:
34 node-version: ${{ matrix.node }}
35
36 - name: Install
37 run: npm ci
38
39 - name: Build
40 run: npm run build --if-present
41
42 - name: Lint
43 run: npm run lint
44
45 - name: Tests
46 run: npm run test
47
48 - name: Coverage Report
49 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
50 run: npm run coverage
51
52 - name: Sonar Code Analysis
53 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
54 uses: sonarsource/sonarcloud-github-action@master
55 env:
56 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
57 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
58
59 - name: Benchmark
60 if: github.event.inputs.withBenchmark
61 run: npm run benchmark