Merge branch 'master' of github.com:poolifier/poolifier
[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]
1df0a8db 20 node: ['16.x', '18.x', '20.x']
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
JB
32 - name: Setup pnpm
33 uses: pnpm/action-setup@v2
34 with:
35 version: 8
36
8ea47589 37 - name: Setup Node.js ${{ matrix.node }}
5080f39d 38 uses: actions/setup-node@v3
ac0fc89e 39 with:
5080f39d 40 node-version: ${{ matrix.node }}
4c156521 41 cache: 'pnpm'
ac0fc89e
S
42
43 - name: Install
45415455 44 run: pnpm install --ignore-scripts
ac0fc89e 45
a34ce9a0 46 - name: Build
4c156521 47 run: pnpm build
a34ce9a0 48
73db65c0 49 - name: Lint
7c60360a 50 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
4c156521 51 run: pnpm lint
73db65c0 52
daa307e5 53 - name: Tests
4c156521 54 run: pnpm test
daa307e5 55
c3d7c4f3 56 - name: Coverage Report
85bdfa4f 57 if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
4c156521 58 run: pnpm coverage
253f3064 59
515e5da7 60 - name: Sonar Code Analysis
90743693 61 if: ${{ github.event.repository.fork == false && github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
f725dbf0 62 uses: sonarsource/sonarcloud-github-action@v2.0.1
515e5da7 63 env:
02fd4f2c 64 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
515e5da7 65 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}