Skip to content

Commit

Permalink
Test only oldest and newest supported Python
Browse files Browse the repository at this point in the history
Add formatting (pre-commit) test
Run unit tests
Test build docs
  • Loading branch information
gemenerik committed Oct 25, 2024
1 parent 7fea839 commit 51b06e9
Showing 1 changed file with 45 additions and 8 deletions.
53 changes: 45 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,27 @@ on:
pull_request: # to register the in-branch workflow

jobs:
define-matrix:
verify:
name: Check code formatting and run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install pre-commit
run: pip install pre-commit
- name: Check code formatting
run: pre-commit run --all-files
- name: Install test requirements
run: pip install pytest setuptools
- name: Run tests
run : python3 -m unittest discover test

define-python-version-matrix:
needs: verify
runs-on: ubuntu-latest

outputs:
Expand All @@ -15,44 +35,61 @@ jobs:
- name: Define supported Python versions
id: python-version
run: |
echo 'python-version=["3.10", "3.11", "3.12", "3.13"]' >> "$GITHUB_OUTPUT"
echo 'python-version=["3.10", "3.13"]' >> "$GITHUB_OUTPUT"
build:
needs: define-matrix
needs: define-python-version-matrix
runs-on: [ubuntu-latest]
strategy:
matrix:
python-version: ${{ fromJSON(needs.define-matrix.outputs.python-version) }}
python-version: ${{ fromJSON(needs.define-python-version-matrix.outputs.python-version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install build
- run: python -m build

pip-install:
needs: define-matrix
needs: define-python-version-matrix
runs-on: [ubuntu-latest]
strategy:
matrix:
python-version: ${{ fromJSON(needs.define-matrix.outputs.python-version) }}
python-version: ${{ fromJSON(needs.define-python-version-matrix.outputs.python-version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install build
- run: pip install .

pip-editable-install:
needs: define-matrix
needs: define-python-version-matrix
runs-on: [ubuntu-latest]
strategy:
matrix:
python-version: ${{ fromJSON(needs.define-matrix.outputs.python-version) }}
python-version: ${{ fromJSON(needs.define-python-version-matrix.outputs.python-version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install build
- run: pip install -e .

build-docs:
needs: verify
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: install cflib
run: pip install .
- name: install pdoc3
run: pip install pdoc3
- name: build docs
run: pdoc3 docs/api/template

0 comments on commit 51b06e9

Please sign in to comment.