-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (107 loc) · 4.23 KB
/
ci.yml
File metadata and controls
124 lines (107 loc) · 4.23 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
name: GitHub-hosted
on:
push:
branches: [master, main]
pull_request:
env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
llvm: 20
python: "3.12"
runtime_cxx_standard: 17
- os: ubuntu-24.04
llvm: 21
python: "3.13"
runtime_cxx_standard: 20
- os: ubuntu-24.04
llvm: 21
python: "3.14"
runtime_cxx_standard: 20
- os: macos-15
llvm: 20
python: "3.12"
runtime_cxx_standard: 20
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / LLVM ${{ matrix.llvm }} / Py ${{ matrix.python }} / C++${{ matrix.runtime_cxx_standard }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{ matrix.llvm }} main" \
| sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update
sudo apt-get install -y \
llvm-${{ matrix.llvm }}-dev \
libclang-${{ matrix.llvm }}-dev \
clang-${{ matrix.llvm }} \
libpolly-${{ matrix.llvm }}-dev \
libboost-dev libeigen3-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install llvm@${{ matrix.llvm }} boost eigen
- name: pip install CppJIT
run: |
pip install pytest numpy psutil
pip install numba || true
pip install . -v --config-settings=cmake.define.LLVM_DIR=${{
runner.os == 'macOS'
&& format('/opt/homebrew/opt/llvm@{0}/lib/cmake/llvm', matrix.llvm)
|| format('/usr/lib/llvm-{0}/lib/cmake/llvm', matrix.llvm)
}}
- name: Build test dictionaries
run: make -j4
working-directory: test
- name: Run tests
run: python -m pytest -ra --tb=short -q 2>&1 | tee ../test-output.txt
working-directory: test
env:
CPPINTEROP_EXTRA_INTERPRETER_ARGS: "-std=c++${{ matrix.runtime_cxx_standard }}"
- name: Upload result
if: always()
uses: actions/upload-artifact@v4
with:
name: result-${{ matrix.os }}-llvm${{ matrix.llvm }}-py${{ matrix.python }}-cpp${{ matrix.runtime_cxx_standard }}
path: test-output.txt
report:
if: always() && github.event_name == 'pull_request'
needs: build-and-test
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: result-*
- uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const marker = '<!-- cppjit-ci -->';
const rows = fs.readdirSync('.').filter(d => d.startsWith('result-')).sort().map(d => {
const cfg = d.replace('result-', '');
const file = `${d}/test-output.txt`;
const lines = fs.existsSync(file) ? fs.readFileSync(file, 'utf8').trim().split('\n') : [];
const result = lines.length ? lines.at(-1) : 'no output';
return `| ${cfg} | \`${result}\` |`;
});
const body = [marker, '## Test Results', '| Configuration | Result |', '|---|---|', ...rows].join('\n');
const { data: comments } = await github.rest.issues.listComments({
...context.repo, issue_number: context.issue.number,
});
const existing = comments.find(c => c.body.startsWith(marker));
if (existing) {
await github.rest.issues.updateComment({ ...context.repo, comment_id: existing.id, body });
} else {
await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body });
}