-
Notifications
You must be signed in to change notification settings - Fork 3
128 lines (114 loc) · 3.83 KB
/
ci.yml
File metadata and controls
128 lines (114 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: CI
on:
push:
branches:
[main, develop, initialize, "feat/**", "fix/**", "chore/**", "perf/**"]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3.0.2
id: filter
with:
filters: |
code:
- 'include/**'
- 'src/**'
- 'tests/**'
- 'python/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'pyproject.toml'
- 'Makefile'
- '.github/workflows/ci.yml'
test:
needs: changes
if: needs.changes.outputs.code == 'true'
env:
CMAKE_POLICY_VERSION_MINIMUM: 3.5
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPILERCHECK: content
CCACHE_MAXSIZE: 2G
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Cache ccache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.ccache
key: ccache-v2-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_id }}
restore-keys: |
ccache-v2-${{ matrix.os }}-${{ matrix.python-version }}-
ccache-v2-${{ matrix.os }}-
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ccache lcov zlib1g-dev libsqlite3-dev pkg-config ninja-build
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
for f in cmake ccache lcov zlib sqlite pkg-config ninja; do
if brew list --versions "$f" >/dev/null; then
echo "$f already installed"
else
brew install "$f"
fi
done
- name: Run coverage
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest') && matrix.python-version == '3.12'
run: |
make coverage
- name: Run test (Unix)
if: "!((matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest') && matrix.python-version == '3.12')"
run: |
make test
- name: Run Python tests (with venv)
if: "!((matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest') && matrix.python-version == '3.12')"
run: |
if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.python-version }}" = "3.12" ]; then
make test-py RUN_TY=1
else
make test-py
fi
- name: Upload coverage reports to Coveralls
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest') && matrix.python-version == '3.12'
uses: coverallsapp/github-action@v2.3.6
continue-on-error: true
with:
file: coverage/coverage_filtered.info
format: lcov
flag-name: ${{ matrix.os }}
parallel: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
coverage-finish:
needs: test
if: always()
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@v2.3.6
continue-on-error: true
with:
parallel-finished: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}