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] |
2a7a130c JB |
8 | merge_group: |
9 | branches: [master] | |
253f3064 S |
10 | workflow_dispatch: |
11 | inputs: | |
12 | withBenchmark: | |
13 | description: 'With Benchmark?' | |
14 | default: false | |
ac0fc89e S |
15 | |
16 | jobs: | |
17 | build: | |
04ac2d66 | 18 | runs-on: ${{ matrix.os }} |
ac0fc89e S |
19 | |
20 | strategy: | |
21 | matrix: | |
5082a5a8 | 22 | os: [windows-latest, macos-latest, ubuntu-latest] |
1df0a8db | 23 | node: ['16.x', '18.x', '20.x'] |
ac0fc89e S |
24 | |
25 | steps: | |
26 | - name: Checkout | |
5080f39d | 27 | uses: actions/checkout@v3 |
515e5da7 APA |
28 | with: |
29 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar | |
ac0fc89e | 30 | |
4c156521 JB |
31 | - name: Setup pnpm |
32 | uses: pnpm/action-setup@v2 | |
33 | with: | |
34 | version: 8 | |
35 | ||
8ea47589 | 36 | - name: Setup Node.js ${{ matrix.node }} |
5080f39d | 37 | uses: actions/setup-node@v3 |
ac0fc89e | 38 | with: |
5080f39d | 39 | node-version: ${{ matrix.node }} |
4c156521 | 40 | cache: 'pnpm' |
ac0fc89e S |
41 | |
42 | - name: Install | |
4c156521 | 43 | run: pnpm install |
ac0fc89e | 44 | |
a34ce9a0 | 45 | - name: Build |
4c156521 | 46 | run: pnpm build |
a34ce9a0 | 47 | |
73db65c0 | 48 | - name: Lint |
7c60360a | 49 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
4c156521 | 50 | run: pnpm lint |
73db65c0 | 51 | |
daa307e5 | 52 | - name: Tests |
4c156521 | 53 | run: pnpm test |
daa307e5 | 54 | |
c3d7c4f3 | 55 | - name: Coverage Report |
85bdfa4f | 56 | if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
4c156521 | 57 | run: pnpm coverage |
253f3064 | 58 | |
515e5da7 | 59 | - name: Sonar Code Analysis |
85bdfa4f | 60 | if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
09d618c9 | 61 | uses: sonarsource/sonarcloud-github-action@v2.0.0 |
515e5da7 | 62 | env: |
02fd4f2c | 63 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
515e5da7 APA |
64 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
65 | ||
253f3064 S |
66 | - name: Benchmark |
67 | if: github.event.inputs.withBenchmark | |
4c156521 | 68 | run: pnpm benchmark |