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

chore: Use nightly toolchain for check #445

Merged
merged 11 commits into from
Jul 9, 2024
38 changes: 38 additions & 0 deletions .github/actions/setup-builder/action.yml
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 file is heavily inspire by datafusion, should we add it in some place? cc @Xuanwo @Fokko

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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.

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"
28 changes: 27 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,17 @@ jobs:
- name: Check License Header
uses: apache/skywalking-eyes/[email protected]

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

- 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 @@ -61,14 +76,25 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v4

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

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

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

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

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

Expand Down
10 changes: 10 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,12 @@ jobs:
- "crates/catalog/rest"
steps:
- uses: actions/checkout@v4

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

- 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
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,27 @@
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

cargo-sort:
cargo install cargo-sort
install-cargo-sort:
cargo install [email protected]

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

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