File: ci.yml

package info (click to toggle)
python-apischema 0.18.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,636 kB
  • sloc: python: 15,281; makefile: 3; sh: 2
file content (71 lines) | stat: -rw-r--r-- 2,183 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: CI

on:
  push:
    branches:
      - master
      - v[0-9]*.*
    paths:
      - apischema/**
      - examples/**
      - scripts/**
      - tests/**
  pull_request:
    paths:
      - apischema/**
      - examples/**
      - scripts/**
      - tests/**

jobs:
  test:
    name: Test ${{ matrix.python-version }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev', 'pypy-3.9', 'pypy-3.10']
        include:
          - python-version: '3.12'
            pytest-args: --cov=apischema --cov-branch --cov-report=xml --cov-report=html
    steps:
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install requirements
        run: pip install -r tests/requirements.txt
      - name: Generate tests from documentation example
        run: scripts/generate_tests_from_examples.py
      - name: Run tests
        run: pytest tests ${{ matrix.pytest-args }}
      - uses: codecov/codecov-action@v4
        # https://github.community/t/run-step-if-file-exists/16445/3
        if: hashFiles('coverage.xml') != ''
      - uses: actions/upload-artifact@v4
        if: hashFiles('coverage.xml') != ''
        with:
          name: coverage
          path: |
            coverage.xml
            htmlcov
      - name: Cythonize
        run: scripts/cythonize.sh
        if: matrix.python-version != 'pypy-3.9' && matrix.python-version != 'pypy-3.10'
      - name: Compile
        run: pip install -e .
        if: matrix.python-version != 'pypy-3.9' && matrix.python-version != 'pypy-3.10'
      - name: Run tests (compiled)
        run: pytest tests
        if: matrix.python-version != 'pypy-3.9' && matrix.python-version != 'pypy-3.10'

concurrency:
  group: ci-${{ github.head_ref }}
  cancel-in-progress: true