@e-square/nx-distributed-task

June 18, 2023 · View on GitHub

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

namedescriptiondefaultrequired
targetTarget to run-
projectsComma-delimited list of projects to run against target-
maxParallelMaximum NX cli parallel runs3
nxCloudEnable support of Nx Cloudfalse
uploadOutputsUpload target's outputs as workflow artifactstrue
workingDirectoryPath to the Nx workspace, needed if not the repository root-
argsSpace-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.