chore: test agents 1 #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Agents | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| NX_NON_NATIVE_HASHER: true | |
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
| jobs: | |
| # Main CI job that orchestrates and executes all tasks with Nx Agents | |
| main: | |
| runs-on: ubuntu-latest | |
| name: CI with Nx Agents | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| - name: Set base and head for Nx affected commands | |
| uses: nrwl/nx-set-shas@v4 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Start Nx Cloud CI run with agents | |
| run: ./node_modules/.bin/nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build" | |
| # Run all CI tasks with Nx Cloud distribution | |
| - name: Run CI tasks | |
| run: npx nx affected -t format:check lint unit-test int-test e2e-test build --configuration=ci | |
| # Test-release packages | |
| - name: Test-release packages | |
| run: npx pkg-pr-new publish "packages/**/dist" | |
| # Nx Cloud Agents for distributed task execution | |
| agents: | |
| runs-on: ubuntu-latest | |
| name: Nx Cloud Agent | |
| timeout-minutes: 60 | |
| strategy: | |
| matrix: | |
| agent: [1, 2, 3] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Start Nx Cloud Agent ${{ matrix.agent }} | |
| run: ./node_modules/.bin/nx-cloud start-agent --with-deps | |
| # Optional: Stop agent after completion | |
| - name: Stop Nx Cloud Agent ${{ matrix.agent }} | |
| if: always() | |
| run: ./node_modules/.bin/nx-cloud stop-agent | |
| continue-on-error: true |