-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the CI and release process to use github actions (#5)
* test: added nox for multi-version testing * test: added safety for version security checking * chore: updated and rationalised dependencies * chore: remove no longer used readthedocs config * ci: initial github actions test config * ci: scrub travis configuration * ci: try a different github action/nox config * doc: update README tests badge * ci: updated range of versions we test against * chore: set up for python-semantic-release * ci: added all the github actions for release etc * ci: fix action references to use master branch * ci: apparently you can you relative workflow references * ci: fix linter (from gh_release repo) * chore: fix linter errors
- Loading branch information
Showing
22 changed files
with
916 additions
and
359 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
name: Generate documentation | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
generate_docs: | ||
name: Generate documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up repository | ||
uses: nigelm/gh_actions_python_poetry_setup@v1 | ||
with: | ||
python-version: 3.10.2 | ||
poetry-version: 1.1.12 | ||
# needs fetch-depth to be set due to gh pages push | ||
fetch-depth: 0 | ||
|
||
- name: Setup Git Commit Info | ||
run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
|
||
- name: Publish docs | ||
run: poetry run mkdocs gh-deploy | ||
|
||
# end |
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,16 @@ | ||
name: Run Complete Tests | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
full_tests: | ||
runs-on: ubuntu-latest | ||
name: NOX test run | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: excitedleigh/[email protected] | ||
- run: pip install poetry==1.1.12 | ||
- run: nox | ||
|
||
# end |
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,44 @@ | ||
name: Lint | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
lint: | ||
name: Run Linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.2 | ||
|
||
- name: Load cached pre-commit installation | ||
id: cached-pre-comit-install | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/venv | ||
~/.cache/pre-commit | ||
key: precommit-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-pre-comit-install.outputs.cache-hit != 'true' | ||
run: | | ||
python -m venv ~/venv | ||
source ~/venv/bin/activate | ||
pip install --upgrade pip | ||
pip install pre-commit | ||
shell: bash | ||
|
||
- name: Run pre-commit set | ||
run: | | ||
source ~/venv/bin/activate | ||
pre-commit run --all-files | ||
shell: bash | ||
|
||
# end |
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,20 @@ | ||
name: Run Tests | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
name: Run Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up repository | ||
uses: nigelm/gh_actions_python_poetry_setup@v1 | ||
with: | ||
python-version: 3.10.2 | ||
poetry-version: 1.1.12 | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
# end |
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,25 @@ | ||
name: Upload To Pypi | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
PYPI_TOKEN: | ||
description: The pypi token to use for authentication | ||
required: true | ||
|
||
jobs: | ||
upload: | ||
name: Upload To Pypi | ||
runs-on: ubuntu-latest | ||
environment: deployment | ||
steps: | ||
- name: Set up repository | ||
uses: nigelm/gh_actions_python_poetry_setup@v1 | ||
with: | ||
python-version: 3.10.2 | ||
poetry-version: 1.1.12 | ||
|
||
- run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | ||
- run: poetry publish --build --repository pypi | ||
|
||
# end |
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,25 @@ | ||
# basic set of tests | ||
name: Deploy | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
tests: | ||
uses: ./.github/workflows/_test.yml | ||
lint: | ||
uses: ./.github/workflows/_linting.yml | ||
|
||
upload: | ||
needs: [tests, lint] | ||
uses: ./.github/workflows/_upload.yml | ||
secrets: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
|
||
docs: | ||
needs: [tests, lint] | ||
uses: ./.github/workflows/_docs.yml | ||
|
||
|
||
# end |
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,40 @@ | ||
name: Overall Release Process | ||
on: workflow_dispatch | ||
jobs: | ||
tests: | ||
uses: ./.github/workflows/_test.yml | ||
lint: | ||
uses: ./.github/workflows/_linting.yml | ||
full_test: | ||
needs: [tests, lint] | ||
uses: ./.github/workflows/_full_tests.yml | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
concurrency: release | ||
needs: full_test | ||
environment: deployment | ||
|
||
steps: | ||
- name: Set up repository | ||
uses: nigelm/gh_actions_python_poetry_setup@v1 | ||
with: | ||
python-version: 3.10.2 | ||
poetry-version: 1.1.12 | ||
# needs fetch-depth to be set due to release history deduction | ||
fetch-depth: 0 | ||
token: ${{ secrets.GH_DEPLOY_TOKEN }} | ||
|
||
#---------------------------------------------- | ||
# release | ||
#---------------------------------------------- | ||
- name: Semantic Release | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_DEPLOY_TOKEN }} | ||
run: | | ||
# source .venv/bin/activate | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
poetry run semantic-release publish | ||
# end |
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,11 @@ | ||
# basic set of tests | ||
name: Tests | ||
on: push | ||
|
||
jobs: | ||
lint: | ||
uses: ./.github/workflows/_linting.yml | ||
tests: | ||
uses: ./.github/workflows/_test.yml | ||
|
||
# end |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,29 @@ | ||
# noxfile.py | ||
import tempfile | ||
|
||
import nox | ||
|
||
|
||
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"]) | ||
def tests(session): | ||
session.run("poetry", "install", external=True) | ||
session.run("pytest") | ||
|
||
|
||
@nox.session(python="3.8") | ||
def safety(session): | ||
with tempfile.NamedTemporaryFile() as requirements: | ||
session.run( | ||
"poetry", | ||
"export", | ||
"--dev", | ||
"--format=requirements.txt", | ||
"--without-hashes", | ||
f"--output={requirements.name}", | ||
external=True, | ||
) | ||
session.install("safety") | ||
session.run("safety", "check", f"--file={requirements.name}", "--full-report") | ||
|
||
|
||
# end |
Oops, something went wrong.