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