From d60bfb09db1b8242eaaf7cabed671b75621adc32 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Fri, 31 May 2024 11:33:29 -0700 Subject: [PATCH] Refactor `pathogen-repo-ci` to be smarter [#89] --- .github/workflows/pathogen-repo-ci.yaml | 21 +++++++------ actions/run-nextstrain-build/action.yaml | 39 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 actions/run-nextstrain-build/action.yaml diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index a8ce20e..91ac428 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -232,16 +232,17 @@ jobs: with: runtime: ${{ matrix.runtime }} + - name: Run ingest + uses: nextstrain/.github/actions/run-nextstrain-build@update-ci-89 + with: + step: ingest - - run: nextstrain build . ${{ inputs.build-args }} + - name: Run phylogenetic + uses: nextstrain/.github/actions/run-nextstrain-build@update-ci-89 + with: + step: phylogenetic - - if: always() - uses: actions/upload-artifact@v4 + - name: Run nextclade + uses: nextstrain/.github/actions/run-nextstrain-build@update-ci-89 with: - name: ${{ inputs.artifact-name }}-${{ matrix.runtime }} - path: | - auspice/ - results/ - benchmarks/ - logs/ - .snakemake/log/ + step: nextclade diff --git a/actions/run-nextstrain-build/action.yaml b/actions/run-nextstrain-build/action.yaml new file mode 100644 index 0000000..4ade117 --- /dev/null +++ b/actions/run-nextstrain-build/action.yaml @@ -0,0 +1,39 @@ +name: run-nextstrain-build +description: >- + Runs a single `nextstrain build` command in a given sub-directory of + a pathogen repo. Must be provided with the name of the + sub-directory. + +inputs: + step: + description: The name of the sub-directory to run the build from + type: string + required: true + +runs: + using: "composite" + steps: + - id: Run ${{ inputs.step }} + env: + STEP: ${{ inputs.step }} + run: | + if [[ -f nextstrain-pathogen.yaml && -f $STEP/Snakefile && -f $STEP/build-configs/ci/config.yaml ]]; then + nextstrain build $STEP --configfile build-configs/ci/config.yaml + else + echo "Skipping $STEP build due to one or more missing files." + for i in nextstrain-pathogen.yaml $STEP/Snakefile $STEP/build-configs/ci/config.yaml; do + ! test -f $i && echo missing $i + done + fi + shell: bash + + - id: Upload ${{ inputs.step }} artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: ${{inputs.step }}-outputs-${{ matrix.runtime }} + path: | + ${{ inputs.step }}/results/ + ${{ inputs.step }}/benchmarks/ + ${{ inputs.step }}/logs/ + ${{ inputs.step }}/.snakemake/log/