Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
name: Test Python Package

on:
pull_request:
branches:
- main
- dev/\d+\.\d+\.\d+
types: [opened, reopened, synchronize]
paths:
- 'src/pydom/**/*.py'

permissions:
contents: read
pull-requests: read

jobs:
test:
check-changes:
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
python:
- 'src/pydom/**/*.py'

test:
needs: check-changes
if: needs.check-changes.outputs.python == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,14 +43,26 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r tests/requirements.txt

- name: Run tests
working-directory: ${{ github.workspace }}
run: |
python -m unittest discover -s tests -p 'test_*.py' -t ${{ github.workspace }}

- name: Run build test
working-directory: ${{ github.workspace }}
run: |
python -m pip install build
python -m build

tests-passed:
runs-on: ubuntu-latest
needs: [check-changes, test]
if: always()
steps:
- name: Check result
run: |
if [[ "${{ needs.test.result }}" == "success" || "${{ needs.test.result }}" == "skipped" ]]; then
echo "All good - tests passed or were not required."
else
echo "Tests failed."
exit 1
fi
Loading