Skip to content

Commit a96a8f1

Browse files
committed
Setup building with standardized action, install protoc
1 parent e9f020a commit a96a8f1

File tree

2 files changed

+59
-22
lines changed

2 files changed

+59
-22
lines changed
+39
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

+20-22
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
@@ -117,10 +116,9 @@ jobs:
117116
# this key equals the ones on `linux-build-lib` for re-use
118117
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
119118
- name: Setup Rust toolchain
120-
run: |
121-
rustup toolchain install ${{ matrix.rust }}
122-
rustup default ${{ matrix.rust }}
123-
rustup component add rustfmt
119+
uses: ./.github/actions/setup-builder
120+
with:
121+
rust-version: ${{ matrix.rust }}
124122
- name: Run tests
125123
run: |
126124
export ARROW_TEST_DATA=$(pwd)/testing/data
@@ -285,10 +283,9 @@ jobs:
285283
echo "LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
286284
python -m pip install pyarrow
287285
- name: Setup Rust toolchain
288-
run: |
289-
rustup toolchain install ${{ matrix.rust }}
290-
rustup default ${{ matrix.rust }}
291-
rustup component add rustfmt
286+
uses: ./.github/actions/setup-builder
287+
with:
288+
rust-version: ${{ matrix.rust }}
292289
- name: Run tests
293290
run: |
294291
cd datafusion
@@ -343,10 +340,12 @@ jobs:
343340
# this key equals the ones on `linux-build-lib` for re-use
344341
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
345342
- name: Setup Rust toolchain
343+
uses: ./.github/actions/setup-builder
344+
with:
345+
rust-version: ${{ matrix.rust }}
346+
- name: Install Clippy
346347
run: |
347-
rustup toolchain install ${{ matrix.rust }}
348-
rustup default ${{ matrix.rust }}
349-
rustup component add rustfmt clippy
348+
rustup component add clippy
350349
- name: Run clippy
351350
run: |
352351
cargo clippy --all-targets --workspace -- -D warnings
@@ -420,10 +419,9 @@ jobs:
420419
# this key equals the ones on `linux-build-lib` for re-use
421420
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
422421
- name: Setup Rust toolchain
423-
run: |
424-
rustup toolchain install ${{ matrix.rust }}
425-
rustup default ${{ matrix.rust }}
426-
rustup component add rustfmt
422+
uses: ./.github/actions/setup-builder
423+
with:
424+
rust-version: ${{ matrix.rust }}
427425
- name: Run tests
428426
run: |
429427
export ARROW_TEST_DATA=$(pwd)/testing/data
@@ -466,9 +464,9 @@ jobs:
466464
# this key equals the ones on `linux-build-lib` for re-use
467465
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
468466
- name: Setup Rust toolchain
469-
run: |
470-
rustup toolchain install ${{ matrix.rust }}
471-
rustup default ${{ matrix.rust }}
467+
uses: ./.github/actions/setup-builder
468+
with:
469+
rust-version: ${{ matrix.rust }}
472470
- name: Install cargo-tomlfmt
473471
run: |
474472
which cargo-tomlfmt || cargo install cargo-tomlfmt

0 commit comments

Comments
 (0)