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

ci: check MSRV correctly #849

Merged
merged 16 commits into from
Jan 15, 2025
Merged

ci: check MSRV correctly #849

merged 16 commits into from
Jan 15, 2025

Conversation

xxchan
Copy link
Contributor

@xxchan xxchan commented Dec 26, 2024

Our current MSRV check in CI doesn't work at all. We only build with nightly, but didn't check it compiles with stable toolchain. (Actually it does not compile.)

This PR added the MSRV check in CI and fixed some compilation issues.

  • We used some unstable APIs.
  • Update Cargo.lock to use dependencies with proper MSRV. Use generate-lockfile -Z minimal-versions for MSRV

More background: #445 (comment)

  • In chore: Use nightly toolchain for check #445: We added both rust-toolchain.toml (nightly), and install toolchain with rust_msrv in CI using rustup default ${{ inputs.rust-version }}
  • However, rust-toolchain.toml takes precedence over rustup default. Therefore, we always use nightly, instead of rust_msrv

@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

We can verify that currently CI uses nightly, instead of rust_msrv
image

@Xuanwo
Copy link
Member

Xuanwo commented Dec 26, 2024

We can verify that currently CI uses nightly, instead of rust_msrv

Hi, it is intentional that we are using the nightly version for CI, as specified in

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

We use the nightly toolchain for formatting and linting with Clippy.

For more context: #440

@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

I know we want to use nighty for fmt and check. But we should use msrv for build.

And we don't need to install both nighly and stable for them.

@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

Well, we can see msrv isn't working
image

@xxchan xxchan marked this pull request as ready for review December 26, 2024 15:14
@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

@Xuanwo How should we proceed? Increase MSRV and fix build, or use nightly for build, which one do you prefer?

@Xuanwo
Copy link
Member

Xuanwo commented Dec 26, 2024

I know we want to use nighty for fmt and check. But we should use msrv for build.

We currently only have msrv for iceberg. I'm not sure if our goal is to maintain msrv for all our integration crates, such as datafusion.

@Xuanwo
Copy link
Member

Xuanwo commented Dec 26, 2024

use nightly for build

This is fine since it's the version we use to develop.

@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

I know we want to use nighty for fmt and check. But we should use msrv for build.

We currently only have msrv for iceberg. I'm not sure if our goal is to maintain msrv for all our integration crates, such as datafusion.

use nightly for build

This is fine since it's the version we use to develop.

As shown above, currently msrv for iceberg isn't working too. I'm not sure whether you mean it's also a non-goal?

@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

Oh, just noticed the compilation error is indeed in datafusion.

@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

Then I think we need to separate the integration's build/test from core library in CI

@xxchan

This comment was marked as resolved.

@xxchan xxchan changed the title ci: use correct rust version ci: check MSRV correctly Dec 26, 2024
@Xuanwo
Copy link
Member

Xuanwo commented Dec 26, 2024

Hi, do we truly need an additional tool for this? I assumed it would be as straightforward as cargo +1.70 build. Also, we can use RUSTUP_TOOLCHAIN env to make it easier to play without makefile.

@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

