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