Skip to content

Commit

Permalink
Validate that at least one build was attempted [#92]
Browse files Browse the repository at this point in the history
* Add ids to build steps in `pathogen-repo-ci`
* Add `run-attempted` output to `run-nextstrain-ci-build`
* Set output to true or false depending on whether build was attempted
* Add step to `pathogen-repo-ci` to read outputs from
  `run-nextstrain-ci-build` and validate at least one build was tried
  • Loading branch information
genehack committed Jun 11, 2024
1 parent f26fca4 commit 13ded3a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/pathogen-repo-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,22 +255,32 @@ jobs:
)
- name: Run ingest
id: ingest
uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build
with:
directory: ingest
runtime: ${{ matrix.runtime }}
artifact-name: ${{ inputs.artifact-name }}

- name: Run phylogenetic
id: phylogenetic
uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build
with:
directory: phylogenetic
runtime: ${{ matrix.runtime }}
artifact-name: ${{ inputs.artifact-name }}

- name: Run nextclade
id: nextclade
uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build
with:
directory: nextclade
runtime: ${{ matrix.runtime }}
artifact-name: ${{ inputs.artifact-name }}

- name: Verify a workflow ran
run: >-
# shellcheck disable=SC2154
# if we see at least one success, we're good
exit ${{ contains(steps.*.outputs.run-attempted, 'success') && '0' || '1' }}
13 changes: 13 additions & 0 deletions actions/run-nextstrain-ci-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ inputs:
type: string
required: true

outputs:
run-attempted:
description: >-
Boolean indicating if the build step was _attempted_.
N.b., this does not indicate if the build step *succeeded*, only
that the requirements were met to attempt to run it.
value: ${{ steps.run-build.outputs.run-attempted }}

runs:
using: "composite"
steps:
Expand All @@ -34,9 +43,13 @@ runs:
DIR: ${{ inputs.directory }}
run: |
if [[ -f "$DIR"/Snakefile && -f "$DIR"/build-configs/ci/config.yaml ]]; then
echo "run-attempted=true" >> "$GITHUB_OUTPUT"
nextstrain check-setup ${{ inputs.runtime }} --set-default
nextstrain build "$DIR" --configfile build-configs/ci/config.yaml
else
echo "run-attempted=false" >> "$GITHUB_OUTPUT"
echo "Skipping $DIR build due to one or more missing files."
for i in "$DIR"/Snakefile "$DIR"/build-configs/ci/config.yaml; do
[[ -f $i ]] || echo missing "$i"
Expand Down

0 comments on commit 13ded3a

Please sign in to comment.