mirror of
https://github.com/cyclotruc/gitingest.git
synced 2026-04-28 09:59:32 +00:00
78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
|
|
include:
|
|
- os: ubuntu-latest
|
|
python-version: "3.13"
|
|
coverage: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Locate pip cache
|
|
id: pip-cache
|
|
shell: bash
|
|
run: echo "dir=$(python -m pip cache dir)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Cache pip
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
|
|
restore-keys: ${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install ".[dev]"
|
|
|
|
- name: Run tests
|
|
if: ${{ matrix.coverage != true }}
|
|
run: pytest
|
|
|
|
- name: Run tests and collect coverage
|
|
if: ${{ matrix.coverage == true }}
|
|
run: |
|
|
pytest \
|
|
--cov=gitingest \
|
|
--cov=server \
|
|
--cov-branch \
|
|
--cov-report=xml \
|
|
--cov-report=term
|
|
|
|
- name: Upload coverage to Codecov
|
|
if: ${{ matrix.coverage == true }}
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: coverage.xml
|
|
flags: ${{ matrix.os }}-py${{ matrix.python-version }}
|
|
name: codecov-${{ matrix.os }}-${{ matrix.python-version }}
|
|
fail_ci_if_error: true
|
|
verbose: true
|
|
|
|
- name: Run pre-commit hooks
|
|
uses: pre-commit/action@v3.0.1
|
|
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
|