]> git.k1024.org Git - pyxattr.git/blob - .github/workflows/ci.yml
Allow triggering workflows runs manually
[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: v1-pip-${{ runner.os }}-${{ matrix.python-version }}
52           restore-keys: |
53             v1-pip-${{ runner.os }}
54             v1-pip-
55
56       - name: Install dependencies
57         run: |
58           pip install pytest
59           pip install codecov
60
61       - name: Install typing for old Python
62         run: pip install typing
63         if: matrix.installTyping
64
65       - name: Build the code
66         run: python ./setup.py build_ext -i
67
68       - name: Run tests
69         run: python -m pytest tests
70
71       - name: Cleanup
72         run: make clean
73
74       - name: Re-build with coverage info
75         run: CFLAGS="-coverage" python ./setup.py build_ext -i
76
77       - name: Test with coverage
78         run: python -m pytest tests
79
80       - name: Upload coverage to Codecov
81         uses: codecov/codecov-action@v1
82         with:
83           #files: ./coverage1.xml,./coverage2.xml
84           #directory: ./coverage/reports/
85           #flags: unittests
86           #env_vars: OS,PYTHON
87           name: codecov-python-${{ matrix.python-version }}
88           #fail_ci_if_error: true
89           path_to_write_report: ./codecov-report.txt
90           #verbose: true
91
92       - name: Archive code coverage result
93         uses: 'actions/upload-artifact@v2'
94         with:
95           name: code-coverage-${{ matrix.os }}-${{ matrix.python-version }}
96           path: codecov-report.txt