Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-cluster...
[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 strategy:
19 matrix:
20 os: [windows-latest, macos-latest, ubuntu-latest]
21 node: ['16.x', '18.x', '20.x']
22
23 name: Node.js ${{ matrix.node }} on ${{ matrix.os }}
24
25 runs-on: ${{ matrix.os }}
26
27 steps:
28 - name: Checkout
29 uses: actions/checkout@v4
30 with:
31 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar
32
33 - name: Setup pnpm
34 uses: pnpm/action-setup@v2
35 with:
36 version: 8
37
38 - name: Setup Node.js ${{ matrix.node }}
39 uses: actions/setup-node@v3
40 with:
41 node-version: ${{ matrix.node }}
42 cache: 'pnpm'
43
44 - name: Install
45 run: pnpm install --ignore-scripts
46
47 - name: Build
48 run: pnpm build
49
50 - name: Lint
51 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
52 run: pnpm lint
53
54 - name: Tests
55 run: pnpm test
56
57 - name: Coverage Report
58 if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
59 run: pnpm coverage
60
61 - name: Sonar Code Analysis
62 if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
63 uses: sonarsource/sonarcloud-github-action@v2.0.1
64 env:
65 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
67
68 - name: Benchmark
69 if: github.event.inputs.withBenchmark
70 run: pnpm benchmark