Skip to content

Commit da00075

Browse files
committed
Add always updating report for results
1 parent 8b56f29 commit da00075

1 file changed

Lines changed: 66 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Linux x86_64
1+
name: GitHub-hosted
22

33
on:
44
push:
@@ -18,15 +18,21 @@ jobs:
1818
llvm: 20
1919
python: "3.12"
2020
runtime_cxx_standard: 17
21+
- os: ubuntu-24.04
22+
llvm: 21
23+
python: "3.13"
24+
runtime_cxx_standard: 20
2125
- os: ubuntu-24.04
2226
llvm: 21
2327
python: "3.14"
2428
runtime_cxx_standard: 20
29+
- os: macos-15
30+
llvm: 20
31+
python: "3.12"
32+
runtime_cxx_standard: 20
2533

2634
runs-on: ${{ matrix.os }}
27-
name: LLVM ${{ matrix.llvm }} / Python ${{ matrix.python }} / C++${{ matrix.runtime_cxx_standard }}
28-
permissions:
29-
pull-requests: write
35+
name: ${{ matrix.os }} / LLVM ${{ matrix.llvm }} / Py ${{ matrix.python }} / C++${{ matrix.runtime_cxx_standard }}
3036

3137
steps:
3238
- uses: actions/checkout@v4
@@ -35,7 +41,8 @@ jobs:
3541
with:
3642
python-version: ${{ matrix.python }}
3743

38-
- name: Install LLVM ${{ matrix.llvm }}
44+
- name: Install dependencies (Linux)
45+
if: runner.os == 'Linux'
3946
run: |
4047
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
4148
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" \
@@ -47,15 +54,20 @@ jobs:
4754
clang-${{ matrix.llvm }} \
4855
libpolly-${{ matrix.llvm }}-dev \
4956
libboost-dev libeigen3-dev
50-
sudo apt-get install -y python${{ matrix.python }}-dev || true
57+
58+
- name: Install dependencies (macOS)
59+
if: runner.os == 'macOS'
60+
run: brew install llvm@${{ matrix.llvm }} boost eigen
5161

5262
- name: pip install CppJIT
5363
run: |
54-
pip install pytest numba numpy psutil
55-
pip install . -v \
56-
--config-settings=cmake.define.LLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm
57-
env:
58-
CMAKE_BUILD_PARALLEL_LEVEL: "4"
64+
pip install pytest numpy psutil
65+
pip install numba || true
66+
pip install . -v --config-settings=cmake.define.LLVM_DIR=${{
67+
runner.os == 'macOS'
68+
&& format('/opt/homebrew/opt/llvm@{0}/lib/cmake/llvm', matrix.llvm)
69+
|| format('/usr/lib/llvm-{0}/lib/cmake/llvm', matrix.llvm)
70+
}}
5971
6072
- name: Build test dictionaries
6173
run: make -j4
@@ -67,11 +79,46 @@ jobs:
6779
env:
6880
CPPINTEROP_EXTRA_INTERPRETER_ARGS: "-std=c++${{ matrix.runtime_cxx_standard }}"
6981

70-
- name: Post results to PR
71-
if: always() && github.event_name == 'pull_request'
72-
run: |
73-
summary=$(tail -1 test-output.txt)
74-
gh pr comment ${{ github.event.pull_request.number }} \
75-
--body "**LLVM ${{ matrix.llvm }} / Python ${{ matrix.python }} / C++${{ matrix.runtime_cxx_standard }}**: \`${summary}\`"
76-
env:
77-
GH_TOKEN: ${{ github.token }}
82+
- name: Upload result
83+
if: always()
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: result-${{ matrix.os }}-llvm${{ matrix.llvm }}-py${{ matrix.python }}-cpp${{ matrix.runtime_cxx_standard }}
87+
path: test-output.txt
88+
89+
report:
90+
if: always() && github.event_name == 'pull_request'
91+
needs: build-and-test
92+
runs-on: ubuntu-latest
93+
permissions:
94+
pull-requests: write
95+
steps:
96+
- uses: actions/download-artifact@v4
97+
with:
98+
pattern: result-*
99+
100+
- uses: actions/github-script@v7
101+
with:
102+
script: |
103+
const fs = require('fs');
104+
const marker = '<!-- cppjit-ci -->';
105+
106+
const rows = fs.readdirSync('.').filter(d => d.startsWith('result-')).sort().map(d => {
107+
const cfg = d.replace('result-', '');
108+
const file = `${d}/test-output.txt`;
109+
const lines = fs.existsSync(file) ? fs.readFileSync(file, 'utf8').trim().split('\n') : [];
110+
const result = lines.length ? lines.at(-1) : 'no output';
111+
return `| ${cfg} | \`${result}\` |`;
112+
});
113+
114+
const body = [marker, '## Test Results', '| Configuration | Result |', '|---|---|', ...rows].join('\n');
115+
const { data: comments } = await github.rest.issues.listComments({
116+
...context.repo, issue_number: context.issue.number,
117+
});
118+
const existing = comments.find(c => c.body.startsWith(marker));
119+
120+
if (existing) {
121+
await github.rest.issues.updateComment({ ...context.repo, comment_id: existing.id, body });
122+
} else {
123+
await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body });
124+
}

0 commit comments

Comments
 (0)