|
1 | 1 | name: JavaScript Client - CI |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + paths-ignore: |
| 7 | + - '**.md' # Skip CI when only docs/readmes change |
| 8 | + pull_request: |
| 9 | + branches: [ "master" ] |
| 10 | + |
| 11 | +# Cancel in-progress CI runs if new commits are pushed to the same PR/branch |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
4 | 18 |
|
5 | 19 | jobs: |
6 | 20 | build: |
7 | | - |
8 | 21 | runs-on: ubuntu-latest |
9 | | - |
| 22 | + |
10 | 23 | strategy: |
| 24 | + fail-fast: false # Prevents all versions from cancelling if just one fails |
11 | 25 | matrix: |
12 | | - node-version: [18.x, 20.x, 22.x] |
| 26 | + node-version: [18.x, 20.x, 22.x, 24.x] |
13 | 27 |
|
14 | 28 | steps: |
15 | | - - uses: actions/checkout@v3 |
16 | | - - name: Use Node.js ${{ matrix.node-version }} |
17 | | - uses: actions/setup-node@v3 |
18 | | - with: |
19 | | - node-version: ${{ matrix.node-version }} |
20 | | - - name: npm install, build, and test |
21 | | - run: | |
22 | | - npm ci |
23 | | - npm run build --if-present |
24 | | - npm test |
25 | | - ls -la dist/ |
26 | | - env: |
27 | | - CI: true |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Setup Node.js ${{ matrix.node-version }} |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: ${{ matrix.node-version }} |
| 36 | + cache: 'npm' # ⚡️ Speeds up `npm ci` by caching ~/.npm across runs |
| 37 | + |
| 38 | + # ── Install ───────────────────────────────────────────────────────────── |
| 39 | + - name: Install dependencies |
| 40 | + run: npm ci |
| 41 | + |
| 42 | + # ── Lint & Verify ─────────────────────────────────────────────────────── |
| 43 | + # We only need to lint and check outdated dependencies on ONE Node version |
| 44 | + # to save duplicate work and runner minutes. Node 24 is the current LTS. |
| 45 | + - name: Lint typecheck |
| 46 | + if: matrix.node-version == '24.x' |
| 47 | + run: npm run lint:typecheck |
| 48 | + |
| 49 | + - name: Check outdated dependencies |
| 50 | + if: matrix.node-version == '24.x' |
| 51 | + run: npm outdated || true |
| 52 | + |
| 53 | + # ── Test & Build (Runs on all Node versions) ──────────────────────────── |
| 54 | + - name: Run tests |
| 55 | + run: npm run test |
| 56 | + |
| 57 | + - name: Build distribution |
| 58 | + run: npm run build --if-present |
| 59 | + |
| 60 | + - name: Verify build artifacts |
| 61 | + run: ls -la dist/ |
0 commit comments