Revision aac966357d2773e1e08b0249d37ab80ca81925c3 authored by Jochen Kupperschmidt on 02 January 2026, 14:41:16 UTC, committed by Jochen Kupperschmidt on 02 January 2026, 14:41:16 UTC
1 parent eb5a403
test.yml
name: Test
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- '*.rst'
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- '*.rst'
# Allow manual workflow triggering from the "Actions" tab.
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Make accessible on localhost.
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Make accessible on localhost.
- 6379:6379
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv and Python
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ matrix.python-version }}
- name: Install project
run: uv sync --frozen --only-group test
- name: Test with pytest and coverage
env:
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
PYTEST_ADDOPTS: "--color=yes"
run: |
uv run coverage run --source=byceps -m pytest tests
- name: Generate XML output from test coverage
if: github.repository == 'byceps/byceps' && github.ref_name == 'main'
run: |
uv run coverage xml
- name: Upload coverage to Qlty
uses: qltysh/qlty-action/coverage@v1
if: github.repository == 'byceps/byceps' && github.ref_name == 'main'
with:
oidc: true
files: coverage.xml
- name: Post result to Discord
# Run job even if build is cancelled.
if: always() && github.repository == 'byceps/byceps' && github.ref_name == 'main'
env:
JOB_RESULT: ${{ job.status }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: uv run ./.github/workflows/send-workflow-result-to-discord.py --result $JOB_RESULT --webhook-url $DISCORD_WEBHOOK_URL

Computing file changes ...