]> git.k1024.org Git - pyxattr.git/blob - .github/workflows/ci.yml
CI: Bump cache key version
[pyxattr.git] / .github / workflows / ci.yml
1 on:
2   # Trigger the workflow on push or
3   # pull request, but only for the
4   # master branch.
5   push:
6     branches:
7       - master
8   pull_request:
9     branches:
10       - master
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 jobs:
20   build:
21     name: Build and test
22     runs-on: ${{ matrix.os }}
23     strategy:
24       matrix:
25         os: [ubuntu-22.04, macos-12]
26         python-version:
27           - '3.7'
28           - '3.8'
29           - '3.9'
30           - '3.10'
31           - 'pypy-3.7'
32           - 'pypy-3.8'
33           - 'pypy-3.9'
34       fail-fast: false
35
36     steps:
37       - name: Checkout
38         uses: actions/checkout@v2
39
40       - name: Set up Python ${{ matrix.python-version }}
41         uses: actions/setup-python@v2
42         with:
43           python-version: ${{ matrix.python-version }}
44
45       - name: Cache pip
46         uses: actions/cache@v2
47         with:
48           # This path is specific to Ubuntu
49           path: ~/.cache/pip
50           # Look to see if there is a cache hit for the corresponding requirements file
51           key: v2-pip-${{ runner.os }}-${{ matrix.python-version }}
52           restore-keys: |
53             v2-pip-${{ runner.os }}
54             v2-pip-
55
56       - name: Install dependencies
57         run: |
58           pip install pytest
59           pip install codecov
60           pip install sphinx
61           pip install recommonmark
62
63       - name: Install typing for old Python
64         run: pip install typing
65         if: matrix.installTyping
66
67       - name: Build the code
68         run: python ./setup.py build_ext -i
69
70       - name: Run tests
71         run: python -m pytest tests
72
73       - name: Cleanup
74         run: make clean
75
76       - name: Re-build with coverage info
77         run: CFLAGS="-coverage" python ./setup.py build_ext -i
78
79       - name: Test with coverage
80         run: python -m pytest tests
81
82       - name: Upload coverage to Codecov
83         uses: codecov/codecov-action@v1
84         with:
85           #files: ./coverage1.xml,./coverage2.xml
86           #directory: ./coverage/reports/
87           #flags: unittests
88           #env_vars: OS,PYTHON
89           name: codecov-python-${{ matrix.python-version }}
90           #fail_ci_if_error: true
91           path_to_write_report: ./codecov-report.txt
92           #verbose: true
93
94       - name: Archive code coverage result
95         uses: 'actions/upload-artifact@v2'
96         with:
97           name: code-coverage-${{ matrix.os }}-${{ matrix.python-version }}
98           path: codecov-report.txt
99
100       - name: Build documentation
101         run: make doc