Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pathogen-repo-ci fail when config is missing or no builds are attempted #95

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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