Merge dependabot/npm_and_yarn/examples/typescript/websocket-server-pool/ws-worker_thr...
[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]
ac0fc89e 10
392525c9
JB
11permissions:
12 contents: read
13 checks: read
14
ac0fc89e
S
15jobs:
16 build:
ac0fc89e
S
17 strategy:
18 matrix:
5082a5a8 19 os: [windows-latest, macos-latest, ubuntu-latest]
77acbd60 20 node: ['18.x', '20.x', 'latest']
ac0fc89e 21
45415455
JB
22 name: Node.js ${{ matrix.node }} on ${{ matrix.os }}
23
24 runs-on: ${{ matrix.os }}
25
ac0fc89e
S
26 steps:
27 - name: Checkout
b358d1ac 28 uses: actions/checkout@v4
515e5da7
APA
29 with:
30 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar
ac0fc89e 31
4c156521 32 - name: Setup pnpm
2ca706c4 33 uses: pnpm/action-setup@v3
4c156521
JB
34 with:
35 version: 8
36
8ea47589 37 - name: Setup Node.js ${{ matrix.node }}
6c527d3f 38 uses: actions/setup-node@v4
ac0fc89e 39 with:
5080f39d 40 node-version: ${{ matrix.node }}
4c156521 41 cache: 'pnpm'
ac0fc89e 42
f1c674cd 43 - name: Install Dependencies
c1a37d98 44 run: pnpm install --ignore-scripts --frozen-lockfile
ac0fc89e 45
a34ce9a0 46 - name: Build
4c156521 47 run: pnpm build
a34ce9a0 48
73db65c0 49 - name: Lint
277c49bf 50 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }}
4c156521 51 run: pnpm lint
73db65c0 52
daa307e5 53 - name: Tests
4c156521 54 run: pnpm test
daa307e5 55
c3d7c4f3 56 - name: Coverage Report
277c49bf 57 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }}
4c156521 58 run: pnpm coverage
253f3064 59
3f723961
JB
60 - name: Check for SonarCloud Token Availability
61 id: sonar-token
62 shell: bash
63 run: |
64 if [ "${{ secrets.SONAR_TOKEN }}" != '' ]; then
65 echo "available=true" >> $GITHUB_OUTPUT;
66 else
67 echo "available=false" >> $GITHUB_OUTPUT;
68 fi
69
70 - name: SonarCloud Code Analysis
277c49bf 71 if: ${{ steps.sonar-token.outputs.available == 'true' && github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }}
f277ff1d 72 uses: sonarsource/sonarcloud-github-action@v2.1.1
515e5da7 73 env:
02fd4f2c 74 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
515e5da7 75 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}