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