Commit | Line | Data |
---|---|---|
ac0fc89e S |
1 | name: CI |
2 | ||
3 | on: | |
4 | push: | |
5 | branches: | |
12257749 | 6 | - ${{ github.event.repository.default_branch }} |
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 | |
15 | jobs: | |
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 | 37 | |
a34ce9a0 JB |
38 | - name: Build |
39 | run: npm run build --if-present | |
40 | ||
73db65c0 JB |
41 | - name: Lint |
42 | run: npm run lint | |
43 | ||
daa307e5 JB |
44 | - name: Tests |
45 | run: npm run test | |
46 | ||
c3d7c4f3 | 47 | - name: Coverage Report |
daa307e5 | 48 | if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'" |
c3d7c4f3 | 49 | run: npm run coverage |
253f3064 | 50 | |
515e5da7 | 51 | - name: Sonar Code Analysis |
daa307e5 | 52 | if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'" |
645d9208 | 53 | uses: sonarsource/sonarcloud-github-action@master |
515e5da7 | 54 | env: |
2ba4f142 | 55 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
515e5da7 APA |
56 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
57 | ||
253f3064 S |
58 | - name: Benchmark |
59 | if: github.event.inputs.withBenchmark | |
60 | run: npm run benchmark |