Skip to main content

Nx

Nx Example Workflow

A complete GitHub Actions workflow using DxCore with Nx.

⚠️ Experimental: Nx support is experimental. APIs and behavior may change without notice.

Full Example

This workflow runs build, test, and lint across 3 parallel agents in an Nx workspace.

name: CI with DxCore + Nx
on: [push, pull_request]
env:
DXCORE_URL: ${{ secrets.DXCORE_URL }}
DXCORE_TOKEN: ${{ secrets.DXCORE_TOKEN }}
jobs:
session:
runs-on: ubuntu-latest
outputs:
session_id: ${{ steps.create.outputs.session_id }}
steps:
- name: Create session
id: create
run: |
SESSION=$(dxcore ci create-session -c $DXCORE_URL -t $DXCORE_TOKEN)
echo "session_id=$SESSION" >> "$GITHUB_OUTPUT"
- name: Wait for coordinator
run: dxcore ci wait -c $DXCORE_URL --timeout 300
dispatch:
needs: session
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- name: Dispatch graph
run: |
nx run-many --targets=build,test --graph=stdout | \
dxcore dispatch \
-c $DXCORE_URL \
-s ${{ needs.session.outputs.session_id }} \
-t $DXCORE_TOKEN -b nx
agent:
needs: session
runs-on: ubuntu-latest
strategy:
matrix:
shard: [0, 1, 2]
steps:
- uses: actions/checkout@v4
- run: npm ci
- name: Run DxCore agent
run: |
dxcore agent \
-c $DXCORE_URL \
-a agent-${{ matrix.shard }} \
-s ${{ needs.session.outputs.session_id }} \
-t $DXCORE_TOKEN -b nx
finish:
needs: [session, dispatch, agent]
if: always()
runs-on: ubuntu-latest
steps:
- name: Finish session
run: |
dxcore ci finish \
-c $DXCORE_URL \
-s ${{ needs.session.outputs.session_id }} \
-t $DXCORE_TOKEN

Key Differences from Turborepo

  • Graph is produced with nx run-many --targets=build,test --graph=stdout instead of --dry=json
  • Agents execute tasks with npx nx run <project>:<target> instead of npx turbo run
  • No task hash or cache status information is available at plan time

Note

Nx’s computation caching and affected commands still work normally. DxCore parallelizes execution without interfering with Nx’s built-in optimizations.

Next Steps