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] | |
ac0fc89e | 10 | |
392525c9 JB |
11 | permissions: |
12 | contents: read | |
13 | checks: read | |
14 | ||
ac0fc89e S |
15 | jobs: |
16 | build: | |
ac0fc89e S |
17 | strategy: |
18 | matrix: | |
5082a5a8 | 19 | os: [windows-latest, macos-latest, ubuntu-latest] |
77acbd60 | 20 | node: ['18.x', '20.x', 'latest'] |
ac0fc89e | 21 | |
45415455 JB |
22 | name: Node.js ${{ matrix.node }} on ${{ matrix.os }} |
23 | ||
24 | runs-on: ${{ matrix.os }} | |
25 | ||
ac0fc89e S |
26 | steps: |
27 | - name: Checkout | |
b358d1ac | 28 | uses: actions/checkout@v4 |
515e5da7 APA |
29 | with: |
30 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar | |
ac0fc89e | 31 | |
4c156521 | 32 | - name: Setup pnpm |
c94835b4 | 33 | uses: pnpm/action-setup@v4 |
4c156521 | 34 | |
8ea47589 | 35 | - name: Setup Node.js ${{ matrix.node }} |
6c527d3f | 36 | uses: actions/setup-node@v4 |
ac0fc89e | 37 | with: |
5080f39d | 38 | node-version: ${{ matrix.node }} |
4c156521 | 39 | cache: 'pnpm' |
ac0fc89e | 40 | |
f1c674cd | 41 | - name: Install Dependencies |
c1a37d98 | 42 | run: pnpm install --ignore-scripts --frozen-lockfile |
ac0fc89e | 43 | |
a34ce9a0 | 44 | - name: Build |
4c156521 | 45 | run: pnpm build |
a34ce9a0 | 46 | |
73db65c0 | 47 | - name: Lint |
277c49bf | 48 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
4c156521 | 49 | run: pnpm lint |
73db65c0 | 50 | |
daa307e5 | 51 | - name: Tests |
4c156521 | 52 | run: pnpm test |
daa307e5 | 53 | |
c3d7c4f3 | 54 | - name: Coverage Report |
277c49bf | 55 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
4c156521 | 56 | run: pnpm coverage |
253f3064 | 57 | |
3f723961 JB |
58 | - name: Check for SonarCloud Token Availability |
59 | id: sonar-token | |
60 | shell: bash | |
61 | run: | | |
62 | if [ "${{ secrets.SONAR_TOKEN }}" != '' ]; then | |
63 | echo "available=true" >> $GITHUB_OUTPUT; | |
64 | else | |
65 | echo "available=false" >> $GITHUB_OUTPUT; | |
66 | fi | |
67 | ||
68 | - name: SonarCloud Code Analysis | |
277c49bf | 69 | if: ${{ steps.sonar-token.outputs.available == 'true' && github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
003ff992 | 70 | uses: sonarsource/sonarcloud-github-action@v2.2.0 |
515e5da7 | 71 | env: |
02fd4f2c | 72 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
515e5da7 | 73 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |