Skip to content

Commit 04b19a3

Browse files
authored
ci: Use install-action instead of cargo install to speed up CI (#23477)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #. ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> For CI dependencies installed with `cargo install`, it's possible to use `install-action` instead for faster setup. (former compiles the binary, the latter directly download the release version) , each of them should get ~1min faster. ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> - Use `install-action` instead of `cargo install` for existing CI jobs - Add a new CI job to enforce this convention (`grep cargo install` for all Github Action scripts) ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. -->
1 parent 34c4849 commit 04b19a3

8 files changed

Lines changed: 64 additions & 11 deletions

File tree

.asf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ github:
7878
- "cargo test (macos-aarch64)"
7979
- "Verify Vendored Code"
8080
- "Check cargo fmt"
81+
- "Check GitHub Actions install tooling"
8182
- "clippy"
8283
- "check Cargo.toml formatting"
8384
- "check configs.md and ***_functions.md is up-to-date"
@@ -114,4 +115,3 @@ github:
114115
# https://datafusion.apache.org/
115116
publish:
116117
whoami: asf-site
117-

.github/workflows/dependencies.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ jobs:
6363
steps:
6464
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
6565
- name: Install cargo-machete
66-
run: cargo install cargo-machete --version ^0.9 --locked
66+
uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10
67+
with:
68+
tool: cargo-machete@0.9
6769
- name: Detect unused dependencies
6870
run: cargo machete --with-metadata

.github/workflows/dev.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ jobs:
3838
steps:
3939
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4040
- name: Install HawkEye
41-
# This CI job is bound by installation time, use `--profile dev` to speed it up
42-
run: cargo install hawkeye --version 6.2.0 --locked --profile dev
41+
uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10
42+
with:
43+
tool: hawkeye@6.2.0
4344
- name: Run license header check
4445
run: ci/scripts/license_header.sh
4546

@@ -89,7 +90,9 @@ jobs:
8990
# Version fixed on purpose. It uses heuristics to detect typos, so upgrading
9091
# it may cause checks to fail more often.
9192
# We can upgrade it manually once a while.
92-
- name: Install typos-cli
93-
run: cargo install typos-cli --locked --version 1.37.0
93+
- name: Install typos
94+
uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10
95+
with:
96+
tool: typos@1.37.0
9497
- name: Run typos check
9598
run: ci/scripts/typos_check.sh

.github/workflows/docs.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ jobs:
4747

4848
- name: Install dependencies
4949
run: uv sync --package datafusion-docs
50-
- name: Install dependency graph tooling
50+
- name: Install Graphviz
5151
run: |
5252
set -x
5353
sudo apt-get update
5454
sudo apt-get install -y graphviz
55-
cargo install cargo-depgraph --version ^1.6 --locked
55+
- name: Install cargo-depgraph
56+
uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10
57+
with:
58+
tool: cargo-depgraph@1.6
5659

5760
- name: Build docs
5861
run: |

.github/workflows/docs_pr.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ jobs:
5353
uses: astral-sh/setup-uv@f98e06938123ccabd21905ea5d0069192241f9f1 # v8.3.1
5454
- name: Install doc dependencies
5555
run: uv sync --package datafusion-docs
56-
- name: Install dependency graph tooling
56+
- name: Install Graphviz
5757
run: |
5858
set -x
5959
sudo apt-get update
6060
sudo apt-get install -y graphviz
61-
cargo install cargo-depgraph --version ^1.6 --locked
61+
- name: Install cargo-depgraph
62+
uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10
63+
with:
64+
tool: cargo-depgraph@1.6
6265
- name: Build docs html and check for warnings
6366
run: |
6467
set -x

.github/workflows/rust.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@ jobs:
628628
run: |
629629
ci/scripts/rust_fmt.sh
630630
631+
check-workflow-tool-installs:
632+
name: Check GitHub Actions install tooling
633+
runs-on: ubuntu-latest
634+
steps:
635+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
636+
- name: Check workflow tool installs
637+
run: ci/scripts/check_no_cargo_install_in_workflows.sh
638+
631639
# Coverage job disabled due to
632640
# https://github.com/apache/datafusion/issues/3678
633641

@@ -659,12 +667,15 @@ jobs:
659667
# path: /home/runner/.cargo
660668
# # this key is not equal because the user is different than on a container (runner vs github)
661669
# key: cargo-coverage-cache3-
670+
# - name: Install cargo-tarpaulin
671+
# uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10
672+
# with:
673+
# tool: cargo-tarpaulin@0.20.1
662674
# - name: Run coverage
663675
# run: |
664676
# export PATH=$PATH:$HOME/d/protoc/bin
665677
# rustup toolchain install stable
666678
# rustup default stable
667-
# cargo install --version 0.20.1 cargo-tarpaulin
668679
# cargo tarpaulin --all --out Xml
669680
# - name: Report coverage
670681
# continue-on-error: true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
set -euo pipefail
21+
22+
SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
23+
WORKFLOWS_DIR=".github/workflows"
24+
25+
if grep -R -n --include='*.yml' --include='*.yaml' -- 'cargo install' "${WORKFLOWS_DIR}"; then
26+
echo "[${SCRIPT_NAME}] Found workflow Rust tool installs that should use taiki-e/install-action instead." >&2
27+
exit 1
28+
fi
29+
30+
echo "[${SCRIPT_NAME}] GitHub Actions workflow tool installs look good."

dev/rust_lint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ declare -a WRITE_STEPS=(
106106
)
107107

108108
declare -a READONLY_STEPS=(
109+
"ci/scripts/check_no_cargo_install_in_workflows.sh|false"
109110
"ci/scripts/rust_docs.sh|false"
110111
)
111112

0 commit comments

Comments
 (0)