MSRV check failed again for iceberg. I think check-in Cargo.lock (#844) is a must for MSRV check. Otherwise we can't do things like cargo update home --precise 0.5.9 to lock the dependency version

❯ cargo msrv verify
  [Meta]   cargo-msrv 0.17.0                                                                                                                                 

Compatibility Check #1: Rust 1.77.1
  [FAIL]   Is incompatible 
                                                                                                                                               
  ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
  │ error: package `home v0.5.11` cannot be built because it requires rustc 1.81 or newer, while the currently active rustc version is 1.77.1 │
  │ Either upgrade to rustc 1.81 or newer, or use                                                                                             │
  │ cargo update [email protected] --precise ver                                                                                                    │
  │ where `ver` is the latest version of `home` supporting rustc 1.77.1                                                                       │
  │                                                                                                                                           │
  ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                                                                                                                                               


Crate source was found to be incompatible with Rust version '1.77.1' specified as MSRV in the Cargo manifest located at '/Users/xxchan/Projects/iceberg-rust/crates/iceberg/Cargo.toml'%  

@Xuanwo
Copy link
Member

Xuanwo commented Dec 26, 2024

I think check-in Cargo.lock (#844) is a must for MSRV check. Otherwise we can't do things like cargo update home --precise 0.5.9 to lock the dependency version

I think we need -Z minimal-versions. We only need to protect that the version we specify in Cargo.toml works with msrv.

It's the user's own responsibility if they have higher versions in Cargo.lock; we just need to ensure we didn't impose this requirement on them. Checking Cargo.lock is not a direct solution to fix it.

(I wasn't opposed to checking Cargo.lock in, though.)

@Xuanwo Xuanwo mentioned this pull request Dec 26, 2024
@xxchan
Copy link
Contributor Author

xxchan commented Dec 26, 2024

I think we need -Z minimal-versions. We only need to protect that the version we specify in Cargo.toml works with msrv.

It doesn't work 🤪

❯ cargo  -Z minimal-versions build   
error: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel

@xxchan xxchan marked this pull request as draft December 28, 2024 04:10
@xxchan xxchan force-pushed the xxchan/varied-pinniped branch 4 times, most recently from 90fcc84 to 48f2dfd Compare January 12, 2025 14:16
@xxchan
Copy link
Contributor Author

xxchan commented Jan 12, 2025

I tried to re-generate Cargo.lock using latest MSRV-aware resolver rust-lang/cargo#14639 .

CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo +stable generate-lockfile

But it seems that it doesn't automatically find the best version for me. So I manually fixed some (mainly AWS crates) with cargo update --precise

BTW FYI that AWS SDK's MSRV is 1.81 https://github.com/awslabs/aws-sdk-rust?tab=readme-ov-file#supported-rust-versions-msrv

image

rust-version = { workspace = true }
rust-version = "1.81.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

S3 tables is a quite new package, so we can't maintain a low MSRV.

@xxchan
Copy link
Contributor Author

xxchan commented Jan 12, 2025

cc @Xuanwo

@xxchan xxchan marked this pull request as ready for review January 12, 2025 14:56
commit c51671f
Author: xxchan <[email protected]>
Date:   Thu Dec 26 23:37:42 2024 +0800

    try fix install msrv

    Signed-off-by: xxchan <[email protected]>

commit 51d0cb2
Author: xxchan <[email protected]>
Date:   Thu Dec 26 23:33:50 2024 +0800

    add separate msrv job; use nightly for default

    Signed-off-by: xxchan <[email protected]>

commit 13f430a
Author: xxchan <[email protected]>
Date:   Thu Dec 26 23:09:44 2024 +0800

    fix

    Signed-off-by: xxchan <[email protected]>

commit f2f8b3a
Author: xxchan <[email protected]>
Date:   Thu Dec 26 22:48:56 2024 +0800

    ci: use correct rust version

    Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
- downgrade faststr
- downgrade aws crates to 1.39

Signed-off-by: xxchan <[email protected]>
@xxchan xxchan force-pushed the xxchan/varied-pinniped branch from 89ceb7b to 83f2c04 Compare January 14, 2025 10:27
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
@xxchan
Copy link
Contributor Author

xxchan commented Jan 14, 2025

@Xuanwo I explored several ways to pin dependencies:

  1. Modify Cargo.lock to get it work.
    • Drawback: Need quite some manual work. And perhaps we need to disable dependabot
    • Benefit: guaranteed to work afterwards
  2. Use cargo generate-lockfile -Z minimal-versions, but it doesn't work as expected: e.g., aws-sdk-glue is specified as 1.39.0, but it generated v1.71.0 (latest: v1.76.0), which is quite strange. Dependencies resolution with --minimal-versions rust-lang/cargo#5657 (comment)
  3. Use -Z direct-minimal-versions as mentioned in the issue. It's indeed works better,
    • We need to manually specify the actual min versions in Cargo.toml. But I guess it will also work afterwards.
    • Another problem is some indirect dependencies' versions not constrained and break MSRV. I found specifying -Z direct-minimal-versions -Z minimal-versions can work..

Signed-off-by: xxchan <[email protected]>
@Xuanwo
Copy link
Member

Xuanwo commented Jan 15, 2025

Really appreciate your work here!

@xxchan
Copy link
Contributor Author

xxchan commented Jan 15, 2025

image

Oops, it still doesn't compile. I guess it's because some dependencies' failed to specify correct "min version" for their dependencies.

@Xuanwo So which approach above do you prefer? If the current way looks good, I can try to fix compilation later.

@Xuanwo
Copy link
Member

Xuanwo commented Jan 15, 2025

If the current way looks good, I can try to fix compilation later.

Current way looks really great to me.

@xxchan
Copy link
Contributor Author

xxchan commented Jan 15, 2025

@Xuanwo CI is green now!

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Perfect, thank you @xxchan for working this. Really nice!

@Xuanwo Xuanwo merged commit ae04c8a into apache:main Jan 15, 2025
18 checks passed
@xxchan xxchan deleted the xxchan/varied-pinniped branch January 15, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants