From 3715982367120636d4bf0956971ac5cefe00be0c Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Wed, 18 Oct 2023 15:02:55 -0700 Subject: [PATCH] pathogen-repo-ci: Add `build-dir` input option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the development of the pathogen-repo-template¹, we are reorganizing pathogen repositories to move workflows into their own directories. This change in monkeypox² revealed that the pathogen-repo-ci workflow no longer works with this new file organization because it expects `nextstrain build` to run with the root of the pathogen repository. This commit adds support for this change by allowing users to define the directory to use for the `nextstrain build` command. Changes are backwards compatible as the default is set to `.` to point to the root of the pathogen repository. ¹ https://github.com/nextstrain/pathogen-repo-template ² https://github.com/nextstrain/monkeypox/pull/198 Co-authored-by: Cornelius Roemer --- .github/workflows/ci.yaml | 7 +++++++ .github/workflows/pathogen-repo-ci.yaml | 27 ++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 84784b4..31f190b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,6 +26,13 @@ jobs: with: repo: nextstrain/zika-tutorial + test-pathogen-repo-ci-with-build-dir: + uses: ./.github/workflows/pathogen-repo-ci.yaml + with: + repo: nextstrain/monkeypox + build-dir: phylogenetic + artifact-name: mpox-phylogenetic + test-pathogen-repo-ci-failure: uses: ./.github/workflows/pathogen-repo-ci.yaml with: diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 2c51f84..9f20892 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -63,6 +63,16 @@ on: - conda required: false + build-dir: + description: >- + The directory used for `nextstrain build`. + If provided, example data should be in an `example_data` directory + relative to this directory. + Defaults to the root of the repository. + type: string + default: "." + required: false + artifact-name: description: >- Name to use for build results artifact uploaded at the end of the @@ -94,12 +104,17 @@ jobs: - id: inputs env: runtimes: ${{ inputs.runtimes }} + build_dir: ${{ inputs.build-dir }} shell: bash run: | runtimes="$(yq --output-format=json --indent=0 . <<<"$runtimes")" echo runtimes="$runtimes" | tee -a "$GITHUB_OUTPUT" + build_dir="${build_dir%/}" + echo build_dir="$build_dir" | tee -a "$GITHUB_OUTPUT" + outputs: runtimes: ${{ steps.inputs.outputs.runtimes }} + build_dir: ${{ steps.inputs.outputs.build_dir }} build: needs: configuration @@ -228,6 +243,7 @@ jobs: python-version: "3.7" - name: Copy example data + working-directory: ${{ needs.configuration.outputs.build_dir }} run: | if [[ -d example_data ]]; then mkdir -p data/ @@ -237,14 +253,15 @@ jobs: fi - run: nextstrain build . ${{ inputs.build-args }} + working-directory: ${{ needs.configuration.outputs.build_dir }} - if: always() uses: actions/upload-artifact@v3 with: name: ${{ inputs.artifact-name }}-${{ matrix.runtime }} path: | - auspice/ - results/ - benchmarks/ - logs/ - .snakemake/log/ + ${{ needs.configuration.outputs.build_dir }}/auspice/ + ${{ needs.configuration.outputs.build_dir }}/results/ + ${{ needs.configuration.outputs.build_dir }}/benchmarks/ + ${{ needs.configuration.outputs.build_dir }}/logs/ + ${{ needs.configuration.outputs.build_dir }}/.snakemake/log/