forked from open-contracting/standard-development-handbook
-
Notifications
You must be signed in to change notification settings - Fork 0
docs/standard/contributing: Add Github Actions tests notes #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ghost
wants to merge
5
commits into
main
Choose a base branch
from
linkcheck
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d9a4296
docs/standard/contributing: Add Github Actions tests notes
jarofgreen 5e77eb3
Refactor checks and tests documentation
duncandewhurst c7966a1
docs/standard/contributing.md: Remove repeated content from PR template
duncandewhurst 4bd1937
Move Read the Docs documentation to deployment page
duncandewhurst 7c708eb
docs/standard/contributing.md: copy-edit
duncandewhurst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,76 @@ | ||
| # Checks and tests | ||
|
|
||
| The standard repository uses [GitHub Actions](https://docs.github.com/en/actions) to run automated checks each time you push a commit to GitHub. | ||
|
|
||
| With the exception of [Link Check](#link-check), all checks must pass successfully before you can merge a pull request. | ||
|
|
||
| Checks are defined by the YAML files in the [`.github/workflows` directory](https://github.com/Open-Telecoms-Data/open-fibre-data-standard/tree/0.1-dev/.github/workflows). | ||
|
|
||
| This page describes the purpose of each check, how to run it locally and what to do about failures. | ||
|
|
||
| Before running checks locally, you need to follow the [getting started instructions](build.md#get-started). | ||
|
|
||
| ## Link Check | ||
|
|
||
| Check the integrity of all external links. | ||
|
|
||
| To run locally: | ||
|
|
||
| ```bash | ||
| cd docs | ||
| make linkcheck | ||
| ``` | ||
|
|
||
| To correct failures, review the output and fix broken links, where possible. This check may report false positives, for example, when linking to anchors in Markdown files hosted on GitHub. Therefore, failures do not block merging. | ||
|
|
||
| ## MD Format | ||
|
|
||
| Enforce a consistent style in Markdown files. | ||
|
|
||
| To run locally: | ||
|
|
||
| ```bash | ||
| mdformat --check docs | ||
| ``` | ||
|
|
||
| To correct failures, run the following command: | ||
|
|
||
| ```bash | ||
| ./manage.py pre-commit | ||
| ``` | ||
|
|
||
| ## Sphinx Build | ||
|
|
||
| Build the documentation and warn about all references where the target cannot be found. | ||
|
|
||
| To run locally: | ||
|
|
||
| ```bash | ||
| sphinx-build -nW ./docs/ ./temp_build | ||
| ``` | ||
|
|
||
| To correct failures, review the output and fix broken references. | ||
|
|
||
| ## Run all tests | ||
|
|
||
| Run the tests defined in the [`/tests` directory](https://github.com/Open-Telecoms-Data/open-fibre-data-standard/tree/0.1-dev/tests). | ||
|
|
||
| Tests are written using the [pytest framework](https://docs.pytest.org/en/7.2.x/) and use methods from [JSON Schema and CSV Codelists](https://jscc.readthedocs.io/en/latest/). | ||
|
|
||
| There are two test files: | ||
|
|
||
| * `test_csv.py` - Ensure that all CSV files are valid: no empty rows or columns, no leading or trailing whitespace in cells, same number of cells in each row. | ||
| * `test_json.py`- Ensure that: | ||
| * All JSON files are non-empty, correctly indented and valid. | ||
| * Codes in codelist CSV files match enums in the schema. | ||
| * Codelist CSV files are referenced in the schema. | ||
| * Codelists CSV files referenced in the schema exist. | ||
| * JSON Schema files are valid. | ||
|
|
||
| To run locally: | ||
|
|
||
| ```bash | ||
| pytest tests | ||
| ``` | ||
|
|
||
| To correct failures, review the warnings and recommended actions in the output. | ||
This file contains hidden or 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,20 @@ | ||
| # Deployment | ||
|
|
||
| [Read the Docs](https://readthedocs.org/) is used to build and deploy the documentation. | ||
|
|
||
| [Automation rules](https://docs.readthedocs.io/en/stable/automation-rules.html) are used to: | ||
|
|
||
| * Build a version of the documentation for each branch in the standard repository | ||
| * Delete a version when a branch is deleted | ||
|
|
||
| Each time you push a commit to a branch, Read the Docs builds the version for that branch. In addition to the versions for each branch, there is also: | ||
|
|
||
| * A `latest` version that redirects to the `0.1` branch. | ||
| * A `stable` version that redirects to the most recent release. | ||
| * A version for each [tag](https://github.com/Open-Telecoms-Data/open-fibre-data-standard/tags) in the standard repository, e.g. `0__1__0__beta`. | ||
|
|
||
| Only the `latest` version is available in the [flyout menu](https://docs.readthedocs.io/en/stable/glossary.html#term-flyout-menu). To view other versions, substitute the branch name into the URL, as follows: | ||
|
|
||
| ``` | ||
| https://open-fibre-data-standard.readthedocs.io/en/branch-name/ | ||
| ``` |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is out of date - there are 3 now. test_examples_json.py is new.
I'd suggest a better approach is to point to the the tests directory on GitHub and we'll make sure there are docstrings/comments there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a string be added a the top of each file with a summary of what the tests cover (like the bullet points below)?
Based on experience from OCDS, we can't expect analysts to be able to read a Python file and understand what is tested so we should provide some higher-level documentation.