refactor: enforce more worker type safety
[poolifier.git] / .github / workflows / ci.yml
CommitLineData
ac0fc89e
S
1name: CI
2
3on:
4 push:
3273bc66 5 branches: [master]
645d9208 6 pull_request:
4efc9472 7 types: [opened, synchronize, reopened]
2a7a130c
JB
8 merge_group:
9 branches: [master]
253f3064
S
10 workflow_dispatch:
11 inputs:
12 withBenchmark:
13 description: 'With Benchmark?'
14 default: false
ac0fc89e
S
15
16jobs:
17 build:
04ac2d66 18 runs-on: ${{ matrix.os }}
ac0fc89e
S
19
20 strategy:
21 matrix:
5082a5a8 22 os: [windows-latest, macos-latest, ubuntu-latest]
6bfbaa33 23 node: ['16.x', '18.x', '19.x']
ac0fc89e
S
24
25 steps:
26 - name: Checkout
5080f39d 27 uses: actions/checkout@v3
515e5da7
APA
28 with:
29 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar
ac0fc89e 30
2c23bc1e 31 - name: Setup node ${{ matrix.node }}
5080f39d 32 uses: actions/setup-node@v3
ac0fc89e 33 with:
5080f39d 34 node-version: ${{ matrix.node }}
ac0fc89e
S
35
36 - name: Install
186b35b6
JB
37 run: |
38 corepack enable
726457b4 39 corepack prepare pnpm@latest --activate
186b35b6 40 pnpm install
ac0fc89e 41
a34ce9a0 42 - name: Build
1477ea2f 43 run: pnpm run build
a34ce9a0 44
73db65c0 45 - name: Lint
186b35b6 46 run: pnpm run lint
73db65c0 47
daa307e5 48 - name: Tests
186b35b6 49 run: pnpm run test
daa307e5 50
c3d7c4f3 51 - name: Coverage Report
02234757 52 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
186b35b6 53 run: pnpm run coverage
253f3064 54
515e5da7 55 - name: Sonar Code Analysis
02234757 56 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
645d9208 57 uses: sonarsource/sonarcloud-github-action@master
515e5da7 58 env:
2ba4f142 59 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
515e5da7
APA
60 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61
253f3064
S
62 - name: Benchmark
63 if: github.event.inputs.withBenchmark
186b35b6 64 run: pnpm run benchmark