From 1eba5c0ccf0991f4c3a4ade1103349ff59ad051f Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Fri, 31 May 2024 11:32:44 -0700 Subject: [PATCH 01/12] Add names to all steps [#89] --- .github/workflows/pathogen-repo-ci.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index d4a9f9e..5e2d18b 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -196,7 +196,8 @@ jobs: ' | tee -a "$GITHUB_ENV" - - uses: actions/checkout@v4 + - name: Checkout repo + uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} @@ -226,7 +227,8 @@ jobs: # approach. -trs ] # # -trs, 28 April 2022 - - uses: nextstrain/.github/actions/setup-nextstrain-cli@c1191de9d5e1a30e91d70b0fd1041d97ed1b2496 + - name: Setup Nextstrain + uses: nextstrain/.github/actions/setup-nextstrain-cli@c1191de9d5e1a30e91d70b0fd1041d97ed1b2496 with: runtime: ${{ matrix.runtime }} From 6d8f90133ab54b562e8bac375fe5cc67d14f7b6b Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Fri, 31 May 2024 11:32:56 -0700 Subject: [PATCH 02/12] Remove example-data copy step [#89] This should be handled within the build-config of the consuming repo if it is required. --- .github/workflows/pathogen-repo-ci.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 5e2d18b..a8ce20e 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -232,14 +232,6 @@ jobs: with: runtime: ${{ matrix.runtime }} - - name: Copy example data - run: | - if [[ -d example_data ]]; then - mkdir -p data/ - cp -r -v example_data/* data/ - else - echo No example data to copy. - fi - run: nextstrain build . ${{ inputs.build-args }} From d3730bc790d3e3d8a9fe05ae98ef2ecfa66c8670 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Fri, 31 May 2024 11:33:29 -0700 Subject: [PATCH 03/12] Refactor `pathogen-repo-ci` to be smarter [#89] Also update nextstrain runtime setup step to use "modern" sidecar version, which has the side effect/benefit of allowing the `run-nexstrain-build` action to also be invoked from the sidecar instead of pinned to `master` or some other version. --- .github/workflows/pathogen-repo-ci.yaml | 88 ++++++++++--------- README.md | 1 + actions/run-nextstrain-build-step/action.yaml | 39 ++++++++ actions/setup-nextstrain-cli/action.yaml | 4 - 4 files changed, 88 insertions(+), 44 deletions(-) create mode 100644 actions/run-nextstrain-build-step/action.yaml diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index a8ce20e..b7cef89 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -3,6 +3,15 @@ # workflow) in this repo for an example of what the caller workflow looks like. name: CI +defaults: + run: + # This is the same as GitHub Action's `bash` keyword as of 20 June 2023: + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell + # + # Completely spelling it out here so that GitHub can't change it out from under us + # and we don't have to refer to the docs to know the expected behavior. + shell: bash --noprofile --norc -eo pipefail {0} + on: workflow_call: inputs: @@ -85,8 +94,12 @@ on: permissions: contents: read + id-token: write packages: read +env: + NEXTSTRAIN_GITHUB_DIR: .git/nextstrain/.github + jobs: configuration: runs-on: ubuntu-latest @@ -101,8 +114,17 @@ jobs: outputs: runtimes: ${{ steps.inputs.outputs.runtimes }} - build: - needs: configuration + workflow-context: + runs-on: ubuntu-latest + steps: + - id: workflow-context + uses: nextstrain/.github/actions/workflow-context@master + outputs: + repository: ${{ steps.workflow-context.outputs.repository }} + sha: ${{ steps.workflow-context.outputs.sha }} + + nextstrain-build: + needs: [configuration, workflow-context] strategy: fail-fast: false matrix: @@ -201,47 +223,33 @@ jobs: with: repository: ${{ inputs.repo }} - # XXX TODO: It would be better for this to call setup-nextstrain-cli - # using the same ref that this workflow was called with (e.g. if this - # workflow was invoked by the caller workflow with @foo than we invoke - # the action with @foo too), but it's not currently possible to figure - # out that ref. See discussion around this (including results of some - # investigation I did): - # - # - https://github.community/t/reusable-workflows-get-the-ref-inside-the-called-workflow/224109 - # - https://github.community/t/ref-head-in-reusable-workflows/203690/92 - # - # Once we can figure out that ref, then we can actions/checkout our - # nextstrain/.github repo at that ref as a sidecar path somewhere and - # then invoke the setup-nextstrain-cli action using a local file path - # instead of a remote owner/repo path. This separate checkout will be - # necessary since the "uses:" key can't be interpolated (${{…}}) with - # context vars. - # - # For now, update the hardcoded ref (e.g. @90af34…) below when you make - # future changes to setup-nextstrain-cli. - # - # [ Update 16 Feb 2024: We solved this for pathogen-repo-build.yaml, but - # because it required a new permission on the GitHub tokens (id-token: - # write) we decided not to update this workflow (yet?) to use the same - # approach. -trs ] - # - # -trs, 28 April 2022 - - name: Setup Nextstrain - uses: nextstrain/.github/actions/setup-nextstrain-cli@c1191de9d5e1a30e91d70b0fd1041d97ed1b2496 + - # Need to run this after the build repo is cloned so that cloning the + # build repo does not overwrite the .git dir and remove the extra support files + # that we need from nextstrain/.github repo + name: Checkout ${{ needs.workflow-context.outputs.repository }} (sha ${{ needs.workflow-context.outputs.sha }}) + uses: actions/checkout@v4 with: + repository: ${{ needs.workflow-context.outputs.repository }} + ref: ${{ needs.workflow-context.outputs.sha }} + path: ${{ env.NEXTSTRAIN_GITHUB_DIR }} + + - name: Setup Nextstrain runtime ${{ matrix.runtime }} + uses: ./.git/nextstrain/.github/actions/setup-nextstrain-cli + with: + cli-version: ">=8.3.0" runtime: ${{ matrix.runtime }} + - name: Run ingest + uses: ./.git/nextstrain/.github/actions/run-nextstrain-build-step + with: + step: ingest - - run: nextstrain build . ${{ inputs.build-args }} + - name: Run phylogenetic + uses: ./.git/nextstrain/.github/actions/run-nextstrain-build-step + with: + step: phylogenetic - - if: always() - uses: actions/upload-artifact@v4 + - name: Run nextclade + uses: ./.git/nextstrain/.github/actions/run-nextstrain-build-step with: - name: ${{ inputs.artifact-name }}-${{ matrix.runtime }} - path: | - auspice/ - results/ - benchmarks/ - logs/ - .snakemake/log/ + step: nextclade diff --git a/README.md b/README.md index 261e48e..686df0e 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ See also GitHub's [documentation on issue and PR templates](https://docs.github. Invoked by our GitHub Actions workflows, including the reusable workflows below. +- [Run Nextstrain Build Step](actions/run-nextstrain-build-step/action.yaml) - [Setup Nextstrain CLI](actions/setup-nextstrain-cli/action.yaml) - [shellcheck](actions/shellcheck/action.yaml) - [Setup SSH](actions/setup-ssh/action.yaml) access to runner machine diff --git a/actions/run-nextstrain-build-step/action.yaml b/actions/run-nextstrain-build-step/action.yaml new file mode 100644 index 0000000..f3900be --- /dev/null +++ b/actions/run-nextstrain-build-step/action.yaml @@ -0,0 +1,39 @@ +name: run-nextstrain-build-step +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-build + 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-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/ diff --git a/actions/setup-nextstrain-cli/action.yaml b/actions/setup-nextstrain-cli/action.yaml index ace540a..be6db12 100644 --- a/actions/setup-nextstrain-cli/action.yaml +++ b/actions/setup-nextstrain-cli/action.yaml @@ -1,7 +1,3 @@ -# If you update this action, please update the hardcoded ref to it in -# .github/workflows/pathogen-repo-ci.yaml. See the commentary there for why -# it's necessary. - name: Setup Nextstrain CLI description: >- This GitHub Actions action is intended to be called by workflows in our other From f8e003c27ae5643ed1572c6d0b7246bc05dac535 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Fri, 31 May 2024 17:24:05 -0700 Subject: [PATCH 04/12] Renaming things per PR feedback [#89] * run-nextstrain-build-step -> run-nextstrain-build * inputs.step -> inputs.directory --- .github/workflows/pathogen-repo-ci.yaml | 16 ++++---- README.md | 2 +- actions/run-nextstrain-build-step/action.yaml | 39 ------------------- actions/run-nextstrain-build/action.yaml | 39 +++++++++++++++++++ 4 files changed, 48 insertions(+), 48 deletions(-) delete mode 100644 actions/run-nextstrain-build-step/action.yaml 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 b7cef89..458baa2 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -218,7 +218,7 @@ jobs: ' | tee -a "$GITHUB_ENV" - - name: Checkout repo + - name: Checkout ${{ inputs.repo }} uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} @@ -233,23 +233,23 @@ jobs: ref: ${{ needs.workflow-context.outputs.sha }} path: ${{ env.NEXTSTRAIN_GITHUB_DIR }} - - name: Setup Nextstrain runtime ${{ matrix.runtime }} + - 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 - uses: ./.git/nextstrain/.github/actions/run-nextstrain-build-step + uses: ./.git/nextstrain/.github/actions/run-nextstrain-build with: - step: ingest + directory: ingest - name: Run phylogenetic - uses: ./.git/nextstrain/.github/actions/run-nextstrain-build-step + uses: ./.git/nextstrain/.github/actions/run-nextstrain-build with: - step: phylogenetic + directory: phylogenetic - name: Run nextclade - uses: ./.git/nextstrain/.github/actions/run-nextstrain-build-step + uses: ./.git/nextstrain/.github/actions/run-nextstrain-build with: - step: nextclade + directory: nextclade diff --git a/README.md b/README.md index 686df0e..cb31d92 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ See also GitHub's [documentation on issue and PR templates](https://docs.github. Invoked by our GitHub Actions workflows, including the reusable workflows below. -- [Run Nextstrain Build Step](actions/run-nextstrain-build-step/action.yaml) +- [Run Nextstrain Build](actions/run-nextstrain-build/action.yaml) - [Setup Nextstrain CLI](actions/setup-nextstrain-cli/action.yaml) - [shellcheck](actions/shellcheck/action.yaml) - [Setup SSH](actions/setup-ssh/action.yaml) access to runner machine diff --git a/actions/run-nextstrain-build-step/action.yaml b/actions/run-nextstrain-build-step/action.yaml deleted file mode 100644 index f3900be..0000000 --- a/actions/run-nextstrain-build-step/action.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: run-nextstrain-build-step -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-build - 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-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/ diff --git a/actions/run-nextstrain-build/action.yaml b/actions/run-nextstrain-build/action.yaml new file mode 100644 index 0000000..98f4614 --- /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: + directory: + description: The name of the sub-directory to run the build from + type: string + required: true + +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 + nextstrain build $DIR --configfile build-configs/ci/config.yaml + else + 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 + ! test -f $i && echo missing $i + done + fi + shell: bash + + - id: upload-artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: ci-outputs-${{ inputs.directory }}-${{ inputs.runtime }} + path: | + ${{ inputs.directory }}/results/ + ${{ inputs.directory }}/benchmarks/ + ${{ inputs.directory }}/logs/ + ${{ inputs.directory }}/.snakemake/log/ From 0b2029ee382f6d7f4d24aa7302bed1ad323af687 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Tue, 4 Jun 2024 10:10:49 -0700 Subject: [PATCH 05/12] Point this repo's CI back to `zika`; remove TODO comment [#89] --- .github/workflows/ci.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2d4bf65..3da7191 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,11 +26,7 @@ jobs: test-pathogen-repo-ci: uses: ./.github/workflows/pathogen-repo-ci.yaml with: - # XXX TODO: Revert back to nextstrain/zika (for consistency with - # elsewhere) once pathogen-repo-ci has support for running workflows in - # subdirs (i.e. for our new repo layout). - # -trs, 30 Jan 2024 - repo: nextstrain/ebola + repo: nextstrain/zika artifact-name: outputs-test-pathogen-repo-ci secrets: inherit From e7dfc763e1296ce904c91505fccd5a6f0426e996 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Tue, 4 Jun 2024 10:13:15 -0700 Subject: [PATCH 06/12] reformat YAML for consistency, per PR feedback [#89] --- .github/workflows/pathogen-repo-ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 458baa2..5c22318 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -223,10 +223,10 @@ jobs: with: repository: ${{ inputs.repo }} - - # Need to run this after the build repo is cloned so that cloning the - # build repo does not overwrite the .git dir and remove the extra support files - # that we need from nextstrain/.github repo - name: Checkout ${{ needs.workflow-context.outputs.repository }} (sha ${{ needs.workflow-context.outputs.sha }}) + # Need to run this after the build repo is cloned so that cloning the + # build repo does not overwrite the .git dir and remove the extra support files + # that we need from nextstrain/.github repo + - name: Checkout ${{ needs.workflow-context.outputs.repository }} (sha ${{ needs.workflow-context.outputs.sha }}) uses: actions/checkout@v4 with: repository: ${{ needs.workflow-context.outputs.repository }} From a4d0d71e29265a534b64605b806588fbf1dd672f Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Tue, 4 Jun 2024 10:13:39 -0700 Subject: [PATCH 07/12] =?UTF-8?q?Update=20`run-nextstrain-build`=20`upload?= =?UTF-8?q?-artifact`=20step=E2=80=A6=20[#89]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …per PR feedback * ignore/don't warn when no files found * include `auspcice` directory in upload set * sort lines --- actions/run-nextstrain-build/action.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/actions/run-nextstrain-build/action.yaml b/actions/run-nextstrain-build/action.yaml index 98f4614..9c1be48 100644 --- a/actions/run-nextstrain-build/action.yaml +++ b/actions/run-nextstrain-build/action.yaml @@ -32,8 +32,10 @@ runs: uses: actions/upload-artifact@v4 with: name: ci-outputs-${{ inputs.directory }}-${{ inputs.runtime }} + if-no-files-found: ignore path: | - ${{ inputs.directory }}/results/ + ${{ inputs.directory }}/.snakemake/log/ + ${{ inputs.directory }}/auspice/ ${{ inputs.directory }}/benchmarks/ ${{ inputs.directory }}/logs/ - ${{ inputs.directory }}/.snakemake/log/ + ${{ inputs.directory }}/results/ From 5e7f2cbe12febc9a43c806d6ffcb9ade01f5263f Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Tue, 4 Jun 2024 10:14:46 -0700 Subject: [PATCH 08/12] Refactor pathogen-repo-ci inputs & description, based on PR feedback [#89] * Pass `runtime` as an input, rather than accessing `matrix.runtime` directly * Update action description to reflect dependency on having Nextstrain CLI already set up via other action; add warning about the purpose of this action --- .github/workflows/pathogen-repo-ci.yaml | 3 +++ actions/run-nextstrain-build/action.yaml | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 5c22318..1fa7da0 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -243,13 +243,16 @@ jobs: uses: ./.git/nextstrain/.github/actions/run-nextstrain-build with: directory: ingest + runtime: ${{ matrix.runtime }} - name: Run phylogenetic uses: ./.git/nextstrain/.github/actions/run-nextstrain-build with: directory: phylogenetic + runtime: ${{ matrix.runtime }} - name: Run nextclade uses: ./.git/nextstrain/.github/actions/run-nextstrain-build with: directory: nextclade + runtime: ${{ matrix.runtime }} diff --git a/actions/run-nextstrain-build/action.yaml b/actions/run-nextstrain-build/action.yaml index 9c1be48..32f88d0 100644 --- a/actions/run-nextstrain-build/action.yaml +++ b/actions/run-nextstrain-build/action.yaml @@ -1,14 +1,24 @@ 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. + a pathogen repo. Must be provided with the name of the sub-directory + and the runtime to use. Requires that the Nextstrain CLI runtime + already be provisioned (e.g., via the `setup-nextstrain-cli` action + in this repo). + + Note that this action exists primarily as a means to keep the + `pathogen-repo-ci` workflow DRY; it is unlikely to be useful outside + the context of that specific workflow. inputs: directory: description: The name of the sub-directory to run the build from type: string required: true + runtime: + description: Nextstrain runtime to use for the build + type: string + required: true runs: using: "composite" From b58836f5bee190f76d763e21076334818579216a Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Tue, 4 Jun 2024 10:22:03 -0700 Subject: [PATCH 09/12] `mv actions/run-nextstrain-build actions/run-nextstrain-ci-build` [#89] --- .github/workflows/pathogen-repo-ci.yaml | 6 +++--- README.md | 2 +- .../action.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename actions/{run-nextstrain-build => run-nextstrain-ci-build}/action.yaml (98%) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 1fa7da0..7926a68 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -240,19 +240,19 @@ jobs: runtime: ${{ matrix.runtime }} - name: Run ingest - uses: ./.git/nextstrain/.github/actions/run-nextstrain-build + uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build with: directory: ingest runtime: ${{ matrix.runtime }} - name: Run phylogenetic - uses: ./.git/nextstrain/.github/actions/run-nextstrain-build + uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build with: directory: phylogenetic runtime: ${{ matrix.runtime }} - name: Run nextclade - uses: ./.git/nextstrain/.github/actions/run-nextstrain-build + uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build with: directory: nextclade runtime: ${{ matrix.runtime }} diff --git a/README.md b/README.md index cb31d92..b9a506a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ See also GitHub's [documentation on issue and PR templates](https://docs.github. Invoked by our GitHub Actions workflows, including the reusable workflows below. -- [Run Nextstrain Build](actions/run-nextstrain-build/action.yaml) +- [Run Nextstrain CI Build](actions/run-nextstrain-ci-build/action.yaml) - [Setup Nextstrain CLI](actions/setup-nextstrain-cli/action.yaml) - [shellcheck](actions/shellcheck/action.yaml) - [Setup SSH](actions/setup-ssh/action.yaml) access to runner machine diff --git a/actions/run-nextstrain-build/action.yaml b/actions/run-nextstrain-ci-build/action.yaml similarity index 98% rename from actions/run-nextstrain-build/action.yaml rename to actions/run-nextstrain-ci-build/action.yaml index 32f88d0..66f35be 100644 --- a/actions/run-nextstrain-build/action.yaml +++ b/actions/run-nextstrain-ci-build/action.yaml @@ -1,4 +1,4 @@ -name: run-nextstrain-build +name: run-nextstrain-ci-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 From 2687ba0b7e4e816de819ca5ba14742e0a7e90062 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Wed, 5 Jun 2024 10:39:56 -0700 Subject: [PATCH 10/12] Set nextstrain runtime, per PR feedback [#89] --- actions/run-nextstrain-ci-build/action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/run-nextstrain-ci-build/action.yaml b/actions/run-nextstrain-ci-build/action.yaml index 66f35be..8d8e0b4 100644 --- a/actions/run-nextstrain-ci-build/action.yaml +++ b/actions/run-nextstrain-ci-build/action.yaml @@ -28,6 +28,7 @@ runs: DIR: ${{ inputs.directory }} run: | if [[ -f nextstrain-pathogen.yaml && -f $DIR/Snakefile && -f $DIR/build-configs/ci/config.yaml ]]; then + nextstrain check-setup ${{ inputs.runtime }} --set-default nextstrain build $DIR --configfile build-configs/ci/config.yaml else echo "Skipping $DIR build due to one or more missing files." From 46abc25ddbc494b7b9a6e52d4dcac6d24e79ddb0 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Fri, 7 Jun 2024 11:29:22 -0700 Subject: [PATCH 11/12] shell linting-ish fixes, from PR review [#89] --- actions/run-nextstrain-ci-build/action.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actions/run-nextstrain-ci-build/action.yaml b/actions/run-nextstrain-ci-build/action.yaml index 8d8e0b4..0c2e115 100644 --- a/actions/run-nextstrain-ci-build/action.yaml +++ b/actions/run-nextstrain-ci-build/action.yaml @@ -27,13 +27,13 @@ runs: env: DIR: ${{ inputs.directory }} run: | - if [[ -f nextstrain-pathogen.yaml && -f $DIR/Snakefile && -f $DIR/build-configs/ci/config.yaml ]]; then + if [[ -f nextstrain-pathogen.yaml && -f "$DIR"/Snakefile && -f "$DIR"/build-configs/ci/config.yaml ]]; then nextstrain check-setup ${{ inputs.runtime }} --set-default - nextstrain build $DIR --configfile build-configs/ci/config.yaml + nextstrain build "$DIR" --configfile build-configs/ci/config.yaml else 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 - ! test -f $i && echo missing $i + for i in nextstrain-pathogen.yaml "$DIR"/Snakefile "$DIR"/build-configs/ci/config.yaml; do + [[ -f $i ]] || echo missing $i done fi shell: bash From 3b4969271d099dcb8cec364aecf98a9da29260bb Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Fri, 7 Jun 2024 11:39:32 -0700 Subject: [PATCH 12/12] Restore `artifact-name` functionality, per PR feedback [#89] * Update `artifact-name` description in `pathogen-repo-ci.yaml` to make it clear build directory will be appended to provided value, and to update default value to make clear these are CI results * Pass `artifact-name` down into `run-nextstrain-ci-build` steps ni `pathogen-repo-ci` workflow * Add `artifact-name` input to `run-nextstrain-ci-build` action and use it in `upload-artifact` action step --- .github/workflows/pathogen-repo-ci.yaml | 22 ++++++++++++++------- actions/run-nextstrain-ci-build/action.yaml | 8 +++++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 7926a68..71149f9 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -74,15 +74,20 @@ on: artifact-name: description: >- - Name to use for build results artifact uploaded at the end of the - workflow. This name will be suffixed with other information from the - workflow job matrix to distinguish each artifact in a workflow run. + A base name to use for the uploaded artifacts from the + build. This will be concatenated with the directory name + used to invoke the build to generate the full artifact file + name. - If you're invoking this workflow multiple times from the same calling - workflow, you should set this. Otherwise, the default of "outputs" - is probably fine. + Defaults to `ci-outputs`. + + N.b., you almost certainly don't need to change this, unless + you're running multiple invocations of this action in a + single workflow. Then you should provide unique values to + ensure you can access the artifacts from all the builds + you're doing. type: string - default: outputs + default: ci-outputs required: false continue-on-error: @@ -244,15 +249,18 @@ jobs: with: directory: ingest runtime: ${{ matrix.runtime }} + artifact-name: ${{ inputs.artifact-name }} - name: Run phylogenetic uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build with: directory: phylogenetic runtime: ${{ matrix.runtime }} + artifact-name: ${{ inputs.artifact-name }} - name: Run nextclade uses: ./.git/nextstrain/.github/actions/run-nextstrain-ci-build with: directory: nextclade runtime: ${{ matrix.runtime }} + artifact-name: ${{ inputs.artifact-name }} diff --git a/actions/run-nextstrain-ci-build/action.yaml b/actions/run-nextstrain-ci-build/action.yaml index 0c2e115..66cf141 100644 --- a/actions/run-nextstrain-ci-build/action.yaml +++ b/actions/run-nextstrain-ci-build/action.yaml @@ -11,6 +11,12 @@ description: >- the context of that specific workflow. inputs: + artifact-name: + description: >- + Name to append to the build directory to generate a + unique artifact name for the upload action. + type: string + required: true directory: description: The name of the sub-directory to run the build from type: string @@ -42,7 +48,7 @@ runs: if: always() uses: actions/upload-artifact@v4 with: - name: ci-outputs-${{ inputs.directory }}-${{ inputs.runtime }} + name: ${{ inputs.artifact-name }}-${{ inputs.directory }}-${{ inputs.runtime }} if-no-files-found: ignore path: | ${{ inputs.directory }}/.snakemake/log/