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