mbutrovich commented on code in PR #6:
URL: https://github.com/apache/datafusion-iceberg/pull/6#discussion_r4067102802


##########
.github/actions/setup-rust/action.yml:
##########
@@ -0,0 +1,44 @@
+# 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: Setup Rust
+description: Install the Rust toolchain and optional components used by CI.
+
+inputs:
+  cache:
+    description: Restore Rust dependencies and save them on main-branch pushes.
+    required: false
+    default: "false"
+  components:
+    description: Comma-separated Rust components to install.
+    required: false
+
+runs:
+  using: composite
+  steps:
+    - name: Install Rust toolchain
+      uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4
+      with:
+        toolchain: stable

Review Comment:
   With `toolchain: stable` and `cargo clippy ... -D warnings`, every new Rust 
release can add lints that fail CI on `main` and on every open PR, even though 
none of them changed any code. DataFusion avoids this by pinning the toolchain 
in 
[`rust-toolchain.toml`](https://github.com/apache/datafusion/blob/0576a0b400437ade5a6f3b102465d954a539f263/rust-toolchain.toml)
 (currently `1.98.1`) and bumping it on purpose. Could we do the same here, 
with a `rust-toolchain.toml` at the repo root and this input set to match it? 
That also gives contributors the same rustfmt and clippy versions locally that 
CI uses.



##########
.github/workflows/ci.yml:
##########
@@ -0,0 +1,83 @@
+# 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: CI
+
+on:
+  pull_request:
+  push:
+    branches:
+      - main
+  merge_group:
+
+# Cancel obsolete runs for the same pull request or branch. The three jobs 
below
+# keep this workflow well below ASF's 15-job recommended concurrency limit.
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
+  cancel-in-progress: true
+
+# CI needs no credentials beyond reading the source tree.
+permissions:
+  contents: read
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  format:
+    name: Format
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          persist-credentials: false
+      - name: Setup Rust
+        uses: ./.github/actions/setup-rust
+        with:
+          components: rustfmt
+      - run: cargo fmt --all -- --check

Review Comment:
   This check enforces rustfmt's defaults, since the repo has no 
`rustfmt.toml`. The code was ported from iceberg-rust, which formats with 
[`overflow_delimited_expr`, `group_imports`, and 
`imports_granularity`](https://github.com/apache/iceberg-rust/blob/bb1e4a4861f02377489eff818b75138f414c4cb0/rustfmt.toml)
 on a nightly toolchain, and those settings are why the second commit reflows 
calls such as `RecordBatch::try_new(schema, vec![...])` across nine files. 
Could you check in a `rustfmt.toml` so the style is an explicit choice? 
DataFusion uses [`edition = "2024"` and `max_width = 
90`](https://github.com/apache/datafusion/blob/0576a0b400437ade5a6f3b102465d954a539f263/rustfmt.toml),
 which works on stable and would match the parent project. Whatever we pick, 
it's cheaper to decide before more code lands than to reformat everything again 
later.



##########
.github/workflows/ci.yml:
##########
@@ -0,0 +1,83 @@
+# 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: CI
+
+on:
+  pull_request:
+  push:
+    branches:
+      - main
+  merge_group:
+
+# Cancel obsolete runs for the same pull request or branch. The three jobs 
below
+# keep this workflow well below ASF's 15-job recommended concurrency limit.
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
+  cancel-in-progress: true

Review Comment:
   For `push` events `github.ref` is `refs/heads/main`, so if two PRs merge 
close together, the second push cancels the first run on `main`. That leaves 
the first merge commit without a CI result, and since cache saves only happen 
on `main` pushes, the cache doesn't get saved either. DataFusion keys pushes by 
SHA so that runs on `main` never cancel each other 
([`rust.yml`](https://github.com/apache/datafusion/blob/0576a0b400437ade5a6f3b102465d954a539f263/.github/workflows/rust.yml#L46-L48)).
 Keying PRs by number instead of `head_ref` also keeps two forks with the same 
branch name from canceling each other:
   
   ```suggestion
   concurrency:
     group: ${{ github.workflow }}-${{ github.event.pull_request.number || 
github.sha }}
     cancel-in-progress: true
   ```



##########
.github/workflows/ci.yml:
##########
@@ -0,0 +1,83 @@
+# 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: CI
+
+on:
+  pull_request:
+  push:
+    branches:
+      - main
+  merge_group:
+
+# Cancel obsolete runs for the same pull request or branch. The three jobs 
below
+# keep this workflow well below ASF's 15-job recommended concurrency limit.
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
+  cancel-in-progress: true
+
+# CI needs no credentials beyond reading the source tree.
+permissions:
+  contents: read
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  format:
+    name: Format
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          persist-credentials: false
+      - name: Setup Rust
+        uses: ./.github/actions/setup-rust
+        with:
+          components: rustfmt
+      - run: cargo fmt --all -- --check
+
+  clippy:
+    name: Clippy
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          persist-credentials: false
+      - name: Setup Rust
+        uses: ./.github/actions/setup-rust
+        with:
+          components: clippy
+          cache: "true"
+      - run: cargo clippy --workspace --locked --all-targets -- -D warnings
+
+  test:
+    name: Test
+    runs-on: ubuntu-latest
+    env:
+      # Reduces cache size while preserving the optimized test build behavior.
+      CARGO_INCREMENTAL: "0"
+      CARGO_PROFILE_DEV_DEBUG: "0"

Review Comment:
   The comment says this preserves "the optimized test build behavior", but the 
workspace `Cargo.toml` has no `[profile.*]` sections, so `cargo test` uses the 
default dev profile at `opt-level = 0`. These two variables only turn off 
incremental compilation and debug info. Could the comment say that instead?
   
   ```suggestion
         # Incremental artifacts and debug info go unused in CI and only
         # add cache size and build time.
         CARGO_INCREMENTAL: "0"
         CARGO_PROFILE_DEV_DEBUG: "0"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to