Add Unreleased section to CHANGELOG.md
[poolifier.git] / .github / workflows / ci.yml
CommitLineData
ac0fc89e
S
1name: CI
2
3on:
4 push:
5 branches:
6 - master
645d9208 7 pull_request:
4efc9472 8 types: [opened, synchronize, reopened]
253f3064
S
9 workflow_dispatch:
10 inputs:
11 withBenchmark:
12 description: 'With Benchmark?'
13 default: false
ac0fc89e
S
14
15jobs:
16 build:
04ac2d66 17 runs-on: ${{ matrix.os }}
ac0fc89e
S
18
19 strategy:
20 matrix:
5082a5a8 21 os: [windows-latest, macos-latest, ubuntu-latest]
a746be5b 22 node: ['16.x', '18.x']
ac0fc89e
S
23
24 steps:
25 - name: Checkout
5080f39d 26 uses: actions/checkout@v3
515e5da7
APA
27 with:
28 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar
ac0fc89e 29
5080f39d
JB
30 - name: Set node version to ${{ matrix.node }}
31 uses: actions/setup-node@v3
ac0fc89e 32 with:
5080f39d 33 node-version: ${{ matrix.node }}
ac0fc89e
S
34
35 - name: Install
a357cd2d 36 run: npm ci
ac0fc89e
S
37
38 - name: Build
39 run: npm run build --if-present
40
777b7824
S
41 - name: Lint
42 run: npm run lint
43
daa307e5 44 - name: Tests
51fe3419 45 if: "matrix.os != 'windows-latest' || matrix.node != '18.x'"
daa307e5
JB
46 run: npm run test
47
48 - name: Coverage & Linter Reports
49 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'"
777b7824 50 run: |
ac0fc89e 51 npm run coverage
7d82d90e 52 npm run lint:report
253f3064 53
515e5da7 54 - name: Sonar Code Analysis
daa307e5 55 if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'"
645d9208 56 uses: sonarsource/sonarcloud-github-action@master
515e5da7 57 env:
2ba4f142 58 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
515e5da7
APA
59 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
60
253f3064
S
61 - name: Benchmark
62 if: github.event.inputs.withBenchmark
63 run: npm run benchmark