forked from aegis/pyserveX
65 lines
1.8 KiB
YAML
65 lines
1.8 KiB
YAML
name: Run Tests
|
|
run-name: ${{ gitea.actor }} started tests
|
|
on:
|
|
push:
|
|
branches: ["dev", "master", "main"]
|
|
pull_request:
|
|
branches: ["dev", "master", "main"]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.12', '3.13']
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libpcre2-dev
|
|
|
|
- name: Setup Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
version: latest
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: poetry install --with dev
|
|
|
|
- name: Build Cython extensions
|
|
run: poetry run python scripts/build_cython.py build_ext --inplace
|
|
|
|
- name: Run tests
|
|
run: poetry run pytest tests/ -v
|
|
|
|
- name: Run tests with coverage
|
|
run: poetry run pytest tests/ -v --cov=pyserve --cov-report=xml --cov-report=term
|
|
|
|
- name: Upload coverage to artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage-report-${{ matrix.python-version }}
|
|
path: coverage.xml
|
|
|
|
- name: Tests completed
|
|
run: echo "All tests passed successfully on Python ${{ matrix.python-version }}!"
|