Skip to content

Commit 9e1e8eb

Browse files
chore: Use nightly toolchain for check (apache#445)
* chore: Use nightly toolchain for check * Fix check * Fix clippy finds * Make rustfmt happy * Make rustfmt happy * Update github actions * Use action builder since apache doesn't allow external actions * Fix comments * Fix README.md
1 parent 48f9e3e commit 9e1e8eb

File tree

9 files changed

+262
-193
lines changed

9 files changed

+262
-193
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# This file is heavily inspired by
19+
# [datafusion](https://github.com/apache/datafusion/blob/main/.github/actions/setup-builder/action.yaml).
20+
name: Prepare Rust Builder
21+
description: 'Prepare Rust Build Environment'
22+
inputs:
23+
rust-version:
24+
description: 'version of rust to install (e.g. stable)'
25+
required: true
26+
default: 'stable'
27+
runs:
28+
using: "composite"
29+
steps:
30+
- name: Setup Rust toolchain
31+
shell: bash
32+
run: |
33+
echo "Installing ${{ inputs.rust-version }}"
34+
rustup toolchain install ${{ inputs.rust-version }}
35+
rustup default ${{ inputs.rust-version }}
36+
rustup component add rustfmt clippy
37+
- name: Fixup git permissions
38+
# https://github.com/actions/checkout/issues/766
39+
shell: bash
40+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

.github/workflows/ci.yml

+21-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ concurrency:
2929
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
3030
cancel-in-progress: true
3131

32+
env:
33+
rust_msrv: "1.77.1"
34+
3235
jobs:
3336
check:
3437
runs-on: ubuntu-latest
@@ -38,6 +41,12 @@ jobs:
3841
- name: Check License Header
3942
uses: apache/skywalking-eyes/[email protected]
4043

44+
- name: Install cargo-sort
45+
run: make install-cargo-sort
46+
47+
- name: Install taplo-cli
48+
run: make install-taplo-cli
49+
4150
- name: Cargo format
4251
run: make check-fmt
4352

@@ -63,8 +72,14 @@ jobs:
6372
- windows-latest
6473
steps:
6574
- uses: actions/checkout@v4
75+
76+
- name: Setup Rust toolchain
77+
uses: ./.github/actions/setup-builder
78+
with:
79+
rust-version: ${{ env.rust_msrv }}
80+
6681
- name: Build
67-
run: cargo build
82+
run: make build
6883

6984
build_with_no_default_features:
7085
runs-on: ${{ matrix.os }}
@@ -84,6 +99,11 @@ jobs:
8499
steps:
85100
- uses: actions/checkout@v4
86101

102+
- name: Setup Rust toolchain
103+
uses: ./.github/actions/setup-builder
104+
with:
105+
rust-version: ${{ env.rust_msrv }}
106+
87107
- name: Test
88108
run: cargo test --no-fail-fast --all-targets --all-features --workspace
89109

.github/workflows/publish.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ on:
2121
push:
2222
tags:
2323
- '*'
24-
pull_request:
25-
branches:
26-
- main
27-
paths:
28-
- ".github/workflows/publish.yml"
2924
workflow_dispatch:
3025

26+
env:
27+
rust_msrv: "1.77.1"
28+
3129
jobs:
3230
publish:
3331
runs-on: ubuntu-latest
@@ -42,9 +40,11 @@ jobs:
4240
- "crates/catalog/rest"
4341
steps:
4442
- uses: actions/checkout@v4
45-
- name: Dryrun ${{ matrix.package }}
46-
working-directory: ${{ matrix.package }}
47-
run: cargo publish --all-features --dry-run
43+
44+
- name: Setup Rust toolchain
45+
uses: ./.github/actions/setup-builder
46+
with:
47+
rust-version: ${{ env.rust_msrv }}
4848

4949
- name: Publish ${{ matrix.package }}
5050
working-directory: ${{ matrix.package }}

Makefile

+16-13
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,37 @@
1717

1818
.EXPORT_ALL_VARIABLES:
1919

20-
RUST_LOG = debug
21-
2220
build:
23-
cargo build
21+
cargo build --all-targets --all-features --workspace
2422

2523
check-fmt:
26-
cargo fmt --all -- --check
24+
cargo fmt --all -- --check
2725

2826
check-clippy:
29-
cargo clippy --all-targets --all-features --workspace -- -D warnings
27+
cargo clippy --all-targets --all-features --workspace -- -D warnings
28+
29+
install-cargo-sort:
30+
cargo install [email protected]
3031

31-
cargo-sort:
32-
cargo install cargo-sort
32+
cargo-sort: install-cargo-sort
3333
cargo sort -c -w
3434

35-
cargo-machete:
35+
install-cargo-machete:
3636
cargo install cargo-machete
37+
38+
cargo-machete: install-cargo-machete
3739
cargo machete
3840

39-
fix-toml:
40-
cargo install taplo-cli --locked
41+
install-taplo-cli:
42+
cargo install [email protected]
43+
44+
fix-toml: install-taplo-cli
4145
taplo fmt
4246

43-
check-toml:
44-
cargo install taplo-cli --locked
47+
check-toml: install-taplo-cli
4548
taplo check
4649

47-
check: check-fmt check-clippy cargo-sort check-toml
50+
check: check-fmt check-clippy cargo-sort check-toml cargo-machete
4851

4952
doc-test:
5053
cargo test --no-fail-fast --doc --all-features --workspace

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ The Apache Iceberg Rust project is composed of the following components:
5757
[iceberg-catalog-rest link]: https://crates.io/crates/iceberg-catalog-rest
5858
[iceberg-catalog-rest release docs]: https://docs.rs/iceberg-catalog-rest
5959

60+
## Supported Rust Version
61+
62+
Iceberg Rust is built and tested with stable rust, and will keep a rolling MSRV(minimum supported rust version). The
63+
current MSRV is 1.77.1.
64+
65+
Also, we use unstable rust to run linters, such as `clippy` and `rustfmt`. But this will not affect downstream users,
66+
and only MSRV is required.
67+
68+
6069
## Contribute
6170

6271
Apache Iceberg is an active open-source project, governed under the Apache Software Foundation (ASF). We are always open to people who want to use or contribute to it. Here are some ways to get involved.

0 commit comments

Comments
 (0)