-
Notifications
You must be signed in to change notification settings - Fork 7
NX Actions v3 (WIP)Β #18
Description
Background
Nx has released their own distributed tasks execution feature for NX Cloud.
Supporting this feature will make nx-affected-matrix way of usage a bit weird (and the action name is a bit unrelated) and it will also require changing some of the inputs of nx-distributed-task.
Therefore, instead of changing the existing actions, 2 new actions will be created: nx-orchestrator and nx-executor.
Specification
nx-affected-matrix & nx-distributed-task:
- will be marked deprecated
- will continue to receive fixes and features that don't introduce breaking changes
- docs will be updated to refer to a migration guide to the new action
nx-orchestrator:
Inputs
targets - comma-separated list of targets to run
projects - all | affected | comma-separated list of projects to run per target, default is affected
nx-cloud - boolean, if true will use nxCloud with DTE feature
cwd - in case the nx repo is not in the workspace's root
args - space-separated list of args that will be passed to nx
debug - boolean, debug mode
nx-executor:
Inputs
data - the outputted matrix from nx-orchestrator, required if not running with nx-cloud
artifacts - boolean, if true will upload all the artifacts per target
nx-cloud - boolean, if true will use nxCloud with DTE feature
cwd - in case the nx repo is not in the workspace's root
args - space-separated list of args that will be passed to nx
debug - boolean, debug mode
Usage
With GH Actions matrix
jobs:
setup:
name: Calculate Affected
...
outputs:
hasChanges: ${{ steps.affected.outputs.hasChanges }}
matrix: ${{ steps.affected.outputs.matrix }}
steps:
... # checkout, setup node, npm ci
- uses: @e-square/nx-orchestrator
id: affected
with:
targets: 'lint,test,build'
distributed-tasks:
name: ${{ matrix.target }} (${{ matrix.distribution }})
needs: [setup]
...
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
steps:
... # checkout, setup node, npm ci
- uses: @e-square/nx-executor
with:
data: ${{ toJSON(matrix) }}
artifacts: trueWith NX Cloud and DTE (reference):
jobs:
main:
name: Lint Test Build
...
steps:
... # checkout, setup node, npm ci
- uses: @e-square/nx-orchestrator
with:
targets: 'lint,test,build'
nx-cloud: true
agents:
name: NX Agent
...
strategy:
matrix:
agent: [1, 2, 3, 4]
steps:
... # checkout, setup node, npm ci
- uses: @e-square/nx-executor
with:
nx-cloud: trueTasks:
- [ ]