Skip to content

Commit

Permalink
Merge pull request #95 from nextstrain/bring-tha-noise-92
Browse files Browse the repository at this point in the history
Make `pathogen-repo-ci` fail when config is missing or no builds are attempted
  • Loading branch information
genehack authored Jun 13, 2024
2 parents 7f910e6 + fea28cb commit 116404e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ jobs:
artifact-name: outputs-test-pathogen-repo-ci
secrets: inherit

test-pathogen-repo-ci-no-example-data:
uses: ./.github/workflows/pathogen-repo-ci.yaml
with:
repo: nextstrain/zika-tutorial
artifact-name: outputs-test-pathogen-repo-ci-no-example-data

test-docs-ci-conda:
uses: ./.github/workflows/docs-ci.yaml
with:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/pathogen-repo-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,29 +238,49 @@ jobs:
ref: ${{ needs.workflow-context.outputs.sha }}
path: ${{ env.NEXTSTRAIN_GITHUB_DIR }}

- name: Verify nextstrain-pathogen.yaml file
run: >
if [[ ! -f nextstrain-pathogen.yaml ]]; then
echo "To use this workflow, there must be a 'nextstrain-pathogen.yaml' file present in the repository root";
exit 1;
fi
- name: Set up Nextstrain runtime ${{ matrix.runtime }}
uses: ./.git/nextstrain/.github/actions/setup-nextstrain-cli
with:
cli-version: ">=8.3.0"
runtime: ${{ matrix.runtime }}

- 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=SC2129,SC2242
# if we see at least one success, we're good
echo "INGEST ATTEMPTED=${{ steps.ingest.outputs.run-attempted }}" >> "$GITHUB_STEP_SUMMARY"
echo "PHYLOGENETIC ATTEMPTED=${{ steps.phylogenetic.outputs.run-attempted }}" >> "$GITHUB_STEP_SUMMARY"
echo "NEXTCLADE ATTEMPTED=${{ steps.nextclade.outputs.run-attempted }}" >> "$GITHUB_STEP_SUMMARY"
exit ${{ contains(steps.*.outputs.run-attempted, 'true') && '0' || '1' }}
17 changes: 15 additions & 2 deletions actions/run-nextstrain-ci-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,32 @@ 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:
- id: run-build
env:
DIR: ${{ inputs.directory }}
run: |
if [[ -f nextstrain-pathogen.yaml && -f "$DIR"/Snakefile && -f "$DIR"/build-configs/ci/config.yaml ]]; then
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 nextstrain-pathogen.yaml "$DIR"/Snakefile "$DIR"/build-configs/ci/config.yaml; do
for i in "$DIR"/Snakefile "$DIR"/build-configs/ci/config.yaml; do
[[ -f $i ]] || echo missing "$i"
done
fi
Expand Down

0 comments on commit 116404e

Please sign in to comment.