diff --git a/.github/actions/workflow-build/action.yml b/.github/actions/workflow-build/action.yml index 41f761e506d..38c8bfb1ba4 100644 --- a/.github/actions/workflow-build/action.yml +++ b/.github/actions/workflow-build/action.yml @@ -33,7 +33,7 @@ inputs: outputs: workflow: description: "The dispatchable workflows" - value: ${{ steps.outputs.outputs.WORKFLOW }} + value: ${{ toJSON(steps.outputs.outputs.WORKFLOW) }} runs: using: "composite" diff --git a/.github/workflows/ci-workflow-pull-request.yml b/.github/workflows/ci-workflow-pull-request.yml index 663b2f726d5..d5f9626111c 100644 --- a/.github/workflows/ci-workflow-pull-request.yml +++ b/.github/workflows/ci-workflow-pull-request.yml @@ -60,22 +60,77 @@ jobs: ${{ env.pr_worflow }} ${{ env.nightly_workflow }} - run-workflow: - name: Run workflow + dispatch-groups-linux-two-stage: + name: ${{ matrix.name }} needs: build-workflow + if: toJSON(fromJSON(needs.build-workflow.outputs.workflow).linux_two_stage.keys) != '[]' 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]) }} + + debug-workflow: + name: "Debug workflow" + needs: build-workflow + env: + WORKFLOW_RAW: ${{ needs.build-workflow.outputs.workflow }} + WORKFLOW: ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow)) }} + TWO_STAGE: ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow)['linux_two_stage']) }} + KEYS: ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow).linux_two_stage.keys) }} + JOBS: ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow).linux_two_stage.jobs) }} + runs-on: ubuntu-latest + steps: + - name: Debug + if: ${{ fromJSON(needs.build-workflow.outputs.workflow) }} + shell: bash --noprofile --norc -u {0} + run: | + echo "Workflow Raw -> jq:" + echo "$WORKFLOW_RAW" | jq . + echo + echo "Workflow Raw -> jq:" + echo "$WORKFLOW_RAW" | jq . + echo + echo "Workflow Parsed:" + echo "${WORKFLOW}" + echo + echo "Workflow Parsed -> jq:" + echo "$WORKFLOW" | jq . + echo + echo "Two Stage:" + printf "%s\n" "${TWO_STAGE}" + echo + echo "Keys:" + printf "%s\n" "${KEYS}" + echo + echo "Jobs:" + printf "%s\n" "${JOBS}" + echo + + + + # run-workflow: + # name: Run workflow + # needs: build-workflow + # permissions: + # id-token: write + # contents: read + # uses: ./.github/workflows/workflow-dispatch.yml + # with: + # workflow: ${{ needs.build-workflow.outputs.workflow }} 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.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"