Skip to content

---

--- #118

Workflow file for this run

# Run all tests, linters, code analysis and other QA tasks on
# every push to master and PRs.
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- '*'
# To SSH into the runner to debug a failure, add the following step before
# the failing step
# - uses: lhotari/action-upterm@v1
# with:
# limit-access-to-actor: true
# Prevent multiple jobs running after fast subsequent pushes
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test_312:
name: "Python 3.12 Tests"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/nix-shell
with:
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Run linters and unit tests
run: |
nix-shell --run "make lint all=true"
nix-shell --run "make types"
nix-shell --run "make unit"
- name: Run tests for the singlefile example
run: |
cd examples/singlefile
nix-shell --run "python -m unittest app.py"
- name: Run tests for the todoapp example
run: |
cd examples/todoapp
nix-shell --run "python -m unittest tests.py"
- name: Run tests for the splitfile example
run: |
cd examples/splitfile
nix-shell --run "python -m unittest tests.py"
- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: htmlcov
path: htmlcov/
test_310:
name: "Python 3.10 Tests"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/nix-shell
with:
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Run linters and unit tests
run: |
nix-shell --run "PYTHON=python3.10 make lint all=true"
nix-shell --run "PYTHON=python3.10 make types"
nix-shell --run "PYTHON=python3.10 make unit"
- name: Run tests for the singlefile example
run: |
cd examples/singlefile
nix-shell --run "python3.10 -m unittest app.py"
- name: Run tests for the todoapp example
run: |
cd examples/todoapp
nix-shell --run "python3.10 -m unittest tests.py"
- name: Run tests for the splitfile example
run: |
cd examples/splitfile
nix-shell --run "python3.10 -m unittest tests.py"
- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: htmlcov-py310
path: htmlcov/
release:
name: "Release to PyPI"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [test_312, test_310]
runs-on: ubuntu-22.04
# To test publishing to testpypi:
# * change version in pyproject.toml to 0.16.1-alpha.1 or similar
# * uncomment POETRY_REPOSITORIES_TESTPYPI_URL and POETRY_PYPI_TOKEN_TESTPYPI
# * append `-r testpypi` to poetry publish command
# * `git ci && git tag 0.16.1-alpha.1 && git push --tags`
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
# POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.POETRY_PYPI_TOKEN_TESTPYPI }}
# POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/nix-shell
with:
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: verify git tag matches pyproject.toml version
run: |
echo "$GITHUB_REF_NAME"
POETRY_VERSION=$(nix-shell --run "poetry version --short")
echo $POETRY_VERSION
[[ "$GITHUB_REF_NAME" == "$POETRY_VERSION" ]] && exit 0 || exit 1
- run: nix-shell --run "poetry publish --build"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
make_latest: true