-
Notifications
You must be signed in to change notification settings - Fork 2
146 lines (142 loc) · 5.8 KB
/
Copy pathunictest.yaml
File metadata and controls
146 lines (142 loc) · 5.8 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: unictest (e2e)
run-name: unictest
on:
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
list-shards:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
shards: ${{ steps.list.outputs.shards }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: List shards
id: list
working-directory: rebrgen
# One shard per (runner, option set) so multi-option runners (ebm2rust,
# ebm2go, ebm2ts) fan out instead of running every option set serially.
run: echo "shards=$(python script/list_unictest_shards.py)" >>
"$GITHUB_OUTPUT"
unictest-shard:
needs: list-shards
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
shard: ${{ fromJSON(needs.list-shards.outputs.shards) }}
steps:
# Runtime CI/CD security sensor (eBPF EDR). Must be the first step so it
# observes all subsequent dependency installs / test execution.
# Pinned to a commit SHA; pre-release, so bump deliberately.
- name: CI/CD runtime sensor
uses: cicd-sensor/cicd-sensor-action@6511eb44c91d71b2b93d71193b1bf2cb18352f66 # v0.0.38
- name: Timeline
uses: Kesin11/actions-timeline@57fc93f20c6da7fbc14063c6d24a2a5627c799ad # v3.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@23bc15cd4207e45f1566447deb48f4ff3ef932cb # v2.3
with:
version: latest
platform: x64
- name: Install libc++-dev and libc++abi-dev
run: sudo apt-get install libc++-dev libc++abi-dev -y
- name: Resolve runner dir
id: runner
shell: bash
run: |
for sub in ebmcg ebmip; do
d="rebrgen/src/$sub/${{ matrix.shard.runner }}"
if [ -d "$d" ]; then
echo "path=$d" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "runner dir not found for ${{ matrix.shard.runner }}" >&2; exit 1
- name: Install mise
if: hashFiles(format('{0}/mise.toml', steps.runner.outputs.path)) != ''
uses: jdx/mise-action@3c2e0cf82a5b2e5249f0d3635a4d83d0ae861518 # v4.2.5
with:
working_directory: ${{ steps.runner.outputs.path }}
install: false
- name: Download rebrgen tool
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: rebrgen-native-tool
path: rebrgen/tool
- name: Download brgen tool
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: brgen-linux-llvm
path: .
- name: Install runner deps
working-directory: rebrgen
run: python script/setup_runner_deps.py ${{ matrix.shard.runner }}
- name: Test
# Matrix values are passed via env (not interpolated into the script) to
# avoid shell-injection and to handle an empty option set cleanly.
env:
RUNNER: ${{ matrix.shard.runner }}
OPTION_SET: ${{ matrix.shard.option_set }}
run: |
export LD_LIBRARY_PATH=$(pwd)/tool:$(pwd)/rebrgen/tool:$LD_LIBRARY_PATH
cp ./tool/libs2j.so ./rebrgen/tool/libs2j.so
chmod -R +x tool/
cd rebrgen
chmod -R +x tool/
cp build_config.template.json build_config.json
opt_args=()
if [ -n "$OPTION_SET" ]; then
opt_args=(--target-option-set "$OPTION_SET")
fi
python script/unictest.py --print-stdout --target-runner "$RUNNER" "${opt_args[@]}" --parallel-limit 0 --output-json test_results.json || true
- name: Upload shard result
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v8.0.0
with:
# option_set is part of the name so a runner's per-option-set shards
# produce distinct artifacts; the merge job globs all of them. Empty
# option set (single-shard runners) falls back to "all".
name: unictest-shard-${{ matrix.shard.runner }}-${{ matrix.shard.option_set || 'all' }}
path: rebrgen/test_results.json
unictest-merge:
needs: unictest-shard
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Timeline
uses: Kesin11/actions-timeline@57fc93f20c6da7fbc14063c6d24a2a5627c799ad # v3.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download shard results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: unictest-shard-*
path: shards
- name: Merge results
run: |
mkdir -p test_results
python rebrgen/script/merge_unictest_results.py shards test_results/test_results.json
cp script/unictest_result.html test_results/index.html
cp script/unictest_history.html test_results/history.html
- name: Render job summary
run: |
python rebrgen/script/render_unictest_summary.py \
--results test_results/test_results.json \
--out "$GITHUB_STEP_SUMMARY"
- name: Upload test results
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v8.0.0
with:
name: unictest-results
path: test_results/