Split make linkcheck
out into a distinct job [#106]
#3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow is intended to be called by workflows in our various software | ||
# repos containing Sphinx documentation projects. | ||
# See workflow-templates/docs-ci.yaml (a "starter" workflow) in this repo for | ||
# an example of what the caller workflow looks like. | ||
name: Sphinx docs CI | ||
on: | ||
workflow_call: | ||
inputs: | ||
repo: | ||
description: >- | ||
Repository name with owner (e.g. nextstrain/zika). Defaults to the | ||
repository of the caller workflow. | ||
type: string | ||
default: ${{ github.repository }} | ||
required: false | ||
docs-directory: | ||
description: >- | ||
Directory containing Makefile. (e.g. docs/) | ||
type: string | ||
required: true | ||
environment-file: | ||
description: >- | ||
Path to conda environment file. (e.g. docs/conda.yml) | ||
type: string | ||
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: >- | ||
Sphinx builder name. See https://www.sphinx-doc.org/en/master/man/sphinx-build.html#options | ||
type: string | ||
default: html | ||
permissions: | ||
pull-requests: write | ||
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-conda: | ||
if: inputs.environment-file != '' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repo }} | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
environment-file: ${{ inputs.environment-file }} | ||
- run: conda list | ||
- run: make ${{ inputs.make-target }} | ||
working-directory: ${{ inputs.docs-directory }} | ||
build-pip: | ||
if: inputs.pip-install-target != '' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repo }} | ||
- run: pip install '${{ inputs.pip-install-target }}' | ||
- run: pip list | ||
- run: make ${{ inputs.make-target }} | ||
working-directory: ${{ inputs.docs-directory }} | ||
linkcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repo }} | ||
- run: pip install '${{ inputs.pip-install-target }}' | ||
- id: linkcheck | ||
run: make linkcheck | ||
working-directory: ${{ inputs.docs-directory }} | ||
continue-on-error: true | ||
- uses: mainmatter/continue-on-error-comment@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
outcome: ${{ steps.linkcheck.outcome }} | ||
test-id: Linkcheck error: ${{ matrix.code }} | ||