From 9aa0220b0b02bf3361735d0078225818fceece90 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 11 Jun 2022 18:24:51 -0400 Subject: [PATCH 1/8] Add an all job for the test matrix --- .github/workflows/test.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f347ac022b20..70ca74682cc3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -75,3 +75,16 @@ jobs: concurrency_name: windows configuration: ${{ needs.configure.outputs.configuration }} runs-on: windows-latest + + all: + name: All + runs-on: ubuntu-latest + needs: + - macos + - ubuntu + - windows + steps: + - name: This + shell: python + run: | + import this From 2a784fa6ca2fec513e272987e3ce483a68a3abd2 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 11 Jun 2022 20:19:04 -0400 Subject: [PATCH 2/8] Update test.yml --- .github/workflows/test.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70ca74682cc3..b5e41cc2bb51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,12 +79,16 @@ jobs: all: name: All runs-on: ubuntu-latest + if: always() needs: - macos - ubuntu - windows steps: - - name: This - shell: python - run: | - import this + - name: debug + env: + V: ${{ needs }} + run: echo "${V}" + - name: Fail the job if result is not success + if: ${{ needs.macos.result != 'success' or needs.ubuntu.result != 'success' or needs.windows.result != 'success' }} + run: exit 1 From b5ef387814ad15dc3db09b8b7a3807177a7e9516 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 11 Jun 2022 20:25:09 -0400 Subject: [PATCH 3/8] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5e41cc2bb51..7896544c5ccf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,5 +90,5 @@ jobs: V: ${{ needs }} run: echo "${V}" - name: Fail the job if result is not success - if: ${{ needs.macos.result != 'success' or needs.ubuntu.result != 'success' or needs.windows.result != 'success' }} + if: ${{ needs.macos.result != 'success' || needs.ubuntu.result != 'success' || needs.windows.result != 'success' }} run: exit 1 From 9a05d185f4a0bcded5cabf578c8b435a0fe591a1 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 11 Jun 2022 20:54:15 -0400 Subject: [PATCH 4/8] Update test.yml --- .github/workflows/test.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7896544c5ccf..a4593d237ebb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,10 +85,14 @@ jobs: - ubuntu - windows steps: - - name: debug + - name: Require all successes + shell: python env: - V: ${{ needs }} - run: echo "${V}" - - name: Fail the job if result is not success - if: ${{ needs.macos.result != 'success' || needs.ubuntu.result != 'success' || needs.windows.result != 'success' }} - run: exit 1 + RESULTS: ${{ toJSON(needs.*.result) }} + run: | + import json + import os + import sys + + results = json.loads(os.environ["RESULTS"]) + sys.exit(0 if all(result == "success" for result in results) else 1) From 4d4354158786c0ac740237be4ab514bd1750f4c1 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 8 Jul 2022 22:29:12 -0400 Subject: [PATCH 5/8] try it as a reusable workflow --- .github/workflows/all.yml | 26 ++++++++++++++++++++++++++ .github/workflows/test.yml | 18 +++--------------- 2 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/all.yml diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml new file mode 100644 index 000000000000..fa2093c8e406 --- /dev/null +++ b/.github/workflows/all.yml @@ -0,0 +1,26 @@ +name: all + +on: + workflow_call: + inputs: + needs: + required: true + type: string + +jobs: + all: + name: All + runs-on: ubuntu-latest + if: always() + steps: + - name: Require all successes + shell: python + env: + RESULTS: ${{ toJSON(fromJSON(inputs.needs).*.result) }} + run: | + import json + import os + import sys + + results = json.loads(os.environ["RESULTS"]) + sys.exit(0 if all(result == "success" for result in results) else 1) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4593d237ebb..4a52f4ba9907 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,22 +77,10 @@ jobs: runs-on: windows-latest all: - name: All - runs-on: ubuntu-latest - if: always() + uses: ./.github/workflows/all.yml needs: - macos - ubuntu - windows - steps: - - name: Require all successes - shell: python - env: - RESULTS: ${{ toJSON(needs.*.result) }} - run: | - import json - import os - import sys - - results = json.loads(os.environ["RESULTS"]) - sys.exit(0 if all(result == "success" for result in results) else 1) + with: + needs: ${{ toJSON(needs) }} From fe7dfb9d5316092a856c83d8ade1e76a0acf4bd4 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 9 Jul 2022 09:00:14 -0400 Subject: [PATCH 6/8] move the if: always() out --- .github/workflows/all.yml | 1 - .github/workflows/test.yml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index fa2093c8e406..e3a525450abd 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -11,7 +11,6 @@ jobs: all: name: All runs-on: ubuntu-latest - if: always() steps: - name: Require all successes shell: python diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a52f4ba9907..c00cec7240eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,6 +78,7 @@ jobs: all: uses: ./.github/workflows/all.yml + if: always() needs: - macos - ubuntu From 8dde40cf1d92ae428b0ec7019cab2586322799d3 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 9 Jul 2022 09:30:42 -0400 Subject: [PATCH 7/8] try not passing needs --- .github/workflows/all.yml | 6 +----- .github/workflows/test.yml | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index e3a525450abd..2ec314be0291 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -2,10 +2,6 @@ name: all on: workflow_call: - inputs: - needs: - required: true - type: string jobs: all: @@ -15,7 +11,7 @@ jobs: - name: Require all successes shell: python env: - RESULTS: ${{ toJSON(fromJSON(inputs.needs).*.result) }} + RESULTS: ${{ toJSON(needs.*.result) }} run: | import json import os diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c00cec7240eb..e30e3909921b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,5 +83,3 @@ jobs: - macos - ubuntu - windows - with: - needs: ${{ toJSON(needs) }} From 0daa165374cbba138177ff6c6adefad71238c5a3 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 9 Jul 2022 10:07:00 -0400 Subject: [PATCH 8/8] Revert "try not passing needs" This reverts commit 8dde40cf1d92ae428b0ec7019cab2586322799d3. --- .github/workflows/all.yml | 6 +++++- .github/workflows/test.yml | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 2ec314be0291..e3a525450abd 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -2,6 +2,10 @@ name: all on: workflow_call: + inputs: + needs: + required: true + type: string jobs: all: @@ -11,7 +15,7 @@ jobs: - name: Require all successes shell: python env: - RESULTS: ${{ toJSON(needs.*.result) }} + RESULTS: ${{ toJSON(fromJSON(inputs.needs).*.result) }} run: | import json import os diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e30e3909921b..c00cec7240eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,3 +83,5 @@ jobs: - macos - ubuntu - windows + with: + needs: ${{ toJSON(needs) }}