@e-square/nx-distributed-task

LATEST GitHub Workflow Status Codecov All Contributors MIT

Summary

Github Action that runs nx run-many for the specified target and projects.
This action was designed to consume the outputs of @e-square/nx-affected-matrix in order to distribute jobs with ease.

Check out the monorepo's README for a full usage example of both actions with GitHub Actions' matrix

Usage

Inputs

name description default required
target Target to run -
projects Comma-delimited list of projects to run against target -
maxParallel Maximum NX cli parallel runs 3
nxCloud Enable support of Nx Cloud false
uploadOutputs Upload target's outputs as workflow artifacts true
workingDirectory Path to the Nx workspace, needed if not the repository root -
args Space-delimited args to add to nx command execution -
jobs:
  execute:
    runs-on: ubuntu-latest
    name: Execute NX
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      # install node modules, cache etc

      - name: Run command
        uses: e-square-io/nx-distributed-task@v2
        with:
          target: 'test'
          projects: 'project1,project2'

Uploading outputs

In Github, when uploading multiple artifact under the same name, Github will keep adding the artifacts instead of overwriting them. This behavior allows us to upload all the outputs from all the distributed jobs under one "directory" so that in later jobs you can download that single "directory" and get all the outputs for that target. The name of the artifact will be the name of the target.