build(deps): bump sonarsource/sonarcloud-github-action
[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 pnpm
32 uses: pnpm/action-setup@v2
33 with:
34 version: 8
35
36 - name: Setup node ${{ matrix.node }}
37 uses: actions/setup-node@v3
38 with:
39 node-version: ${{ matrix.node }}
40 cache: 'pnpm'
41
42 - name: Install
43 run: pnpm install
44
45 - name: Build
46 run: pnpm build
47
48 - name: Lint
49 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
50 run: pnpm lint
51
52 - name: Tests
53 run: pnpm test
54
55 - name: Coverage Report
56 if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
57 run: pnpm coverage
58
59 - name: Sonar Code Analysis
60 if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
61 uses: sonarsource/sonarcloud-github-action@v2.0.0
62 env:
63 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
64 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
65
66 - name: Benchmark
67 if: github.event.inputs.withBenchmark
68 run: pnpm benchmark