Skip to content

Commit

Permalink
chore: Use nightly toolchain for check (#445)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
liurenjie1024 authored Jul 9, 2024
1 parent 48f9e3e commit 9e1e8eb
Show file tree
Hide file tree
Showing 9 changed files with 262 additions and 193 deletions.
40 changes: 40 additions & 0 deletions .github/actions/setup-builder/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# This file is heavily inspired by
# [datafusion](https://github.com/apache/datafusion/blob/main/.github/actions/setup-builder/action.yaml).
name: Prepare Rust Builder
description: 'Prepare Rust Build Environment'
inputs:
rust-version:
description: 'version of rust to install (e.g. stable)'
required: true
default: 'stable'
runs:
using: "composite"
steps:
- name: Setup Rust toolchain
shell: bash
run: |
echo "Installing ${{ inputs.rust-version }}"
rustup toolchain install ${{ inputs.rust-version }}
rustup default ${{ inputs.rust-version }}
rustup component add rustfmt clippy
- name: Fixup git permissions
# https://github.com/actions/checkout/issues/766
shell: bash
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

env:
rust_msrv: "1.77.1"

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

- name: Install cargo-sort
run: make install-cargo-sort

- name: Install taplo-cli
run: make install-taplo-cli

- name: Cargo format
run: make check-fmt

Expand All @@ -63,8 +72,14 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: ${{ env.rust_msrv }}

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

build_with_no_default_features:
runs-on: ${{ matrix.os }}
Expand All @@ -84,6 +99,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: ${{ env.rust_msrv }}

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

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ on:
push:
tags:
- '*'
pull_request:
branches:
- main
paths:
- ".github/workflows/publish.yml"
workflow_dispatch:

env:
rust_msrv: "1.77.1"

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -42,9 +40,11 @@ jobs:
- "crates/catalog/rest"
steps:
- uses: actions/checkout@v4
- name: Dryrun ${{ matrix.package }}
working-directory: ${{ matrix.package }}
run: cargo publish --all-features --dry-run

- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: ${{ env.rust_msrv }}

- name: Publish ${{ matrix.package }}
working-directory: ${{ matrix.package }}
Expand Down
29 changes: 16 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,37 @@

.EXPORT_ALL_VARIABLES:

RUST_LOG = debug

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

check-fmt:
cargo fmt --all -- --check
cargo fmt --all -- --check

check-clippy:
cargo clippy --all-targets --all-features --workspace -- -D warnings
cargo 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

cargo-machete:
install-cargo-machete:
cargo install cargo-machete

cargo-machete: install-cargo-machete
cargo machete

fix-toml:
cargo install taplo-cli --locked
install-taplo-cli:
cargo install [email protected]

fix-toml: install-taplo-cli
taplo fmt

check-toml:
cargo install taplo-cli --locked
check-toml: install-taplo-cli
taplo check

check: check-fmt check-clippy cargo-sort check-toml
check: check-fmt check-clippy cargo-sort check-toml cargo-machete

doc-test:
cargo test --no-fail-fast --doc --all-features --workspace
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ The Apache Iceberg Rust project is composed of the following components:
[iceberg-catalog-rest link]: https://crates.io/crates/iceberg-catalog-rest
[iceberg-catalog-rest release docs]: https://docs.rs/iceberg-catalog-rest

## Supported Rust Version

Iceberg Rust is built and tested with stable rust, and will keep a rolling MSRV(minimum supported rust version). The
current MSRV is 1.77.1.

Also, we use unstable rust to run linters, such as `clippy` and `rustfmt`. But this will not affect downstream users,
and only MSRV is required.


## Contribute

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.
Expand Down
Loading

0 comments on commit 9e1e8eb

Please sign in to comment.