]> git.k1024.org Git - pyxattr.git/blob - .github/workflows/ci.yml
Restrict MacOS builds to fewer Python versions
[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           - 'pypy-3.7'
38           - 'pypy-3.8'
39           - 'pypy-3.9-nightly'
40           - 'pypy-3.10-nightly'
41         include:
42             # Python < 3.10 is not available on macOS 14
43             - os: macos-14
44               python-version: '3.10'
45             - os: macos-14
46               python-version: '3.11'
47             - os: macos-14  
48               python-version: '3.12'
49             - os: macos-14
50               python-version: 'pypy-3.8'
51       fail-fast: false
52
53     steps:
54       - name: Checkout
55         uses: actions/checkout@v4
56
57       - name: Set up Python ${{ matrix.python-version }}
58         uses: actions/setup-python@v5
59         with:
60           python-version: ${{ matrix.python-version }}
61
62       - name: Cache pip
63         uses: actions/cache@v4
64         with:
65           # This path is specific to Ubuntu
66           path: ~/.cache/pip
67           # Look to see if there is a cache hit for the corresponding requirements file
68           key: v2-pip-${{ runner.os }}-${{ matrix.python-version }}
69           restore-keys: |
70             v2-pip-${{ runner.os }}
71             v2-pip-
72
73       - name: Install dependencies
74         run: |
75           pip install setuptools
76           pip install pytest
77           pip install sphinx
78           pip install myst-parser
79
80       - name: Build the code
81         run: python ./setup.py build_ext -i
82
83       - name: Run tests
84         run: python -m pytest tests
85
86       - name: Cleanup
87         run: make clean
88
89       - name: Re-build with coverage info
90         run: CFLAGS="-coverage" python ./setup.py build_ext -i
91
92       - name: Test with coverage
93         run: python -m pytest tests
94
95       - name: Upload coverage to Codecov
96         uses: codecov/codecov-action@v4
97         with:
98           #files: ./coverage1.xml,./coverage2.xml
99           #directory: ./coverage/reports/
100           #flags: unittests
101           #env_vars: OS,PYTHON
102           name: codecov-python-${{ matrix.python-version }}
103           token: ${{ secrets.CODECOV_TOKEN }}
104           #fail_ci_if_error: true
105           #verbose: true
106
107       - name: Build documentation
108         run: make doc