From 51b06e9d216773f1dc31370cf706507840c1e695 Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Fri, 25 Oct 2024 14:18:42 +0200 Subject: [PATCH] Test only oldest and newest supported Python Add formatting (pre-commit) test Run unit tests Test build docs --- .github/workflows/build.yml | 53 +++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3011eadc..632cf37c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -15,14 +35,14 @@ 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 @@ -30,12 +50,13 @@ jobs: 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 @@ -43,12 +64,13 @@ jobs: 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 @@ -56,3 +78,18 @@ jobs: 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