-
Notifications
You must be signed in to change notification settings - Fork 8
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 #88 from ImperialCollegeLondon/ci
Use more rational workflows for testing and publishing
- Loading branch information
Showing
7 changed files
with
866 additions
and
673 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,9 @@ | ||
name: Test and build | ||
|
||
on: [push, pull_request, release] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
qa: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pre-commit/[email protected] | ||
|
||
check-links: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: gaurav-nelson/github-action-markdown-link-check@v1 | ||
name: Check links in markdown files | ||
with: | ||
use-quiet-mode: 'yes' | ||
use-verbose-mode: 'yes' | ||
|
||
test: | ||
needs: qa | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ windows-latest, ubuntu-latest, macos-latest ] | ||
python-version: [ "3.8", "3.9", "3.10", "3.11" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.5.1 | ||
|
||
- name: Install dependencies | ||
run: poetry install --with dev | ||
|
||
- name: Run tests | ||
run: poetry run pytest | ||
|
||
- name: Upload coverage to Codecov | ||
if: success() && (matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9) | ||
uses: codecov/codecov-action@v3 | ||
|
||
|
||
deploy-docs: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.5.1 | ||
|
||
- name: Install dependencies | ||
run: poetry install --with docs | ||
|
||
- name: Deploy Docs | ||
run: poetry run mkdocs gh-deploy --force | ||
uses: ./.github/workflows/ci_template.yml |
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,43 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
os: | ||
description: 'Operating system' | ||
default: '["ubuntu-latest", "windows-latest"]' | ||
type: string | ||
python-version: | ||
description: 'Python version' | ||
default: '["3.12"]' | ||
type: string | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ${{fromJson(inputs.os)}} | ||
python-version: ${{fromJson(inputs.python-version)}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.8.3 | ||
|
||
- name: Install dependencies | ||
run: poetry install --with dev | ||
|
||
- name: Run tests | ||
run: poetry run pytest | ||
|
||
- name: Upload coverage to Codecov | ||
if: success() && (matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9) | ||
uses: codecov/codecov-action@v3 | ||
|
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,94 @@ | ||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: write | ||
attestations: write | ||
id-token: write | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/ci_template.yml | ||
with: | ||
os: '["ubuntu-latest", "windows-latest", "macos-latest"]' | ||
python-version: '["3.9", "3.10", "3.11", "3.12"]' | ||
|
||
build-wheel: | ||
needs: test | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: hynek/build-and-inspect-python-package@v2 | ||
with: | ||
attest-build-provenance-github: true | ||
skip-wheel: true | ||
|
||
publish-docs: | ||
needs: build-wheel | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.8.3 | ||
|
||
- name: Install dependencies | ||
run: poetry install --with docs | ||
|
||
- name: Deploy Docs | ||
run: poetry run mkdocs gh-deploy --force | ||
|
||
publish-TestPyPI: | ||
needs: publish-docs | ||
name: Publish to TestPyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download packages built by build-and-inspect-python-package | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
|
||
- name: Generate artifact attestation for sdist and wheel | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-path: dist | ||
|
||
- name: Publish package distributions to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
skip-existing: true | ||
|
||
publish-PyPI: | ||
needs: publish-TestPyPI | ||
name: Publish to PyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download packages built by build-and-inspect-python-package | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
|
||
- name: Generate artifact attestation for sdist and wheel | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-path: dist | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
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.