diff --git a/.github/actions/workflow-run-job-linux/action.yml b/.github/actions/workflow-run-job-linux/action.yml index 91b67b3ff6e..68b0395095c 100644 --- a/.github/actions/workflow-run-job-linux/action.yml +++ b/.github/actions/workflow-run-job-linux/action.yml @@ -15,6 +15,8 @@ inputs: runs: using: "composite" steps: + # TODO We currently require a checkout to the default path before invoking this action. + # Clean this up so we only do a single checkout. - name: Checkout repo uses: actions/checkout@v3 with: diff --git a/.github/workflows/ci-workflow-pull-request.yml b/.github/workflows/ci-workflow-pull-request.yml index 663b2f726d5..ea93e4b8a69 100644 --- a/.github/workflows/ci-workflow-pull-request.yml +++ b/.github/workflows/ci-workflow-pull-request.yml @@ -60,22 +60,27 @@ jobs: ${{ env.pr_worflow }} ${{ env.nightly_workflow }} - run-workflow: - name: Run workflow + dispatch-groups-linux-two-stage: + name: ${{ matrix.name }} needs: build-workflow permissions: id-token: write contents: read - uses: ./.github/workflows/workflow-dispatch.yml + strategy: + fail-fast: false + matrix: + name: ${{ fromJSON(needs.build-workflow.outputs.workflow)['linux_two_stage']['keys'] }} + uses: ./.github/workflows/workflow-dispatch-two-stage-group-linux.yml with: - workflow: ${{ needs.build-workflow.outputs.workflow }} + name: ${{ matrix.name }} + pc-array: ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow)['linux_two_stage']['jobs'][matrix.name]) }} verify-workflow: name: Verify and summarize workflow results if: ${{ always() && !cancelled() }} needs: - build-workflow - - run-workflow + - dispatch-groups-linux-two-stage permissions: contents: read pull-requests: write # Posts a comment back to the PR. diff --git a/.github/workflows/workflow-dispatch-job-array-linux.yml b/.github/workflows/workflow-dispatch-job-array-linux.yml deleted file mode 100644 index 6851a789420..00000000000 --- a/.github/workflows/workflow-dispatch-job-array-linux.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: "Workflow/Dispatch/Job/Array/Linux" - -# 'job-single' and 'job-array' are split and have redundent implementations for two reasons: -# 1. GHA doesn't aggregate success results from a matrix dispatch job. -# - single-job is used when a job has dependencies, eg. producers. -# - array-job can be used for arrays of standalone and consumer jobs. -# 2. GHA limits the number of nested workflows severely. -# - Reimplementing the job logic in `job-array` instead of reusing `job-single` helps keep the -# number of nested workflows low. -# -# To reduce the amount of code duplication, the `job-single` and `job-array` workflows are implemented -# using the same action. Only the runner/container config is duplicated. - -defaults: - run: - shell: bash --noprofile --norc -euo pipefail {0} - -on: - workflow_call: - inputs: - jobs: - description: "Array of dispatch job objects as a JSON string." - type: string - required: true - -permissions: - contents: read - -jobs: - run: - name: ${{matrix.name}} - strategy: - fail-fast: false - matrix: - include: ${{fromJSON(inputs.jobs)}} - permissions: - id-token: write - contents: read - runs-on: ${{matrix.runner}} - container: - options: -u root - image: ${{matrix.image}} - env: - NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} - steps: - - name: Run job - uses: ./.github/actions/workflow-run-job-linux.yml - with: - id: ${{matrix.id}} - command: ${{matrix.command}} - image: ${{matrix.image}} diff --git a/.github/workflows/workflow-dispatch-job-single-linux.yml b/.github/workflows/workflow-dispatch-job-single-linux.yml deleted file mode 100644 index e9074de2159..00000000000 --- a/.github/workflows/workflow-dispatch-job-single-linux.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: "Workflow/Dispatch/Job/Single/Linux" - -# 'job-single' and 'job-array' are split and have redundent implementations for two reasons: -# 1. GHA doesn't aggregate success results from a matrix dispatch job. -# - single-job is used when a job has dependencies, eg. producers. -# - array-job can be used for arrays of standalone and consumer jobs. -# 2. GHA limits the number of nested workflows severely. -# - Reimplementing the job logic in `job-array` instead of reusing `job-single` helps keep the -# number of nested workflows low. -# -# To reduce the amount of code duplication, the `job-single` and `job-array` workflows are implemented -# using the same action. Only the runner/container config is duplicated. - -defaults: - run: - shell: bash --noprofile --norc -euo pipefail {0} - -on: - workflow_call: - inputs: - name: {type: string, required: true} - image: {type: string, required: true} - runner: {type: string, required: true} - command: {type: string, required: true} - id: {type: string, required: true} - env: {type: string, required: false} - -permissions: - contents: read - -jobs: - run: - name: ${{inputs.name}} - permissions: - id-token: write - contents: read - runs-on: ${{inputs.runner}} - container: - options: -u root - image: ${{inputs.image}} - env: - NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} - steps: - - name: Run job - uses: ./.github/actions/workflow-run-job-linux.yml - with: - id: ${{inputs.id}} - command: ${{inputs.command}} - image: ${{inputs.image}} diff --git a/.github/workflows/workflow-dispatch-two-stage-linux.yml b/.github/workflows/workflow-dispatch-two-stage-linux.yml index 8b16f52c33b..af1d53dd30a 100644 --- a/.github/workflows/workflow-dispatch-two-stage-linux.yml +++ b/.github/workflows/workflow-dispatch-two-stage-linux.yml @@ -35,8 +35,12 @@ jobs: env: NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + persist-credentials: false - name: Run job - uses: ./.github/actions/workflow-run-job-linux.yml + uses: ./.github/actions/workflow-run-job-linux with: id: ${{ fromJSON(inputs.producers)[0].id }} command: ${{ fromJSON(inputs.producers)[0].command }} @@ -62,8 +66,12 @@ jobs: env: NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + persist-credentials: false - name: Run job - uses: ./.github/actions/workflow-run-job-linux.yml + uses: ./.github/actions/workflow-run-job-linux with: id: ${{ matrix.id }} command: ${{ matrix.command }} diff --git a/.github/workflows/workflow-dispatch.yml b/.github/workflows/workflow-dispatch.yml index 6f574931e64..6c0cf4e0b8d 100644 --- a/.github/workflows/workflow-dispatch.yml +++ b/.github/workflows/workflow-dispatch.yml @@ -12,29 +12,3 @@ on: required: true jobs: - dispatch-groups-linux-two-stage: - if: ${{ fromJSON(inputs.workflow)['linux_two_stage']['keys'] }} - name: ${{ matrix.name }} - permissions: - id-token: write - contents: read - strategy: - fail-fast: false - matrix: - include: ${{ fromJSON(inputs.workflow)['linux_two_stage']['keys'] }} - uses: ./.github/workflows/workflow-dispatch-two-stage-group-linux.yml - with: - name: ${{ matrix.name }} - pc-array: ${{ toJSON(fromJSON(inputs.workflow)['linux_two_stage']['jobs'][matrix.name]) }} - - debug-workflow: - name: "Debug workflow-dispatch.yml" - runs-on: ubuntu-latest - steps: - - name: Debug - run: | - echo "Debugging workflow:" - echo "Workflow:\n ${{inputs.workflow }}\n\n" - # echo "Linux Two Stage:\n${{ fromJSON(inputs.workflow)['linux_two_stage'] }}\n\n" - # echo "Keys:\n${{ fromJSON(inputs.workflow)['linux_two_stage']['keys'] }}\n\n" - # echo "Jobs:\n${{ fromJSON(inputs.workflow)['linux_two_stage']['jobs'] }}\n\n"