Skip to content

chore: Use nightly toolchain for check #445

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 11 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
40 changes: 39 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

env:
rust_nightly: "nightly-2024-06-10"
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to specify this as we load rust-toolchain by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

rust_min: "1.77.1"
Copy link
Member

Choose a reason for hiding this comment

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

How about using RUST_MSRV for more clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.


jobs:
check:
runs-on: ubuntu-latest
Expand All @@ -38,6 +42,25 @@ jobs:
- name: Check License Header
uses: apache/skywalking-eyes/[email protected]

- name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_nightly }}

- name: Install cargo-sort
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-sort
version: '1.0.9'

- name: Install taplo-cli
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
version: '0.9.0'

- uses: Swatinem/rust-cache@v2

- name: Cargo format
run: make check-fmt

Expand All @@ -61,14 +84,29 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ env.rust_min }}
Copy link
Member

Choose a reason for hiding this comment

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

stable always pre-install in CI, so we don't need to setup it up.

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 is different from latest stable. This is the minimum version we support.

uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_min }}

- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build
run: make build

unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_min }}

- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --no-fail-fast --all-targets --all-features --workspace

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ on:
- ".github/workflows/publish.yml"
workflow_dispatch:


env:
rust_min: "1.77.1"

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -42,6 +46,14 @@ jobs:
- "crates/catalog/rest"
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ env.rust_min }}
Copy link
Member

Choose a reason for hiding this comment

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

The same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto.

uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_min }}

- uses: Swatinem/rust-cache@v2

- name: Dryrun ${{ matrix.package }}
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 should not run this as this will always fail except in tagging, since at that time crates depending on iceberg will fail to compile

working-directory: ${{ matrix.package }}
run: cargo publish --all-features --dry-run
Expand Down
19 changes: 8 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,23 @@

RUST_LOG = debug

RUST_NIGHTLY_CHANNEL = nightly-2024-06-10

build:
cargo build --all-targets --all-features --workspace

install-night-toolchain:
rustup toolchain install $(RUST_NIGHTLY_CHANNEL) -c rustfmt -c clippy
check-fmt:
cargo fmt --all -- --check

check-fmt: install-night-toolchain
cargo +$(RUST_NIGHTLY_CHANNEL) fmt --all -- --check
check-clippy:
cargo clippy --all-targets --all-features --workspace -- -D warnings

check-clippy: install-night-toolchain
cargo +$(RUST_NIGHTLY_CHANNEL) clippy --all-targets --all-features --workspace -- -D warnings
install-cargo-sort:
cargo install [email protected]

cargo-sort:
cargo install cargo-sort
cargo-sort: install-cargo-sort
cargo sort -c -w

install-taplo-cli:
cargo install taplo-cli --locked
cargo install taplo-cli@0.9.0

fix-toml: install-taplo-cli
taplo fmt
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# under the License.

[toolchain]
channel = "1.77.1"
channel = "nightly-2024-06-10"
components = ["rustfmt", "clippy"]