build(ci): fix sonar-scanner version
[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', '20.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: |
38 corepack enable
39 corepack prepare pnpm@latest --activate
40 pnpm install
41
42 - name: Build
43 run: pnpm run build
44
45 - name: Lint
46 run: pnpm run lint
47
48 - name: Tests
49 run: pnpm run test
50
51 - name: Coverage Report
52 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
53 run: pnpm run coverage
54
55 - name: Sonar Code Analysis
56 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
57 uses: sonarsource/sonarcloud-github-action@v1.9.1
58 env:
59 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
60 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61
62 - name: Benchmark
63 if: github.event.inputs.withBenchmark
64 run: pnpm run benchmark