From a54bf160c7d4428b41f277ae1d1b46138a3ffe43 Mon Sep 17 00:00:00 2001 From: Thomas Sibley Date: Thu, 13 Jun 2024 22:34:12 -0700 Subject: [PATCH] pathogen-repo-ci: Keep running even if one of the pathogen workflows 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. --- .github/workflows/pathogen-repo-ci.yaml | 27 ++++++++++++++-------- .github/workflows/pathogen-repo-ci.yaml.in | 27 ++++++++++++++-------- text-templates/pathogen-repo-ci.md | 2 +- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 64cee30..90282f7 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -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 @@ -320,11 +322,13 @@ 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" @@ -332,6 +336,11 @@ jobs: # …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) + ]] diff --git a/.github/workflows/pathogen-repo-ci.yaml.in b/.github/workflows/pathogen-repo-ci.yaml.in index 29b2483..99ac3cc 100644 --- a/.github/workflows/pathogen-repo-ci.yaml.in +++ b/.github/workflows/pathogen-repo-ci.yaml.in @@ -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 @@ -301,11 +303,13 @@ 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" @@ -313,6 +317,11 @@ jobs: # …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) + ]] diff --git a/text-templates/pathogen-repo-ci.md b/text-templates/pathogen-repo-ci.md index 36af39e..5c80211 100644 --- a/text-templates/pathogen-repo-ci.md +++ b/text-templates/pathogen-repo-ci.md @@ -1,4 +1,4 @@ -| workflow | conclusion | +| workflow | outcome | | ------------- | --------------- | | ingest | ${ingest} | | phylogenetic | ${phylogenetic} |