Skip to content

Commit

Permalink
ci: Upload artifacts created by libc-test
Browse files Browse the repository at this point in the history
This gives us something that is easier to look at when the automatically
generated tests fail.
  • Loading branch information
tgross35 committed Dec 7, 2024
1 parent fc3234f commit f494bd4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,23 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh

- name: Run natively
if: "!matrix.docker"
run: ./ci/run.sh ${{ matrix.target }}
- name: Run in Docker
if: "matrix.docker"
run: ./ci/run-docker.sh ${{ matrix.target }}

- name: Create CI artifacts
if: always()
run: ./ci/create-artifacts.sh
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}
path: ${{ env.ARCHIVE_PATH }}
retention-days: 5

test_tier2:
name: Test tier2
needs: [test_tier1, style_check]
Expand Down Expand Up @@ -132,9 +142,19 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh

- name: Execute run-docker.sh
run: ./ci/run-docker.sh ${{ matrix.target }}

- name: Create CI artifacts
if: always()
run: ./ci/create-artifacts.sh
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}
path: ${{ env.ARCHIVE_PATH }}
retention-days: 5

test_tier2_vm:
name: Test tier2 VM
needs: [test_tier1, style_check]
Expand Down
23 changes: 23 additions & 0 deletions ci/create-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

set -eux

# Create a tarball of intermediate output for inspection if tests fail.

# Find the most recently touched file named "main.c" in the target directory.
# This will be libc-tests's `OUT_DIR`
out_dir="$(
find target -name 'main.c' -exec ls -t {} + |
head -n1 |
xargs dirname
)"

out_name="archive-$(date -u -Iseconds | sed 's/://g')"
(cd "$out_dir" && find -E . -regex '.*\.(rs|c)')") > file_list.txt
tar -czvf "${out_name}.tar.gz" -C "$out_dir" -T file_list.txt
if [ -n "$CI" ]; then
echo "ARCHIVE_NAME=${out_name}" >> "$GITHUB_ENV"
echo "ARCHIVE_PATH=${out_name}.tar.gz" >> "$GITHUB_ENV"
fi

0 comments on commit f494bd4

Please sign in to comment.