Skip to content

Commit ad377c8

Browse files
committed
Add basic CI infrastucture
This sets up a straightforward linux job that uses system installed LLVM and runs the pip install, plus tests
1 parent f19de66 commit ad377c8

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [master, main]
7+
8+
jobs:
9+
build-and-test:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- os: ubuntu-24.04
15+
llvm: 20
16+
python: "3.12"
17+
- os: ubuntu-24.04
18+
llvm: 21
19+
python: "3.12"
20+
21+
runs-on: ${{ matrix.os }}
22+
name: LLVM ${{ matrix.llvm }} / Python ${{ matrix.python }}
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python }}
30+
31+
- name: Install LLVM ${{ matrix.llvm }}
32+
run: |
33+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
34+
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" \
35+
| sudo tee /etc/apt/sources.list.d/llvm.list
36+
sudo apt-get update
37+
sudo apt-get install -y llvm-${{ matrix.llvm }}-dev libclang-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }}
38+
39+
- name: Install Python dev headers
40+
run: sudo apt-get install -y python${{ matrix.python }}-dev || true
41+
42+
- name: pip install CppJIT
43+
run: |
44+
pip install scikit-build-core pytest
45+
pip install . --config-settings=cmake.define.LLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm -v
46+
env:
47+
CMAKE_BUILD_PARALLEL_LEVEL: "4"
48+
49+
- name: Build test dictionaries
50+
working-directory: test
51+
run: make -j4
52+
53+
- name: Run tests
54+
working-directory: test
55+
run: |
56+
python -m pytest -ra --tb=short --junitxml=../test-results.xml -q 2>&1 | tee ../test-output.txt
57+
58+
- name: Test summary
59+
if: always()
60+
run: |
61+
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
62+
echo '```' >> $GITHUB_STEP_SUMMARY
63+
tail -5 test-output.txt >> $GITHUB_STEP_SUMMARY
64+
echo '```' >> $GITHUB_STEP_SUMMARY
65+
66+
- name: Upload test results
67+
if: always()
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: test-results-llvm${{ matrix.llvm }}-py${{ matrix.python }}
71+
path: test-results.xml

0 commit comments

Comments
 (0)