forked from ukgovdatascience/govuk-tech-docs-sphinx-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ukgovdatascience/build-govuk-tech-docs-sph…
…inx-theme Build GOV.UK Tech Docs Sphinx theme
- Loading branch information
Showing
105 changed files
with
19,202 additions
and
754 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
# Summary | ||
|
||
Add your summary here - keep it brief, to the point, and in plain English. For further information about pull requests, | ||
check out the [GDS Way][gds-way]. | ||
Add your summary here - keep it brief, to the point, and in plain English. [For further | ||
information about pull requests, check out the GDS | ||
Way](https://gds-way.cloudapps.digital/standards/pull-requests.html). | ||
|
||
# Checklists | ||
|
||
<!-- | ||
These are DO-CONFIRM checklists; it CONFIRMs that you have DOne each item. | ||
Outstanding actions should be completed before reviewers are assigned; if actions are irrelevant, please try and add a | ||
comment stating why. | ||
Outstanding actions should be completed before reviewers are assigned; if actions are | ||
irrelevant, please try and add a comment stating why. | ||
Incomplete pull/merge requests MAY be blocked until actions are resolved, or closed at the reviewers' discretion. | ||
Incomplete pull/merge requests MAY be blocked until actions are resolved, or closed at | ||
the reviewers' discretion. | ||
--> | ||
|
||
This pull/merge request meets the following requirements: | ||
|
||
- [ ] Code runs | ||
- [ ] Developments are **secure** and [**ethical**][data-ethics-framework] | ||
- [ ] You have made proportionate checks that the code works correctly, and the theme works as expected | ||
- [ ] [Developments are ethical][data-ethics-framework] and secure | ||
- [ ] You have made proportionate checks that the code works correctly, and the theme | ||
works as expected | ||
- [ ] Test suite passes | ||
- [ ] [Minimum usable documentation][agilemodeling] written in the `docs` folder | ||
|
||
Comments have been added below around the incomplete checks. | ||
|
||
[agilemodeling]: http://agilemodeling.com/essays/documentLate.htm | ||
[data-ethics-framework]: https://www.gov.uk/government/publications/data-ethics-framework | ||
[gds-way]: https://gds-way.cloudapps.digital/standards/pull-requests.html |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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.6, 3.7, 3.8, 3.9 ] | ||
|
||
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: snok/install-poetry@v1.1.6 | ||
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 | ||
- name: Install library and dependencies | ||
run: | | ||
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then | ||
poetry run make dependencies | ||
elif [ "$RUNNER_OS" == "Windows" ]; then | ||
poetry install --no-interaction | ||
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: | | ||
source $VENV | ||
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then | ||
poetry run 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: | | ||
source $VENV | ||
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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: govuk-tech-docs-sphinx-theme deploy package and documentation | ||
|
||
on: | ||
release: | ||
types: [ released ] | ||
|
||
jobs: | ||
deploy-package-and-documentation: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1.1.6 | ||
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 | ||
- name: Install dependencies | ||
run: poetry run make dependencies | ||
- name: Create documentation | ||
run: poetry run make docs | ||
- name: Build package | ||
run: poetry build | ||
- name: Set the deployment configuration for Poetry | ||
run: poetry config pypi-token.pypi "$PYPI_API_TOKEN" | ||
env: | ||
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
shell: bash | ||
- name: Publish to GitHub Pages | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: JamesIves/github-pages-deploy-action@4.1.4 | ||
with: | ||
branch: gh-pages | ||
folder: docs/_build | ||
- name: Deploy package to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
run: poetry publish |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,38 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.4 | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: flake8 | ||
args: ["govuk_tech_docs_sphinx_theme"] | ||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v0.14.3 | ||
- id: check-added-large-files | ||
name: Check for files larger than 5 MB | ||
args: [ "--maxkb=5120" ] | ||
- id: end-of-file-fixer | ||
name: Check for a blank line at the end of scripts (auto-fixes) | ||
- id: trailing-whitespace | ||
name: Check for trailing whitespaces (auto-fixes) | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.8.0 | ||
hooks: | ||
- id: detect-secrets | ||
args: ["--baseline", ".secrets.baseline"] | ||
exclude: .*/tests/.* | ||
- repo: https://github.com/aflc/pre-commit-jupyter | ||
rev: v1.1.0 | ||
- id: isort | ||
name: isort - Sort Python imports (auto-fixes) | ||
types: [ cython, pyi, python ] | ||
args: [ "--profile", "black", "--filter-files" ] | ||
- repo: https://github.com/psf/black | ||
rev: 21.5b2 # Replace by any tag/version: https://github.com/psf/black/tags | ||
hooks: | ||
- id: jupyter-notebook-cleanup | ||
args: | ||
- --remove-kernel-metadata | ||
- --pin-patterns | ||
- "[keep_output]" | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
- id: black | ||
name: black - consistent Python code formatting (auto-fixes) | ||
language_version: python # Should be a command that runs python3.6+ | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: check-added-large-files | ||
args: ["--maxkb=5120"] | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: flake8 | ||
name: flake8 - Python linting | ||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.0.3 | ||
hooks: | ||
- id: detect-secrets | ||
name: detect-secrets - Detect secrets in staged code | ||
args: [ "--baseline", ".secrets.baseline" ] | ||
exclude: .*/tests/.*|^poetry\.lock$ |
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
Oops, something went wrong.