| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [master] |
| 6 | pull_request: |
| 7 | types: [opened, synchronize, reopened] |
| 8 | merge_group: |
| 9 | branches: [master] |
| 10 | |
| 11 | jobs: |
| 12 | build: |
| 13 | strategy: |
| 14 | matrix: |
| 15 | os: [windows-latest, macos-latest, ubuntu-latest] |
| 16 | node: ['16.x', '18.x', '20.x'] |
| 17 | |
| 18 | name: Node.js ${{ matrix.node }} on ${{ matrix.os }} |
| 19 | |
| 20 | runs-on: ${{ matrix.os }} |
| 21 | |
| 22 | steps: |
| 23 | - name: Checkout |
| 24 | uses: actions/checkout@v4 |
| 25 | with: |
| 26 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar |
| 27 | |
| 28 | - name: Setup pnpm |
| 29 | uses: pnpm/action-setup@v2 |
| 30 | with: |
| 31 | version: 8 |
| 32 | |
| 33 | - name: Setup Node.js ${{ matrix.node }} |
| 34 | uses: actions/setup-node@v3 |
| 35 | with: |
| 36 | node-version: ${{ matrix.node }} |
| 37 | cache: 'pnpm' |
| 38 | |
| 39 | - name: Install |
| 40 | run: pnpm install --ignore-scripts |
| 41 | |
| 42 | - name: Build |
| 43 | run: pnpm build |
| 44 | |
| 45 | - name: Lint |
| 46 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
| 47 | run: pnpm lint |
| 48 | |
| 49 | - name: Tests |
| 50 | run: pnpm test |
| 51 | |
| 52 | - name: Coverage Report |
| 53 | if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
| 54 | run: pnpm coverage |
| 55 | |
| 56 | - name: Sonar Code Analysis |
| 57 | if: ${{ github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
| 58 | uses: sonarsource/sonarcloud-github-action@v2.0.1 |
| 59 | env: |
| 60 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |