From 79386fbfe9bf8702f54edb988e0f907fc6806697 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Tue, 8 Nov 2022 10:25:11 -0800 Subject: [PATCH 1/2] docs-ci: Add pip install option Some docs projects use pip instead of conda to set up the environment. 1. Make environment-file input (Conda setup) optional. 2. Add a new optional input to install from pip. 3. Use one job per environment setup option. Specifying none of the setup options will cause both jobs to be skipped, but I think that's appropriate user error. --- .github/workflows/docs-ci.yaml | 42 ++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docs-ci.yaml b/.github/workflows/docs-ci.yaml index 0ac10b4..a82fcb8 100644 --- a/.github/workflows/docs-ci.yaml +++ b/.github/workflows/docs-ci.yaml @@ -23,9 +23,15 @@ on: environment-file: description: >- - Path to conda environment file (e.g. docs/conda.yml) + Path to conda environment file. (e.g. docs/conda.yml) type: string - required: true + required: false + + pip-install-target: + description: >- + Pip install target. (e.g. local directory which contains setup.py, project URL) + type: string + required: false make-target: description: >- @@ -33,8 +39,17 @@ on: type: string default: html +env: + # Used for `make` steps. + # -n: warn on missing references + # -W: error on warnings + # --keep-going: find all warnings + # https://www.sphinx-doc.org/en/master/man/sphinx-build.html + SPHINXOPTS: -n -W --keep-going + jobs: - build: + build-conda: + if: inputs.environment-file != '' runs-on: ubuntu-latest defaults: run: @@ -52,9 +67,18 @@ jobs: - run: make ${{ inputs.make-target }} working-directory: ${{ inputs.docs-directory }} - env: - # https://www.sphinx-doc.org/en/master/man/sphinx-build.html - # -n: warn on missing references - # -W: error on warnings - # --keep-going: find all warnings - SPHINXOPTS: -n -W --keep-going + + build-pip: + if: inputs.pip-install-target != '' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ inputs.repo }} + + - run: pip install '${{ inputs.pip-install-target }}' + + - run: pip list + + - run: make ${{ inputs.make-target }} + working-directory: ${{ inputs.docs-directory }} From 5e58f743b85473c0fdf20ce71a0d6786e0e85bb0 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:38:11 -0800 Subject: [PATCH 2/2] docs-ci: Test with pip install option --- .github/workflows/ci.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 991a20b..c1bef59 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,13 +23,20 @@ jobs: with: repo: nextstrain/zika-tutorial - test-docs-ci: + test-docs-ci-conda: uses: ./.github/workflows/docs-ci.yaml with: repo: nextstrain/docs.nextstrain.org docs-directory: . environment-file: environment.yml + test-docs-ci-pip: + uses: ./.github/workflows/docs-ci.yaml + with: + repo: nextstrain/augur + docs-directory: docs/ + pip-install-target: .[dev] + test-readme: runs-on: ubuntu-latest steps: