Skip to content

Commit

Permalink
pathogen-repo-ci: Keep running even if one of the pathogen workflows …
Browse files Browse the repository at this point in the history
…fails

In testing it's helpful to report all test results even in the face of
an early failure to reduce the chances of playing whack-a-mole with
unreported failures once when you fix the first failure.  For example,
we want to know if the phylogenetic workflow fails even when the ingest
workflow run before it fails.
  • Loading branch information
tsibley committed Jun 14, 2024
1 parent d46b0d6 commit a54bf16
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/pathogen-repo-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,18 @@ jobs:
if: hashFiles('ingest/Snakefile') && hashFiles('ingest/build-configs/ci/config.yaml')
id: ingest
run: nextstrain build ingest --configfile build-configs/ci/config.yaml
continue-on-error: true
- name: Run phylogenetic
if: hashFiles('phylogenetic/Snakefile') && hashFiles('phylogenetic/build-configs/ci/config.yaml')
id: phylogenetic
run: nextstrain build phylogenetic --configfile build-configs/ci/config.yaml
continue-on-error: true
- name: Run nextclade
if: hashFiles('nextclade/Snakefile') && hashFiles('nextclade/build-configs/ci/config.yaml')
id: nextclade
run: nextstrain build nextclade --configfile build-configs/ci/config.yaml
- if: always()
uses: actions/upload-artifact@v4
continue-on-error: true
- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}-${{ matrix.runtime }}
if-no-files-found: ignore
Expand All @@ -320,18 +322,25 @@ jobs:
nextclade/results/
- name: Verify a workflow ran
env:
ingest: ${{ steps.ingest.conclusion }}
phylogenetic: ${{ steps.phylogenetic.conclusion }}
nextclade: ${{ steps.nextclade.conclusion }}
# "outcome" is success/failure/cancelled/skipped _before_
# "continue-on-error" is applied to calculate "conclusion"
ingest: ${{ steps.ingest.outcome }}
phylogenetic: ${{ steps.phylogenetic.outcome }}
nextclade: ${{ steps.nextclade.outcome }}
run: |
# Show step conclusions in job logs…
# Show step outcomes in job logs…
echo "ingest $ingest"
echo "phylogenetic $phylogenetic"
echo "nextclade $nextclade"
# …and also in the workflow summary.
"$NEXTSTRAIN_GITHUB_DIR"/bin/interpolate-env < "$NEXTSTRAIN_GITHUB_DIR"/text-templates/pathogen-repo-ci.md > "$GITHUB_STEP_SUMMARY"
# Assert status; if we see at least one attempt, regardless of
# success/failure, we're good.
[[ $ingest != skipped || $phylogenetic != skipped || $nextclade != skipped ]]
# Assert status; we're good if we see at least one success and the
# rest are success or skipped.
[[
($ingest == success || $phylogenetic == success || $nextclade == success)
&& ($ingest == success || $ingest == skipped)
&& ($phylogenetic == success || $phylogenetic == skipped)
&& ($nextclade == success || $nextclade == skipped)
]]
27 changes: 18 additions & 9 deletions .github/workflows/pathogen-repo-ci.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,21 @@ jobs:
if: hashFiles('ingest/Snakefile') && hashFiles('ingest/build-configs/ci/config.yaml')
id: ingest
run: nextstrain build ingest --configfile build-configs/ci/config.yaml
continue-on-error: true

- name: Run phylogenetic
if: hashFiles('phylogenetic/Snakefile') && hashFiles('phylogenetic/build-configs/ci/config.yaml')
id: phylogenetic
run: nextstrain build phylogenetic --configfile build-configs/ci/config.yaml
continue-on-error: true

- name: Run nextclade
if: hashFiles('nextclade/Snakefile') && hashFiles('nextclade/build-configs/ci/config.yaml')
id: nextclade
run: nextstrain build nextclade --configfile build-configs/ci/config.yaml
continue-on-error: true

- if: always()
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}-${{ matrix.runtime }}
if-no-files-found: ignore
Expand All @@ -301,18 +303,25 @@ jobs:

- name: Verify a workflow ran
env:
ingest: ${{ steps.ingest.conclusion }}
phylogenetic: ${{ steps.phylogenetic.conclusion }}
nextclade: ${{ steps.nextclade.conclusion }}
# "outcome" is success/failure/cancelled/skipped _before_
# "continue-on-error" is applied to calculate "conclusion"
ingest: ${{ steps.ingest.outcome }}
phylogenetic: ${{ steps.phylogenetic.outcome }}
nextclade: ${{ steps.nextclade.outcome }}
run: |
# Show step conclusions in job logs…
# Show step outcomes in job logs…
echo "ingest $ingest"
echo "phylogenetic $phylogenetic"
echo "nextclade $nextclade"

# …and also in the workflow summary.
"$NEXTSTRAIN_GITHUB_DIR"/bin/interpolate-env < "$NEXTSTRAIN_GITHUB_DIR"/text-templates/pathogen-repo-ci.md > "$GITHUB_STEP_SUMMARY"

# Assert status; if we see at least one attempt, regardless of
# success/failure, we're good.
[[ $ingest != skipped || $phylogenetic != skipped || $nextclade != skipped ]]
# Assert status; we're good if we see at least one success and the
# rest are success or skipped.
[[
($ingest == success || $phylogenetic == success || $nextclade == success)
&& ($ingest == success || $ingest == skipped)
&& ($phylogenetic == success || $phylogenetic == skipped)
&& ($nextclade == success || $nextclade == skipped)
]]
2 changes: 1 addition & 1 deletion text-templates/pathogen-repo-ci.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| workflow | conclusion |
| workflow | outcome |
| ------------- | --------------- |
| ingest | ${ingest} |
| phylogenetic | ${phylogenetic} |
Expand Down

0 comments on commit a54bf16

Please sign in to comment.