From b0802ca6dc448a82454dfba6b46f7392e0401c05 Mon Sep 17 00:00:00 2001 From: Wout Mertens Date: Fri, 19 Jul 2024 09:58:23 +0200 Subject: [PATCH] fix(ci): correct fail/success calculations (#6707) github actions are kinda odd --- .github/workflows/ci.yml | 80 ++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8583c0e672b..c4e555914d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -249,11 +249,7 @@ jobs: ############ BUILD PACKAGE ############ combined-qwik: name: Bundle Qwik - if: | - always() && - (needs.build-qwik.result == 'success' || needs.build-qwik.result == 'skipped') && - (needs.build-linux-wasm-bindings.result == 'success' || needs.build-linux-wasm-bindings.result == 'skipped') && - (needs.build-other-bindings.result == 'success' || needs.build-other-bindings.result == 'skipped') + if: always() runs-on: ubuntu-latest needs: - build-qwik @@ -262,6 +258,15 @@ jobs: - changes steps: + - name: Verify builds + if: | + !( + (needs.build-qwik.result == 'success' || needs.build-qwik.result == 'skipped') && + (needs.build-linux-wasm-bindings.result == 'success' || needs.build-linux-wasm-bindings.result == 'skipped') && + (needs.build-other-bindings.result == 'success' || needs.build-other-bindings.result == 'skipped') + ) + run: exit 1 + - name: Restore artifacts uses: actions/download-artifact@v4 @@ -302,9 +307,13 @@ jobs: needs: - changes - combined-qwik - if: always() && needs.combined-qwik.result == 'success' + if: always() runs-on: ubuntu-latest steps: + - name: Verify combined-qwik + if: needs.combined-qwik.result != 'success' + run: exit 1 + - name: Checkout if: needs.changes.outputs.build-others == 'true' uses: actions/checkout@v4 @@ -405,7 +414,7 @@ jobs: ############ BUILD INSIGHTS ############ build-insights: - if: always() && needs.changes.outputs.build-insights == 'true' && needs.build-other-packages.result == 'success' + if: always() && needs.changes.outputs.build-insights == 'true' name: Build Insights needs: - changes @@ -413,6 +422,10 @@ jobs: runs-on: ubuntu-latest steps: + - name: Verify build-other-packages + if: needs.build-other-packages.result != 'success' + run: exit 1 + - name: Checkout uses: actions/checkout@v4 @@ -454,7 +467,7 @@ jobs: ############ BUILD DOCS ############ build-docs: - if: always() && needs.changes.outputs.build-docs == 'true' && needs.build-other-packages.result == 'success' + if: always() && needs.changes.outputs.build-docs == 'true' name: Build Docs needs: - changes @@ -462,6 +475,10 @@ jobs: runs-on: ubuntu-latest steps: + - name: Verify build-other-packages + if: needs.build-other-packages.result != 'success' + run: exit 1 + - name: Checkout uses: actions/checkout@v4 @@ -542,14 +559,10 @@ jobs: name: Unit Tests if: | always() && ( - github.ref == 'refs/heads/main' || ( - ( - needs.changes.outputs.build-qwik == 'true' || - needs.changes.outputs.build-others == 'true' || - needs.changes.outputs.build-rust == 'true' - ) && - needs.build-other-packages.result == 'success' - ) + github.ref == 'refs/heads/main' || + needs.changes.outputs.build-qwik == 'true' || + needs.changes.outputs.build-others == 'true' || + needs.changes.outputs.build-rust == 'true' ) runs-on: ubuntu-latest needs: @@ -557,6 +570,10 @@ jobs: - build-other-packages steps: + - name: Verify build-other-packages + if: needs.build-other-packages.result != 'success' + run: exit 1 + - name: Checkout uses: actions/checkout@v4 @@ -726,6 +743,7 @@ jobs: name: All requirements are met runs-on: ubuntu-latest needs: + - test-unit - test-e2e - validate-rust - lint-package @@ -736,9 +754,10 @@ jobs: - name: check status if: | !( - (needs.lint-package.result == 'success' || needs.lint-package.result == 'skipped') && + (needs.test-unit.result == 'success' || needs.test-unit.result == 'skipped') && (needs.test-e2e.result == 'success' || needs.test-e2e.result == 'skipped') && (needs.validate-rust.result == 'success' || needs.validate-rust.result == 'skipped') && + (needs.lint-package.result == 'success' || needs.lint-package.result == 'skipped') && (needs.build-docs.result == 'success' || needs.build-docs.result == 'skipped') && (needs.build-insights.result == 'success' || needs.build-insights.result == 'skipped') ) @@ -750,20 +769,21 @@ jobs: runs-on: ubuntu-latest needs: - - test-e2e - changes - # Either one of the packages changed or we need to merge changesets + - test-unit + - test-e2e + # test-unit runs when any packages changes if: | always() && ( github.ref == 'refs/heads/main' || - ((needs.changes.outputs.build-qwik == 'true' || - needs.changes.outputs.build-others == 'true' || - needs.changes.outputs.build-rust == 'true') && - needs.test-e2e.result == 'success' - ) + needs.test-unit.result == 'success' ) steps: + - name: Verify test-e2e + if: needs.test-e2e.result != 'success' + run: exit 1 + - name: Checkout uses: actions/checkout@v4 @@ -862,14 +882,10 @@ jobs: - release if: | - always() && - ( - needs.changes.outputs.build-qwik == 'true' || - needs.changes.outputs.build-rust == 'true' || - needs.changes.outputs.build-others == 'true' - ) && - needs.release.result == 'success' && - github.ref_name == 'main' + always() && ( + github.ref == 'refs/heads/main' || + needs.release.result == 'success' + ) steps: - name: Repository Dispatch