Skip to content

Commit f494bd4

Browse files
committed
ci: Upload artifacts created by libc-test
This gives us something that is easier to look at when the automatically generated tests fail.
1 parent fc3234f commit f494bd4

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,23 @@ jobs:
8181
- uses: actions/checkout@v4
8282
- name: Setup Rust toolchain
8383
run: ./ci/install-rust.sh
84+
8485
- name: Run natively
8586
if: "!matrix.docker"
8687
run: ./ci/run.sh ${{ matrix.target }}
8788
- name: Run in Docker
8889
if: "matrix.docker"
8990
run: ./ci/run-docker.sh ${{ matrix.target }}
9091

92+
- name: Create CI artifacts
93+
if: always()
94+
run: ./ci/create-artifacts.sh
95+
- uses: actions/upload-artifact@v4
96+
with:
97+
name: ${{ env.ARCHIVE_NAME }}
98+
path: ${{ env.ARCHIVE_PATH }}
99+
retention-days: 5
100+
91101
test_tier2:
92102
name: Test tier2
93103
needs: [test_tier1, style_check]
@@ -132,9 +142,19 @@ jobs:
132142
- uses: actions/checkout@v4
133143
- name: Setup Rust toolchain
134144
run: ./ci/install-rust.sh
145+
135146
- name: Execute run-docker.sh
136147
run: ./ci/run-docker.sh ${{ matrix.target }}
137148

149+
- name: Create CI artifacts
150+
if: always()
151+
run: ./ci/create-artifacts.sh
152+
- uses: actions/upload-artifact@v4
153+
with:
154+
name: ${{ env.ARCHIVE_NAME }}
155+
path: ${{ env.ARCHIVE_PATH }}
156+
retention-days: 5
157+
138158
test_tier2_vm:
139159
name: Test tier2 VM
140160
needs: [test_tier1, style_check]

ci/create-artifacts.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
# Create a tarball of intermediate output for inspection if tests fail.
6+
7+
# Find the most recently touched file named "main.c" in the target directory.
8+
# This will be libc-tests's `OUT_DIR`
9+
out_dir="$(
10+
find target -name 'main.c' -exec ls -t {} + |
11+
head -n1 |
12+
xargs dirname
13+
)"
14+
15+
out_name="archive-$(date -u -Iseconds | sed 's/://g')"
16+
(cd "$out_dir" && find -E . -regex '.*\.(rs|c)')") > file_list.txt
17+
18+
tar -czvf "${out_name}.tar.gz" -C "$out_dir" -T file_list.txt
19+
20+
if [ -n "$CI" ]; then
21+
echo "ARCHIVE_NAME=${out_name}" >> "$GITHUB_ENV"
22+
echo "ARCHIVE_PATH=${out_name}.tar.gz" >> "$GITHUB_ENV"
23+
fi

0 commit comments

Comments
 (0)