Skip to content

Commit

Permalink
ci: disable custom Nx agent
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Jun 27, 2024
1 parent d881612 commit 90fc5b6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ jobs:
with:
fetch-depth: 0

# TODO: ensure vars are shared with agents --with-env-vars="auto"

# --require-explicit-completion because Nx agents might not receive tasks for more than 30 seconds when preparing the e2e test environment
# @see https://nx.dev/ci/troubleshooting/ci-execution-failed#the-nx-cloud-heartbeat-process-failed-to-report-its-status-in-time
- run: npx nx-cloud start-ci-run --distribute-on="3 custom-linux-small-js" --stop-agents-after="e2e-ci" --require-explicit-completion --with-env-vars="DOTENV_PRIVATE_KEY_CI,POSTGRES_DB,POSTGRES_URL"
- run: npx nx-cloud start-ci-run --distribute-on="3 linux-small-js" --stop-agents-after="e2e-ci" --require-explicit-completion --with-env-vars="DOTENV_PRIVATE_KEY_CI,POSTGRES_DB,POSTGRES_URL"
if: ${{ env.NX_CLOUD_DISTRIBUTED_EXECUTION == 'true' }}

- uses: actions/setup-node@v4
Expand All @@ -59,22 +57,33 @@ jobs:
- run: npx nx affected -t lint test build
if: ${{ !env.ACT }}

# # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: npx nx-cloud record -- docker ps
# - run: npx nx-cloud record -- docker compose -p cat-fostering logs keto -n 500
# - run: npx nx-cloud record -- docker compose -p cat-fostering logs kratos -n 500
- run: |
npm run ory:generate:kratos -- -e .env.ci
npm run ory:generate:keto -- -e .env.ci
- run: npx nx run cat-fostering-api:docker-build --no-agents

# can't use --wait --wait-timeout N options since Keto and Kratos migrate containers will exit before the Keto and Kratos services are ready
- run: npx @dotenvx/dotenvx run -- docker compose --profile ci -p cat-fostering up -d

- run: sleep 10

# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
- run: npx nx-cloud record -- docker ps
- run: npx nx-cloud record -- docker compose -p cat-fostering logs keto -n 500
- run: npx nx-cloud record -- docker compose -p cat-fostering logs kratos -n 500

- name: Run e2e tests
run: npx nx affected -t e2e --no-agents
if: ${{ env.NX_CLOUD_DISTRIBUTED_EXECUTION == 'false' }}
# if: ${{ env.NX_CLOUD_DISTRIBUTED_EXECUTION == 'false' }}

# to enable DTE for e2e tests splitting, use the following command instead and set stop-agents-after="e2e-ci"
- name: Run distributed e2e tests
run: |
npm run pg:create:connection -- -e .env.ci
docker compose -p cat-fostering restart api
npx nx affected -t e2e-ci
if: ${{ env.NX_CLOUD_DISTRIBUTED_EXECUTION == 'true' }}
# - name: Run distributed e2e tests
# run: |
# npm run pg:create:connection -- -e .env.ci
# docker compose -p cat-fostering restart api
# npx nx affected -t e2e-ci
# if: ${{ env.NX_CLOUD_DISTRIBUTED_EXECUTION == 'true' }}

- run: npx nx-cloud complete-ci-run
if: always() && ${{ env.NX_CLOUD_DISTRIBUTED_EXECUTION == 'true' }}
2 changes: 2 additions & 0 deletions .nx/workflows/agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ launch-templates:
- name: Build Docker Image
script: npx nx run cat-fostering-api:docker-build --no-agents

# !BLOCKER: it is not possible to install Docker in Nx agents at the moment, see https://github.com/nrwl/nx-cloud-workflows/issues/52

# can't use --wait --wait-timeout N options since Keto and Kratos migrate containers will exit before the Keto and Kratos services are ready
- name: Start Docker Compose
script: npx @dotenvx/dotenvx run -- docker compose --profile ci -p cat-fostering up -d
Expand Down

0 comments on commit 90fc5b6

Please sign in to comment.