Skip to content

Commit

Permalink
fix(ci): correct fail/success calculations (QwikDev#6707)
Browse files Browse the repository at this point in the history
github actions are kinda odd
  • Loading branch information
wmertens authored Jul 19, 2024
1 parent 314cc9a commit b0802ca
Showing 1 changed file with 48 additions and 32 deletions.
80 changes: 48 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -405,14 +414,18 @@ 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
- build-other-packages
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

Expand Down Expand Up @@ -454,14 +467,18 @@ 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
- build-other-packages
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

Expand Down Expand Up @@ -542,21 +559,21 @@ 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:
- changes
- 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

Expand Down Expand Up @@ -726,6 +743,7 @@ jobs:
name: All requirements are met
runs-on: ubuntu-latest
needs:
- test-unit
- test-e2e
- validate-rust
- lint-package
Expand All @@ -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')
)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b0802ca

Please sign in to comment.