Skip to content

Commit 0c008a7

Browse files
committed
ci: Add rust builder setup
Can drop this after rebase on commit 7548e96 "Update to Arrow 12.0.0, update tonic and prost (apache#2253)", first released in 8.0.0
1 parent dcfd7d5 commit 0c008a7

File tree

2 files changed

+53
-15
lines changed

2 files changed

+53
-15
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
name: Prepare Rust Builder
19+
description: 'Prepare Rust Build Environment'
20+
inputs:
21+
rust-version:
22+
description: 'version of rust to install (e.g. stable)'
23+
required: true
24+
default: 'stable'
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Install Build Dependencies
29+
shell: bash
30+
run: |
31+
apt-get update
32+
apt-get install -y protobuf-compiler
33+
- name: Setup Rust toolchain
34+
shell: bash
35+
run: |
36+
echo "Installing ${{ inputs.rust-version }}"
37+
rustup toolchain install ${{ inputs.rust-version }}
38+
rustup default ${{ inputs.rust-version }}
39+
rustup component add rustfmt

.github/workflows/rust.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ jobs:
5454
path: /github/home/target
5555
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}-
5656
- name: Setup Rust toolchain
57-
run: |
58-
rustup toolchain install ${{ matrix.rust }}
59-
rustup default ${{ matrix.rust }}
60-
rustup component add rustfmt
57+
uses: ./.github/actions/setup-builder
58+
with:
59+
rust-version: ${{ matrix.rust }}
6160
- name: Build workspace in debug mode
6261
run: |
6362
cargo build
@@ -116,10 +115,9 @@ jobs:
116115
# this key equals the ones on `linux-build-lib` for re-use
117116
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
118117
- name: Setup Rust toolchain
119-
run: |
120-
rustup toolchain install ${{ matrix.rust }}
121-
rustup default ${{ matrix.rust }}
122-
rustup component add rustfmt
118+
uses: ./.github/actions/setup-builder
119+
with:
120+
rust-version: ${{ matrix.rust }}
123121
- name: Run tests
124122
run: |
125123
export ARROW_TEST_DATA=$(pwd)/testing/data
@@ -329,10 +327,12 @@ jobs:
329327
# this key equals the ones on `linux-build-lib` for re-use
330328
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
331329
- name: Setup Rust toolchain
330+
uses: ./.github/actions/setup-builder
331+
with:
332+
rust-version: ${{ matrix.rust }}
333+
- name: Install Clippy
332334
run: |
333-
rustup toolchain install ${{ matrix.rust }}
334-
rustup default ${{ matrix.rust }}
335-
rustup component add rustfmt clippy
335+
rustup component add clippy
336336
- name: Run clippy
337337
run: |
338338
cargo clippy --all-targets --workspace -- -D warnings
@@ -372,10 +372,9 @@ jobs:
372372
# this key equals the ones on `linux-build-lib` for re-use
373373
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
374374
- name: Setup Rust toolchain
375-
run: |
376-
rustup toolchain install ${{ matrix.rust }}
377-
rustup default ${{ matrix.rust }}
378-
rustup component add rustfmt
375+
uses: ./.github/actions/setup-builder
376+
with:
377+
rust-version: ${{ matrix.rust }}
379378
- name: Maximize build space (disk space limitations)
380379
run: |
381380
echo "Disk Space before cleanup"

0 commit comments

Comments
 (0)