Skip to content

Run Tests

Run Tests #27

Workflow file for this run

name: Run Tests
on:
pull_request:
branches: [ main ]
workflow_run:
workflows: ["Version Bump"]
types: [completed]
permissions:
contents: read
jobs:
test:
# Only run on PRs or successful version bump completions
if: |
github.event_name == 'pull_request' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- name: Get PR details
if: github.event_name == 'workflow_run'
id: pr
env:
GH_TOKEN: ${{ github.token }}
run: |
# Get PR number from the workflow run
PR_NUMBER=$(gh api repos/${{ github.repository }}/pulls \
--jq ".[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\") | .number" \
| head -1)
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
echo "PR number: $PR_NUMBER"
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.8.25
- name: Install dependencies
run: uv sync --locked --all-extras --dev
- name: Run tests
run: uv run pytest tests -v