Skip to content

Commit

Permalink
Check but don't install rust toolchain in build script
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Jun 18, 2024
1 parent e761b97 commit 002f7f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,16 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true

- name: Install Rust version
run: |
RUST_VERSION=$( \
grep '^rust-version\s*=' crates/wasi-preview1-component-adapter/Cargo.toml | \
sed 's/rust-version.*=.*\"\(.*\)\"/\1/' \
)
rustup toolchain install $RUST_VERSION --profile minimal
rustup target add wasm32-wasi wasm32-unknown-unknown --toolchain $RUST_VERSION
echo RUSTUP_TOOLCHAIN=$RUST_VERSION >> "$GITHUB_ENV"
- name: Install wasm-tools
run: |
Expand Down
18 changes: 12 additions & 6 deletions ci/build-wasi-preview1-component-adapter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ RUST_VERSION=$( \
sed 's/rust-version.*=.*\"\(.*\)\"/\1/' \
)

rustup toolchain install $RUST_VERSION --profile minimal
rustup target add wasm32-wasi wasm32-unknown-unknown --toolchain $RUST_VERSION

export RUSTUP_TOOLCHAIN=$RUST_VERSION

cargo --version
if [[ $(rustc --version | grep $RUST_VERSION | wc -c) -eq 0 ]]; then
set +x
echo "The adapter is being built with a different Rust version than its"
echo "MSRV"
echo ""
echo " current rust version: $(rustc --version)"
echo " MSRV: $RUST_VERSION"
echo ""
echo "Please rerun this script with Rust version $RUST_VERSION, or update"
echo "the adapter's MSRV in its Cargo.toml file"
exit 1
fi

# Debug build, default features (reactor)
$build_adapter
Expand Down

0 comments on commit 002f7f0

Please sign in to comment.