Removes source $VENV from workflow #26
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
name: govuk-tech-docs-sphinx-theme build | |
on: [ push, pull_request ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python: [3.8, 3.9, '3.10' ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached virtual environment | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install Poetry dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root --with dev | |
- name: Install library and dependencies | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then | |
make dependencies | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
poetry install --no-interaction --with dev | |
poetry run pre-commit install | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi; | |
shell: bash | |
- name: Run pre-commit hooks | |
run: poetry run pre-commit run --all-files | |
- name: Create documentation | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then | |
make docs | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
poetry run sphinx-build -b html ./docs ./docs/_build | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi; | |
shell: bash | |
- name: Execute tests, and create coverage report | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then | |
poetry run make coverage_xml | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
poetry run coverage run -m pytest | |
poetry run coverage xml | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi; | |
shell: bash | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
files: ./coverage.xml | |
env_vars: OS=${{ matrix.os }},PYTHON=${{ matrix.python }} |