From 3d00e678c5bd243b400a8e057a44e765760cb39f Mon Sep 17 00:00:00 2001 From: Stevengre Date: Thu, 5 Mar 2026 23:29:32 +0800 Subject: [PATCH 1/2] ci(stable-mir-ui): add manual workflow for UI test runs Add workflow_dispatch-only GitHub Actions workflow that: - Checks out rust-lang/rust at the pinned commit - Builds kmir in Docker and runs test-stable-mir-ui - Supports test-filter, timeout, and update-skip inputs - Uploads proof show output on failure and updated skip.txt --- .github/workflows/test-stable-mir-ui.yml | 86 ++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/test-stable-mir-ui.yml diff --git a/.github/workflows/test-stable-mir-ui.yml b/.github/workflows/test-stable-mir-ui.yml new file mode 100644 index 000000000..5976e0b55 --- /dev/null +++ b/.github/workflows/test-stable-mir-ui.yml @@ -0,0 +1,86 @@ +name: 'Stable MIR UI Tests' +on: + workflow_dispatch: + inputs: + test-filter: + description: 'Passed as -k to pytest (empty = all tests)' + type: string + default: '' + update-skip: + description: 'Enable --update-skip mode to shrink skip.txt' + type: boolean + default: false + timeout: + description: 'Per-test timeout in seconds' + type: string + default: '300' + +jobs: + stable-mir-ui-tests: + name: 'Stable MIR UI Tests' + runs-on: [self-hosted, linux, normal] + steps: + - name: 'Check out code' + uses: actions/checkout@v4 + with: + token: ${{ secrets.JENKINS_GITHUB_PAT }} + submodules: recursive + + - name: 'Check out Rust repo' + uses: actions/checkout@v4 + with: + repository: rust-lang/rust + ref: a2545fd6fc66b4323f555223a860c451885d1d2b + path: rust + fetch-depth: 1 + + - name: 'Set up Docker' + uses: ./.github/actions/with-docker + with: + container-name: mir-ui-ci-${{ github.sha }} + + - name: 'Copy Rust repo into container' + run: docker cp rust mir-ui-ci-${GITHUB_SHA}:/home/github-user/workspace/rust + + - name: 'Build kmir' + run: docker exec --user github-user mir-ui-ci-${GITHUB_SHA} make build + + - name: 'Build TEST_ARGS' + id: test-args + env: + INPUT_FILTER: ${{ inputs.test-filter }} + INPUT_TIMEOUT: ${{ inputs.timeout }} + INPUT_UPDATE_SKIP: ${{ inputs.update-skip }} + run: | + ARGS="--timeout=${INPUT_TIMEOUT}" + if [ -n "${INPUT_FILTER}" ]; then + ARGS="${ARGS} -k \"${INPUT_FILTER}\"" + fi + if [ "${INPUT_UPDATE_SKIP}" = "true" ]; then + ARGS="${ARGS} --update-skip" + fi + echo "args=${ARGS}" >> "$GITHUB_OUTPUT" + + - name: 'Run stable-mir-ui tests' + run: | + docker exec --user github-user mir-ui-ci-${GITHUB_SHA} \ + bash -c "RUST_DIR_ROOT=rust make test-stable-mir-ui TEST_ARGS='${{ steps.test-args.outputs.args }}'" + + - name: 'Upload proof artifacts on failure' + if: failure() + uses: actions/upload-artifact@v4 + with: + name: proof-show-output + path: /tmp/pytest-*/**/show.txt + if-no-files-found: ignore + + - name: 'Upload updated skip.txt' + if: inputs.update-skip + uses: actions/upload-artifact@v4 + with: + name: updated-skip-txt + path: kmir/src/tests/external/data/stable-mir-ui/skip.txt + + - name: 'Tear down Docker' + if: always() + run: docker stop --time 0 mir-ui-ci-${GITHUB_SHA} From 7d0641d271f08568880fea4b16045e1c3a451d25 Mon Sep 17 00:00:00 2001 From: Stevengre Date: Fri, 6 Mar 2026 12:46:24 +0800 Subject: [PATCH 2/2] 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. --- .github/actions/with-docker/action.yml | 3 ++ .github/workflows/Dockerfile | 5 +- .github/workflows/test-stable-mir-ui.yml | 69 ++++++++++++++++++------ 3 files changed, 59 insertions(+), 18 deletions(-) diff --git a/.github/actions/with-docker/action.yml b/.github/actions/with-docker/action.yml index 4768fc740..a4f6b589c 100644 --- a/.github/actions/with-docker/action.yml +++ b/.github/actions/with-docker/action.yml @@ -17,6 +17,8 @@ runs: TAG=runtimeverificationinc/${CONTAINER_NAME} K_COMMIT=$(grep -Po '[0-9.]+' ./deps/k_release) UV_VERSION=$(cat deps/uv_release) + RUST_TOOLCHAIN=$(sed -nE 's/^channel = "([^"]+)"/\1/p' rust-toolchain.toml) + test -n "${RUST_TOOLCHAIN}" USER=github-user GROUP=${USER} @@ -30,6 +32,7 @@ runs: --build-arg GROUP=${GROUP} \ --build-arg USER_ID=${USER_ID} \ --build-arg GROUP_ID=${GROUP_ID} \ + --build-arg RUST_TOOLCHAIN=${RUST_TOOLCHAIN} \ --build-arg UV_VERSION=${UV_VERSION} docker run \ diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile index fabcdd03a..54cc1ad44 100644 --- a/.github/workflows/Dockerfile +++ b/.github/workflows/Dockerfile @@ -10,13 +10,14 @@ ARG USER=user ARG GROUP ARG USER_ID=1000 ARG GROUP_ID=1000 +ARG RUST_TOOLCHAIN=nightly-2024-11-29 RUN groupadd -g ${GROUP_ID} ${GROUP} && useradd -m -u ${USER_ID} -s /bin/sh -g ${GROUP} ${USER} USER ${USER}:${GROUP} ENV PATH="/home/${USER}/.cargo/bin:${PATH}" RUN curl https://sh.rustup.rs -sSf | bash -s -- -y -RUN rustup toolchain install nightly-2024-11-29 --component llvm-tools --component rustc-dev --component rust-src -RUN rustup default nightly-2024-11-29-x86_64-unknown-linux-gnu +RUN rustup toolchain install ${RUST_TOOLCHAIN} --component llvm-tools --component rustc-dev --component rust-src +RUN rustup default ${RUST_TOOLCHAIN} RUN mkdir /home/${USER}/workspace WORKDIR /home/${USER}/workspace diff --git a/.github/workflows/test-stable-mir-ui.yml b/.github/workflows/test-stable-mir-ui.yml index 5976e0b55..71fa8a40d 100644 --- a/.github/workflows/test-stable-mir-ui.yml +++ b/.github/workflows/test-stable-mir-ui.yml @@ -19,6 +19,8 @@ jobs: stable-mir-ui-tests: name: 'Stable MIR UI Tests' runs-on: [self-hosted, linux, normal] + env: + CONTAINER_NAME: mir-ui-ci-${{ github.sha }} steps: - name: 'Check out code' uses: actions/checkout@v4 @@ -37,50 +39,85 @@ jobs: - name: 'Set up Docker' uses: ./.github/actions/with-docker with: - container-name: mir-ui-ci-${{ github.sha }} + container-name: ${{ env.CONTAINER_NAME }} - name: 'Copy Rust repo into container' - run: docker cp rust mir-ui-ci-${GITHUB_SHA}:/home/github-user/workspace/rust + run: docker cp rust ${{ env.CONTAINER_NAME }}:/home/github-user/workspace/rust + + - name: 'Build stable-mir-json' + run: docker exec --user github-user ${{ env.CONTAINER_NAME }} make stable-mir-json - name: 'Build kmir' - run: docker exec --user github-user mir-ui-ci-${GITHUB_SHA} make build + run: docker exec --user github-user ${{ env.CONTAINER_NAME }} make build - - name: 'Build TEST_ARGS' - id: test-args + - name: 'Run stable-mir-ui tests' env: INPUT_FILTER: ${{ inputs.test-filter }} INPUT_TIMEOUT: ${{ inputs.timeout }} INPUT_UPDATE_SKIP: ${{ inputs.update-skip }} run: | - ARGS="--timeout=${INPUT_TIMEOUT}" + test_args=(--timeout="${INPUT_TIMEOUT}") if [ -n "${INPUT_FILTER}" ]; then - ARGS="${ARGS} -k \"${INPUT_FILTER}\"" + test_args+=(-k "${INPUT_FILTER}") fi if [ "${INPUT_UPDATE_SKIP}" = "true" ]; then - ARGS="${ARGS} --update-skip" + test_args+=(--update-skip) fi - echo "args=${ARGS}" >> "$GITHUB_OUTPUT" + printf -v test_args_escaped '%q ' "${test_args[@]}" + docker exec --user github-user \ + --env RUST_DIR_ROOT=rust \ + ${{ env.CONTAINER_NAME }} \ + make test-stable-mir-ui "TEST_ARGS=${test_args_escaped}" - - name: 'Run stable-mir-ui tests' + - name: 'Copy proof artifacts from container' + if: failure() run: | - docker exec --user github-user mir-ui-ci-${GITHUB_SHA} \ - bash -c "RUST_DIR_ROOT=rust make test-stable-mir-ui TEST_ARGS='${{ steps.test-args.outputs.args }}'" + rm -rf .github-artifacts/proof-artifacts + mkdir -p .github-artifacts/proof-artifacts + docker exec --user github-user ${{ env.CONTAINER_NAME }} bash -lc ' + set -euo pipefail + artifact_dir=/home/github-user/workspace/.github-artifacts/proof-artifacts + rm -rf "$artifact_dir" + mkdir -p "$artifact_dir" + find /tmp -type f \( -name show.txt -o -path "*/smir.json" \) -print0 | while IFS= read -r -d "" path; do + case_dir="$(dirname "$path")" + if [ "$(basename "$path")" = "smir.json" ]; then + case_dir="$(dirname "$case_dir")" + fi + rel="${case_dir#/tmp/}" + dest="$artifact_dir/$rel" + rm -rf "$dest" + mkdir -p "$(dirname "$dest")" + cp -R "$case_dir" "$dest" + done + ' + docker cp ${{ env.CONTAINER_NAME }}:/home/github-user/workspace/.github-artifacts/proof-artifacts/. .github-artifacts/proof-artifacts/ || true - name: 'Upload proof artifacts on failure' if: failure() uses: actions/upload-artifact@v4 with: - name: proof-show-output - path: /tmp/pytest-*/**/show.txt + name: proof-artifacts + path: .github-artifacts/proof-artifacts if-no-files-found: ignore + - name: 'Copy updated skip.txt from container' + if: ${{ always() && inputs.update-skip }} + run: | + rm -rf .github-artifacts/update-skip + mkdir -p .github-artifacts/update-skip + docker cp \ + ${{ env.CONTAINER_NAME }}:/home/github-user/workspace/kmir/src/tests/external/data/stable-mir-ui/skip.txt \ + .github-artifacts/update-skip/skip.txt || true + - name: 'Upload updated skip.txt' if: inputs.update-skip uses: actions/upload-artifact@v4 with: name: updated-skip-txt - path: kmir/src/tests/external/data/stable-mir-ui/skip.txt + path: .github-artifacts/update-skip/skip.txt + if-no-files-found: ignore - name: 'Tear down Docker' if: always() - run: docker stop --time 0 mir-ui-ci-${GITHUB_SHA} + run: docker stop --time 0 ${{ env.CONTAINER_NAME }}