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', '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 run: pnpm lint
50
51 - name: Tests
52 run: pnpm test
53
54 - name: Coverage Report
55 if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
56 run: pnpm coverage
57
58 - name: Sonar Code Analysis
59 if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
60 uses: sonarsource/sonarcloud-github-action@v1.9.1
61 env:
62 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
63 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
64
65 - name: Benchmark
66 if: github.event.inputs.withBenchmark
67 run: pnpm benchmark