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