| 1 | name: CLI PR Checks |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | branches: [main] |
| 6 | |
| 7 | permissions: |
| 8 | contents: read |
| 9 | pull-requests: write |
| 10 | issues: write |
| 11 | |
| 12 | jobs: |
| 13 | track-rerun: |
| 14 | runs-on: ubuntu-latest |
| 15 | if: github.run_attempt > 1 |
| 16 | steps: |
| 17 | - uses: actions/checkout@v5 |
| 18 | - name: Track workflow rerun |
| 19 | uses: ./.github/actions/track-rerun |
| 20 | |
| 21 | lint: |
| 22 | runs-on: ubuntu-latest |
| 23 | steps: |
| 24 | - name: Checkout code |
| 25 | uses: actions/checkout@v5 |
| 26 | |
| 27 | - name: Setup Node.js |
| 28 | uses: actions/setup-node@v5 |
| 29 | with: |
| 30 | node-version: 20 |
| 31 | cache: "npm" |
| 32 | cache-dependency-path: extensions/cli/package-lock.json |
| 33 | |
| 34 | - name: Setup packages |
| 35 | uses: ./.github/actions/setup-packages |
| 36 | - name: Setup core component |
| 37 | uses: ./.github/actions/setup-component |
| 38 | with: |
| 39 | component: core |
| 40 | include-root: true |
| 41 | |
| 42 | - name: Build core |
| 43 | run: | |
| 44 | cd core |
| 45 | npm run build |
| 46 | |
| 47 | - name: Install dependencies |
| 48 | run: | |
| 49 | cd extensions/cli |
| 50 | npm ci --include=optional |
| 51 | |
| 52 | - name: Run linting |
| 53 | run: | |
| 54 | cd extensions/cli |
| 55 | npm run lint |
| 56 | |
| 57 | test: |
| 58 | strategy: |
| 59 | matrix: |
| 60 | os: [ubuntu-latest, windows-latest, macos-latest] |
| 61 | node-version: [18, 20, 22, 24] |
| 62 | fail-fast: false |
| 63 | runs-on: ${{ matrix.os }} |
| 64 | |
| 65 | steps: |
| 66 | - name: Checkout code |
| 67 | uses: actions/checkout@v5 |
| 68 | |
| 69 | - name: Setup Node.js ${{ matrix.node-version }} |
| 70 | uses: actions/setup-node@v5 |
| 71 | with: |
| 72 | node-version: ${{ matrix.node-version }} |
| 73 | |
| 74 | - name: Cache CLI node_modules |
| 75 | uses: actions/cache@v4 |
| 76 | with: |
| 77 | path: extensions/cli/node_modules |
| 78 | key: ${{ runner.os }}-node${{ matrix.node-version }}-cli-modules-${{ hashFiles('extensions/cli/package-lock.json') }} |
| 79 | restore-keys: | |
| 80 | ${{ runner.os }}-node${{ matrix.node-version }}-cli-modules- |
| 81 | |
| 82 | - name: Setup packages |
| 83 | uses: ./.github/actions/setup-packages |
| 84 | - name: Setup core component |
| 85 | uses: ./.github/actions/setup-component |
| 86 | with: |
| 87 | component: core |
| 88 | include-root: true |
| 89 | |
| 90 | - name: Build core |
| 91 | run: | |
| 92 | cd core |
| 93 | npm run build |
| 94 | |
| 95 | - name: Install dependencies |
| 96 | run: | |
| 97 | cd extensions/cli |
| 98 | npm ci --include=optional |
| 99 | |
| 100 | - name: Build |
| 101 | run: | |
| 102 | cd extensions/cli |
| 103 | npm run build |
| 104 | |
| 105 | - name: Run smoke tests |
| 106 | run: | |
| 107 | cd extensions/cli |
| 108 | npm run test:smoke |
| 109 | |
| 110 | - name: Run tests |
| 111 | run: | |
| 112 | cd extensions/cli |
| 113 | npm test |
| 114 | |
| 115 | # e2e tests are failing on Windows specifically - likely due to stdout flush issues |
| 116 | - name: Run e2e tests |
| 117 | if: matrix.os != 'windows-latest' |
| 118 | run: | |
| 119 | cd extensions/cli |
| 120 | npm run test:e2e |
| 121 | |
| 122 | # GitHub does not have a way of requiring that all checks pass (you must manually select each job) |
| 123 | # This action at least lets us manage the list of required tests via source control |
| 124 | # so that creators of new jobs can add them to this list |
| 125 | require-all-checks-to-pass-cli: |
| 126 | if: always() |
| 127 | runs-on: ubuntu-latest |
| 128 | needs: |
| 129 | - lint |
| 130 | - test |
| 131 | |
| 132 | steps: |
| 133 | - name: Decide whether the needed jobs succeeded or failed |
| 134 | uses: re-actors/alls-green@release/v1 |
| 135 | with: |
| 136 | jobs: ${{ toJSON(needs) }} |