Skip to content
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

Always install correct version of rust in CI #14992

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 7 additions & 8 deletions .github/actions/setup-builder/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@

name: Prepare Rust Builder
description: 'Prepare Rust Build Environment'
inputs:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only ever called with stable so the parameter is unecessary

rust-version:
description: 'version of rust to install (e.g. stable)'
required: true
default: 'stable'
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to checkout the code in the builder setup to get the rust-toolchain.toml file

with:
submodules: true
fetch-depth: 1
- name: Install Build Dependencies
shell: bash
run: |
Expand All @@ -36,9 +35,9 @@ runs:
# rustfmt is needed for the substrait build script
run: |
RETRY=("ci/scripts/retry" timeout 120)
echo "Installing ${{ inputs.rust-version }}"
"${RETRY[@]}" rustup toolchain install ${{ inputs.rust-version }}
"${RETRY[@]}" rustup default ${{ inputs.rust-version }}
echo "Installing Rust ..."
# install toolchain specified by rust-toolchain.toml
"${RETRY[@]}" rustup toolchain install
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now this installs the version of rust specified by rust-toolchain.toml

"${RETRY[@]}" rustup component add rustfmt
- name: Configure rust runtime env
uses: ./.github/actions/setup-rust-runtime
Expand Down
13 changes: 5 additions & 8 deletions .github/actions/setup-macos-aarch64-builder/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@

name: Prepare Rust Builder for MacOS
description: 'Prepare Rust Build Environment for MacOS'
inputs:
rust-version:
description: 'version of rust to install (e.g. stable)'
required: true
default: 'stable'
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
- name: Install protobuf compiler
shell: bash
run: |
Expand All @@ -39,9 +38,7 @@ runs:
- name: Setup Rust toolchain
shell: bash
run: |
rustup update stable
rustup toolchain install stable
rustup default stable
rustup toolchain install
rustup component add rustfmt
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
Expand Down
14 changes: 6 additions & 8 deletions .github/actions/setup-macos-builder/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@

name: Prepare Rust Builder for MacOS
description: 'Prepare Rust Build Environment for MacOS'
inputs:
rust-version:
description: 'version of rust to install (e.g. stable)'
required: true
default: 'stable'
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
- name: Install protobuf compiler
shell: bash
run: |
Expand All @@ -39,9 +38,8 @@ runs:
- name: Setup Rust toolchain
shell: bash
run: |
rustup update stable
rustup toolchain install stable
rustup default stable
# install version of rust in rust-toolchain.toml
rustup toolchain install
rustup component add rustfmt
- name: Configure rust runtime env
uses: ./.github/actions/setup-rust-runtime
29 changes: 13 additions & 16 deletions .github/workflows/extended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ concurrency:
#
# We still run them as they provide important coverage to ensure correctness
# in the (very rare) event of a hash failure or sqlite library query failure.
on:
push:

# TEMP for testing
on: [push, pull_request]
# on:
# push:

jobs:
# Check crate compiles and base cargo check passes
Expand All @@ -41,13 +44,10 @@ jobs:
with:
submodules: true
fetch-depth: 1
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup default stable
- name: Install Protobuf Compiler
run: sudo apt-get install -y protobuf-compiler
- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: stable
- name: Prepare cargo build
run: |
cargo check --profile ci --all-targets
Expand All @@ -65,13 +65,10 @@ jobs:
fetch-depth: 1
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup default stable
- name: Install Protobuf Compiler
run: sudo apt-get install -y protobuf-compiler
- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: stable
# For debugging, test binaries can be large.
- name: Show available disk space
run: |
Expand Down
5 changes: 4 additions & 1 deletion dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ test_source_distribution() {

# build and test rust

# install the needed version of rust defined in rust-toolchain.toml
rustup toolchain install

# raises on any formatting errors
rustup component add rustfmt --toolchain stable
rustup component add rustfmt
cargo fmt --all -- --check

# Clone testing repositories into the expected location
Expand Down
Loading