]> git.k1024.org Git - pylibacl.git/blob - .github/workflows/ci.yml
Allow manual CI runs
[pylibacl.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 jobs:
20   build:
21     name: Build and test
22     runs-on: ${{ matrix.os }}
23     strategy:
24       matrix:
25         os: [ubuntu-22.04]
26         python-version:
27           - '3.7'
28           - '3.8'
29           - '3.9'
30           - '3.10'
31           - '3.11'
32           - 'pypy-3.7'
33           - 'pypy-3.8'
34           - 'pypy-3.9'
35       fail-fast: true
36
37     steps:
38       - name: Checkout
39         uses: actions/checkout@v3
40
41       - name: Set up Python ${{ matrix.python-version }}
42         uses: actions/setup-python@v3
43         with:
44           python-version: ${{ matrix.python-version }}
45
46       - name: Cache pip
47         uses: actions/cache@v3
48         with:
49           # This path is specific to Ubuntu
50           path: ~/.cache/pip
51           # Look to see if there is a cache hit for the corresponding requirements file
52           key: v1-pip-${{ runner.os }}-${{ matrix.python-version }}
53           restore-keys: |
54             v1-pip-${{ runner.os }}
55             v1-pip-
56
57       - name: Install dependencies
58         run: |
59           pip install pytest
60           pip install sphinx
61           pip install myst-parser
62           sudo apt-get install -yy libacl1-dev
63
64       - name: Build the code
65         run: python ./setup.py build_ext -i
66
67       - name: Run tests
68         run: python -m pytest tests
69
70       - name: Cleanup
71         run: make clean
72
73       - name: Re-build with coverage info
74         run: CFLAGS="-coverage" python ./setup.py build_ext -i
75
76       - name: Test with coverage
77         run: python -m pytest tests
78
79       - name: Upload coverage to Codecov
80         uses: codecov/codecov-action@v3
81         with:
82           #files: ./coverage1.xml,./coverage2.xml
83           #directory: ./coverage/reports/
84           #flags: unittests
85           #env_vars: OS,PYTHON
86           name: codecov-python-${{ matrix.python-version }}
87           #fail_ci_if_error: true
88           #verbose: true
89           gcov: true
90
91       - name: Build documentation
92         run: make doc