|
| 1 | +name: Test Matrix |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - develop |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - develop |
| 10 | + - master |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + node-version: [18, 20, 22] |
| 17 | + operating-system: |
| 18 | + - ubuntu-latest |
| 19 | + - windows-latest |
| 20 | + # - macos-latest -> Rollup is not supported on ARM64 - https://github.com/npm/cli/issues/4828 |
| 21 | + runs-on: ${{ matrix.operating-system }} |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + - name: Setup Node |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version: ${{ matrix.node-version }} |
| 29 | + - name: Remove old install # Rollup bug workaround -> https://github.com/npm/cli/issues/4828 |
| 30 | + shell: pwsh |
| 31 | + run: | |
| 32 | + if (Test-Path "node_modules") { Remove-Item -Recurse -Force "node_modules" } |
| 33 | + if (Test-Path "package-lock.json") { Remove-Item -Force "package-lock.json" } |
| 34 | + - name: Restore node_modules cache |
| 35 | + uses: actions/cache@v3 |
| 36 | + with: |
| 37 | + path: node_modules |
| 38 | + key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }} |
| 39 | + restore-keys: | |
| 40 | + ${{ runner.os }}-node-${{ matrix.node-version }}- |
| 41 | + - name: Install dependencies |
| 42 | + run: npm install |
| 43 | + - name: Cache node_modules (post-install) |
| 44 | + uses: actions/cache@v3 |
| 45 | + with: |
| 46 | + path: node_modules |
| 47 | + key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }} |
| 48 | + - name: Build |
| 49 | + run: npm run build |
| 50 | + test: |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + node-version: [18, 20, 22] |
| 55 | + operating-system: [ubuntu-latest, windows-latest, macos-latest] |
| 56 | + runs-on: ${{ matrix.operating-system }} |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v4 |
| 60 | + - name: Setup Node |
| 61 | + uses: actions/setup-node@v4 |
| 62 | + with: |
| 63 | + node-version: ${{ matrix.node-version }} |
| 64 | + - name: Install and Cache Dependencies |
| 65 | + uses: ./.github/actions/cached-deps |
| 66 | + - name: Test |
| 67 | + run: npm run test |
| 68 | + |
| 69 | + check: |
| 70 | + needs: [build, test] |
| 71 | + runs-on: ubuntu-latest |
| 72 | + if: always() |
| 73 | + steps: |
| 74 | + - name: Check build matrix status |
| 75 | + if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') |
| 76 | + run: exit 1 |
| 77 | + - name: All jobs succeeded |
| 78 | + if: contains(needs.*.result, 'failure') != true && contains(needs.*.result, 'cancelled') != true |
| 79 | + run: echo "All jobs completed successfully!" |
0 commit comments