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