Skip to content

Updated project to use cargo without building rustc #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 31, 2025
Merged
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
6 changes: 2 additions & 4 deletions .github/actions/with-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ runs:
--interactive \
--tty \
--detach \
--workdir /home/user \
-v ${PWD}:${PWD} \
--workdir ${PWD} \
${TAG}

docker cp . ${CONTAINER_NAME}:/home/user
docker exec ${CONTAINER_NAME} chown -R user:user /home/user
38 changes: 11 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,18 @@ jobs:
- name: "Set up nightly Rust" # https://github.com/rust-lang/rustup/issues/3409
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-08-28
toolchain: nightly-2024-11-29 # Hardcoded version, same as smir_pretty

- name: 'Set up tree for rust dependency of smir_pretty'
run: make smir-pretty-setup

- name: 'Cache smir_pretty and rustc'
uses: Swatinem/rust-cache@v2
with:
workspaces: |
deps/smir_pretty
deps/smir_pretty/deps/rust/src
cache-directories: |
deps/smir_pretty/deps/rust/src/build
- name: 'remove override'
run: |
cd deps/smir_pretty
rustup override unset
rustup override unset --nonexistent
rustup toolchain uninstall smir_pretty | echo "rustup toolchain uninstall smir_pretty: FAILED"
rustup toolchain remove smir_pretty | echo "rustup toolchain remove smir_pretty: FAILED"

- name: 'Build smir_pretty and its rustc dependency'
run: | # rustc bootstrap checks this and refuses stage 1 in "CI"
export GITHUB_ACTIONS="in denial" && \
echo "GITHUB_ACTIONS = ${GITHUB_ACTIONS}" && \
- name: 'Build smir_pretty'
run: |
make smir-pretty

- name: 'Set up Docker'
Expand All @@ -119,18 +113,8 @@ jobs:
- name: 'Build kmir (within docker)'
run: docker exec --user user mir-smir-ci-${GITHUB_SHA} make build

- name: 'HACK: patch rustc_arch.sh script (within docker)'
run: |
arch=$(rustc -vV | sed -n -e 's/host: \(.*\)$/\1/p')
docker exec --user user mir-smir-ci-${GITHUB_SHA} \
bash -c "printf '#!/bin/sh\necho \"$arch\"\n' > deps/smir_pretty/rustc_arch.sh"
docker exec --user user mir-smir-ci-${GITHUB_SHA} \
cat deps/smir_pretty/rustc_arch.sh
docker exec --user user mir-smir-ci-${GITHUB_SHA} \
deps/smir_pretty/rustc_arch.sh

- name: 'Run parser tests (within docker)'
run: docker exec --user user mir-smir-ci-${GITHUB_SHA} make smir-parse-tests
run: make smir-parse-tests POETRY_RUN='docker exec --user user mir-smir-ci-${GITHUB_SHA} poetry -C kmir run'

- name: 'Tear down Docker'
if: always()
Expand Down
21 changes: 5 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,13 @@ build: kmir
##################################################
# for integration tests: build smir_pretty in-tree

##################################################
# This will change when we set up rustc as a submodule in smir_pretty
smir-pretty-setup: deps/smir_pretty/deps/rust/src

deps/smir_pretty/deps/rust/src:
cd deps/smir_pretty && make setup

##################################################

smir-pretty: smir-pretty-setup deps/smir_pretty/target/debug/smir_pretty

deps/smir_pretty/target/debug/smir_pretty: deps/smir_pretty
cd deps/smir_pretty && make build_all
smir-pretty:
cd deps/smir_pretty && cargo build

# generate smir and parse given test files (from parameter or run-rs subdirectory)
smir-parse-tests: TESTS = $(shell find kmir/src/tests/integration/data/run-rs -type f -name "*.rs")
smir-parse-tests: SMIR = deps/smir_pretty/run.sh
smir-parse-tests: build smir-pretty
smir-parse-tests: TESTS = $(shell find $(PWD)/kmir/src/tests/integration/data/run-rs -type f -name "*.rs")
smir-parse-tests: SMIR = cargo -Z unstable-options -C deps/smir_pretty run --
smir-parse-tests:
errors=""; \
report() { echo $$2; errors="$$errors $$1"; }; \
for source in ${TESTS}; do \
Expand Down
2 changes: 1 addition & 1 deletion deps/smir_pretty
2 changes: 1 addition & 1 deletion kmir/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kmir"
version = "0.3.66"
version = "0.3.67"
description = ""
authors = [
"Runtime Verification, Inc. <contact@runtimeverification.com>",
Expand Down
2 changes: 1 addition & 1 deletion kmir/src/kmir/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from typing import Final

VERSION: Final = '0.3.66'
VERSION: Final = '0.3.67'
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.66
0.3.67