|
| 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: Cache Cargo |
| 29 | + uses: actions/cache@v3 |
| 30 | + with: |
| 31 | + # these represent dependencies downloaded by cargo |
| 32 | + # and thus do not depend on the OS, arch nor rust version. |
| 33 | + # |
| 34 | + # source https://github.com/actions/cache/blob/main/examples.md#rust---cargo |
| 35 | + path: | |
| 36 | + /usr/local/cargo/bin/ |
| 37 | + /usr/local/cargo/registry/index/ |
| 38 | + /usr/local/cargo/registry/cache/ |
| 39 | + /usr/local/cargo/git/db/ |
| 40 | + key: cargo-cache3-${{ hashFiles('**/Cargo.toml') }} |
| 41 | + restore-keys: cargo-cache3- |
| 42 | + - name: Generate lockfile |
| 43 | + shell: bash |
| 44 | + run: cargo fetch |
| 45 | + - name: Cache Rust dependencies |
| 46 | + uses: actions/cache@v3 |
| 47 | + with: |
| 48 | + # these represent compiled steps of both dependencies and arrow |
| 49 | + # and thus are specific for a particular OS, arch and rust version. |
| 50 | + path: /github/home/target |
| 51 | + key: ${{ runner.os }}-${{ runner.arch }}-target-cache3-${{ inputs.rust-version }}-${{ hashFiles('**/Cargo.lock') }} |
| 52 | + restore-keys: ${{ runner.os }}-${{ runner.arch }}-target-cache3-${{ inputs.rust-version }}- |
| 53 | + - name: Install Build Dependencies |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + apt-get update |
| 57 | + apt-get install -y protobuf-compiler |
| 58 | + - name: Setup Rust toolchain |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + echo "Installing ${{ inputs.rust-version }}" |
| 62 | + rustup toolchain install ${{ inputs.rust-version }} |
| 63 | + rustup default ${{ inputs.rust-version }} |
| 64 | + echo "CARGO_TARGET_DIR=/github/home/target" >> $GITHUB_ENV |
0 commit comments