Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/with-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 \
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/test-stable-mir-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
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]
env:
CONTAINER_NAME: mir-ui-ci-${{ github.sha }}
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: ${{ env.CONTAINER_NAME }}

- name: 'Copy Rust repo into container'
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 ${{ env.CONTAINER_NAME }} make build

- name: 'Run stable-mir-ui tests'
env:
INPUT_FILTER: ${{ inputs.test-filter }}
INPUT_TIMEOUT: ${{ inputs.timeout }}
INPUT_UPDATE_SKIP: ${{ inputs.update-skip }}
run: |
test_args=(--timeout="${INPUT_TIMEOUT}")
if [ -n "${INPUT_FILTER}" ]; then
test_args+=(-k "${INPUT_FILTER}")
fi
if [ "${INPUT_UPDATE_SKIP}" = "true" ]; then
test_args+=(--update-skip)
fi
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: 'Copy proof artifacts from container'
if: failure()
run: |
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-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: .github-artifacts/update-skip/skip.txt
if-no-files-found: ignore

- name: 'Tear down Docker'
if: always()
run: docker stop --time 0 ${{ env.CONTAINER_NAME }}