Update README.md #9
This file contains hidden or 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
name: Test and Lint | |
on: | |
pull_request: # Safer than pull_request_target for untrusted code | |
branches: [ main ] | |
types: [opened, synchronize, reopened, ready_for_review, review_requested, review_request_removed] | |
push: | |
branches: [ main ] # Also run on direct pushes to main | |
jobs: | |
unit-test: | |
name: Unit Tests - Python ${{ matrix.python-version }} - ${{ matrix.env.RUNNER_OS }} | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
include: | |
# Linux | |
- os: ubuntu-latest | |
python-version: "3.10" | |
- os: ubuntu-latest | |
python-version: "3.11" | |
- os: ubuntu-latest | |
python-version: "3.12" | |
- os: ubuntu-latest | |
python-version: "3.13" | |
# Windows | |
- os: windows-latest | |
python-version: "3.10" | |
- os: windows-latest | |
python-version: "3.11" | |
- os: windows-latest | |
python-version: "3.12" | |
- os: windows-latest | |
python-version: "3.13" | |
# MacOS - latest only; not enough runners for macOS | |
- os: macos-latest | |
python-version: "3.13" | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
env: | |
LOG_LEVEL: DEBUG | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} # Explicitly define which commit to checkout | |
persist-credentials: false # Don't persist credentials for subsequent actions | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install --no-cache-dir hatch | |
- name: Run Unit tests | |
id: tests | |
run: hatch test tests --cover | |
continue-on-error: false | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
pip install --no-cache-dir hatch | |
- name: Run lint | |
id: lint | |
run: hatch run test-lint | |
continue-on-error: false |