]> git.k1024.org Git - pyxattr.git/blob - .github/workflows/ci.yml
CI: also test with Python 3.13
[pyxattr.git] / .github / workflows / ci.yml
1 on:
2   # Trigger the workflow on push or
3   # pull request, but only for the
4   # main branch.
5   push:
6     branches:
7       - main
8   pull_request:
9     branches:
10       - main
11   # Allow manual triggering
12   workflow_dispatch:
13   # Weekly run to account for
14   # changed dependencies.
15   schedule:
16     - cron: '17 03 * * 0'
17
18 name: CI
19
20 permissions:  # added using https://github.com/step-security/secure-repo
21   contents: read
22
23 jobs:
24   build:
25     name: Build and test
26     runs-on: ${{ matrix.os }}
27     strategy:
28       matrix:
29         os: [ubuntu-22.04]
30         python-version:
31           - '3.7'
32           - '3.8'
33           - '3.9'
34           - '3.10'
35           - '3.11'
36           - '3.12'
37           - '3.13'
38           - 'pypy-3.7'
39           - 'pypy-3.8'
40           - 'pypy-3.9'
41           - 'pypy-3.10'
42         include:
43             # Python < 3.10 is not available on macOS 14
44             - os: macos-14
45               python-version: '3.10'
46             - os: macos-14
47               python-version: '3.11'
48             - os: macos-14
49               python-version: '3.12'
50             - os: macos-14
51               python-version: '3.13'
52             - os: macos-14
53               python-version: 'pypy-3.8'
54             - os: macos-14
55               python-version: 'pypy-3.9'
56             - os: macos-14
57               python-version: 'pypy-3.10'
58       fail-fast: false
59
60     steps:
61       - name: Checkout
62         uses: actions/checkout@v4
63
64       - name: Set up Python ${{ matrix.python-version }}
65         uses: actions/setup-python@v5
66         with:
67           python-version: ${{ matrix.python-version }}
68
69       - name: Cache pip
70         uses: actions/cache@v4
71         with:
72           # This path is specific to Ubuntu
73           path: ~/.cache/pip
74           # Look to see if there is a cache hit for the corresponding requirements file
75           key: v2-pip-${{ runner.os }}-${{ matrix.python-version }}
76           restore-keys: |
77             v2-pip-${{ runner.os }}
78             v2-pip-
79
80       - name: Install dependencies
81         run: |
82           pip install setuptools
83           pip install pytest
84           pip install sphinx
85           pip install myst-parser
86
87       - name: Build the code
88         run: python ./setup.py build_ext -i
89
90       - name: Run tests
91         run: python -m pytest tests
92
93       - name: Cleanup
94         run: make clean
95
96       - name: Re-build with coverage info
97         run: CFLAGS="-coverage" python ./setup.py build_ext -i
98
99       - name: Test with coverage
100         run: python -m pytest tests
101
102       - name: Upload coverage to Codecov
103         uses: codecov/codecov-action@v4
104         with:
105           #files: ./coverage1.xml,./coverage2.xml
106           #directory: ./coverage/reports/
107           #flags: unittests
108           #env_vars: OS,PYTHON
109           name: codecov-python-${{ matrix.python-version }}
110           token: ${{ secrets.CODECOV_TOKEN }}
111           #fail_ci_if_error: true
112           #verbose: true
113
114       - name: Build documentation
115         run: make doc