Fix and consolidate MSRV handling

pull/776/head
Yuri Astrakhan 11 months ago
parent f5de5d3e98
commit 04922c9a59
  1. 14
      .github/workflows/tests.yml
  2. 8
      lints/build_clippy_config.py

@ -167,15 +167,18 @@ jobs:
- run: cargo test --target i686-unknown-linux-gnu --no-default-features --features http-client-rustls-native
working-directory: ./lib/oxigraph
test_linux_msv:
test_linux_msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Read MSRV from Cargo.toml
id: metadata
run: echo "rust-version=$(sed -ne 's/rust-version *= *\"\(.*\)\"/\1/p' Cargo.toml)" >> $GITHUB_OUTPUT
- uses: ./.github/actions/setup-rust
with:
version: 1.70.0
version: ${{ steps.metadata.outputs.rust-version }}
- run: rustup toolchain install nightly
- run: rm Cargo.lock && cargo +nightly update -Z direct-minimal-versions
- run: cargo test
@ -304,15 +307,18 @@ jobs:
- run: sphinx-lint docs
working-directory: ./python
python_msv:
python_msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Read MSRV from Cargo.toml
id: metadata
run: echo "rust-version=$(sed -ne 's/rust-version *= *\"\(.*\)\"/\1/p' Cargo.toml)" >> $GITHUB_OUTPUT
- uses: ./.github/actions/setup-rust
with:
version: 1.70.0
version: ${{ steps.metadata.outputs.rust-version }}
- run: rustup toolchain install nightly
- uses: actions/setup-python@v4
with:

@ -4,7 +4,6 @@ from urllib.request import urlopen
import tomlkit
MSRV = "1.74.0"
LINT_BLACKLIST = {
"absolute_paths", # TODO: might be nice
"alloc_instead_of_core",
@ -63,6 +62,11 @@ LINT_BLACKLIST = {
"wildcard_imports", # TODO: might be nice
}
cargo_path = Path(__file__).parent.parent / "Cargo.toml"
cargo_toml = tomlkit.parse(cargo_path.read_text())
MSRV = cargo_toml["workspace"]["package"]["rust-version"]
print(f"MSRV from the root Cargo.toml: {MSRV}")
lints = set()
with urlopen(
f"https://rust-lang.github.io/rust-clippy/rust-{MSRV}/lints.json"
@ -77,7 +81,5 @@ for flag in LINT_BLACKLIST:
else:
print(f"Unused blacklisted flag: {flag}")
cargo_path = Path(__file__).parent.parent / "Cargo.toml"
cargo_toml = tomlkit.parse(cargo_path.read_text())
cargo_toml["workspace"]["lints"]["clippy"] = {lint: "warn" for lint in sorted(lints)}
cargo_path.write_text(tomlkit.dumps(cargo_toml))

Loading…
Cancel
Save