Skip to content

Commit b1830a4

Browse files
committed
ci(stable-mir-ui): fix workflow setup and artifacts
Build stable-mir-json before running the UI harness, derive the Rust toolchain from rust-toolchain.toml, and copy failure artifacts plus update-skip output back from the container before upload.
1 parent db01fe1 commit b1830a4

3 files changed

Lines changed: 59 additions & 18 deletions

File tree

.github/actions/with-docker/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ runs:
1717
TAG=runtimeverificationinc/${CONTAINER_NAME}
1818
K_COMMIT=$(grep -Po '[0-9.]+' ./deps/k_release)
1919
UV_VERSION=$(cat deps/uv_release)
20+
RUST_TOOLCHAIN=$(sed -nE 's/^channel = "([^"]+)"/\1/p' rust-toolchain.toml)
21+
test -n "${RUST_TOOLCHAIN}"
2022
2123
USER=github-user
2224
GROUP=${USER}
@@ -30,6 +32,7 @@ runs:
3032
--build-arg GROUP=${GROUP} \
3133
--build-arg USER_ID=${USER_ID} \
3234
--build-arg GROUP_ID=${GROUP_ID} \
35+
--build-arg RUST_TOOLCHAIN=${RUST_TOOLCHAIN} \
3336
--build-arg UV_VERSION=${UV_VERSION}
3437
3538
docker run \

.github/workflows/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ ARG USER=user
1010
ARG GROUP
1111
ARG USER_ID=1000
1212
ARG GROUP_ID=1000
13+
ARG RUST_TOOLCHAIN=nightly-2024-11-29
1314
RUN groupadd -g ${GROUP_ID} ${GROUP} && useradd -m -u ${USER_ID} -s /bin/sh -g ${GROUP} ${USER}
1415
USER ${USER}:${GROUP}
1516

1617
ENV PATH="/home/${USER}/.cargo/bin:${PATH}"
1718
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
18-
RUN rustup toolchain install nightly-2024-11-29 --component llvm-tools --component rustc-dev --component rust-src
19-
RUN rustup default nightly-2024-11-29-x86_64-unknown-linux-gnu
19+
RUN rustup toolchain install ${RUST_TOOLCHAIN} --component llvm-tools --component rustc-dev --component rust-src
20+
RUN rustup default ${RUST_TOOLCHAIN}
2021

2122
RUN mkdir /home/${USER}/workspace
2223
WORKDIR /home/${USER}/workspace

.github/workflows/test-stable-mir-ui.yml

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
stable-mir-ui-tests:
2020
name: 'Stable MIR UI Tests'
2121
runs-on: [self-hosted, linux, normal]
22+
env:
23+
CONTAINER_NAME: mir-ui-ci-${{ github.sha }}
2224
steps:
2325
- name: 'Check out code'
2426
uses: actions/checkout@v4
@@ -37,50 +39,85 @@ jobs:
3739
- name: 'Set up Docker'
3840
uses: ./.github/actions/with-docker
3941
with:
40-
container-name: mir-ui-ci-${{ github.sha }}
42+
container-name: ${{ env.CONTAINER_NAME }}
4143

4244
- name: 'Copy Rust repo into container'
43-
run: docker cp rust mir-ui-ci-${GITHUB_SHA}:/home/github-user/workspace/rust
45+
run: docker cp rust ${{ env.CONTAINER_NAME }}:/home/github-user/workspace/rust
46+
47+
- name: 'Build stable-mir-json'
48+
run: docker exec --user github-user ${{ env.CONTAINER_NAME }} make stable-mir-json
4449

4550
- name: 'Build kmir'
46-
run: docker exec --user github-user mir-ui-ci-${GITHUB_SHA} make build
51+
run: docker exec --user github-user ${{ env.CONTAINER_NAME }} make build
4752

48-
- name: 'Build TEST_ARGS'
49-
id: test-args
53+
- name: 'Run stable-mir-ui tests'
5054
env:
5155
INPUT_FILTER: ${{ inputs.test-filter }}
5256
INPUT_TIMEOUT: ${{ inputs.timeout }}
5357
INPUT_UPDATE_SKIP: ${{ inputs.update-skip }}
5458
run: |
55-
ARGS="--timeout=${INPUT_TIMEOUT}"
59+
test_args=(--timeout="${INPUT_TIMEOUT}")
5660
if [ -n "${INPUT_FILTER}" ]; then
57-
ARGS="${ARGS} -k \"${INPUT_FILTER}\""
61+
test_args+=(-k "${INPUT_FILTER}")
5862
fi
5963
if [ "${INPUT_UPDATE_SKIP}" = "true" ]; then
60-
ARGS="${ARGS} --update-skip"
64+
test_args+=(--update-skip)
6165
fi
62-
echo "args=${ARGS}" >> "$GITHUB_OUTPUT"
66+
printf -v test_args_escaped '%q ' "${test_args[@]}"
67+
docker exec --user github-user \
68+
--env RUST_DIR_ROOT=rust \
69+
${{ env.CONTAINER_NAME }} \
70+
make test-stable-mir-ui "TEST_ARGS=${test_args_escaped}"
6371
64-
- name: 'Run stable-mir-ui tests'
72+
- name: 'Copy proof artifacts from container'
73+
if: failure()
6574
run: |
66-
docker exec --user github-user mir-ui-ci-${GITHUB_SHA} \
67-
bash -c "RUST_DIR_ROOT=rust make test-stable-mir-ui TEST_ARGS='${{ steps.test-args.outputs.args }}'"
75+
rm -rf .github-artifacts/proof-artifacts
76+
mkdir -p .github-artifacts/proof-artifacts
77+
docker exec --user github-user ${{ env.CONTAINER_NAME }} bash -lc '
78+
set -euo pipefail
79+
artifact_dir=/home/github-user/workspace/.github-artifacts/proof-artifacts
80+
rm -rf "$artifact_dir"
81+
mkdir -p "$artifact_dir"
82+
find /tmp -type f \( -name show.txt -o -path "*/smir.json" \) -print0 | while IFS= read -r -d "" path; do
83+
case_dir="$(dirname "$path")"
84+
if [ "$(basename "$path")" = "smir.json" ]; then
85+
case_dir="$(dirname "$case_dir")"
86+
fi
87+
rel="${case_dir#/tmp/}"
88+
dest="$artifact_dir/$rel"
89+
rm -rf "$dest"
90+
mkdir -p "$(dirname "$dest")"
91+
cp -R "$case_dir" "$dest"
92+
done
93+
'
94+
docker cp ${{ env.CONTAINER_NAME }}:/home/github-user/workspace/.github-artifacts/proof-artifacts/. .github-artifacts/proof-artifacts/ || true
6895
6996
- name: 'Upload proof artifacts on failure'
7097
if: failure()
7198
uses: actions/upload-artifact@v4
7299
with:
73-
name: proof-show-output
74-
path: /tmp/pytest-*/**/show.txt
100+
name: proof-artifacts
101+
path: .github-artifacts/proof-artifacts
75102
if-no-files-found: ignore
76103

104+
- name: 'Copy updated skip.txt from container'
105+
if: ${{ always() && inputs.update-skip }}
106+
run: |
107+
rm -rf .github-artifacts/update-skip
108+
mkdir -p .github-artifacts/update-skip
109+
docker cp \
110+
${{ env.CONTAINER_NAME }}:/home/github-user/workspace/kmir/src/tests/external/data/stable-mir-ui/skip.txt \
111+
.github-artifacts/update-skip/skip.txt || true
112+
77113
- name: 'Upload updated skip.txt'
78114
if: inputs.update-skip
79115
uses: actions/upload-artifact@v4
80116
with:
81117
name: updated-skip-txt
82-
path: kmir/src/tests/external/data/stable-mir-ui/skip.txt
118+
path: .github-artifacts/update-skip/skip.txt
119+
if-no-files-found: ignore
83120

84121
- name: 'Tear down Docker'
85122
if: always()
86-
run: docker stop --time 0 mir-ui-ci-${GITHUB_SHA}
123+
run: docker stop --time 0 ${{ env.CONTAINER_NAME }}

0 commit comments

Comments
 (0)