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