-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
name: Setup Rust Builder | ||
description: 'Prepare Rust Build Environment' | ||
inputs: | ||
runner: | ||
description: 'runner provider' | ||
required: true | ||
default: 'github' | ||
cache-key: | ||
description: 'the rust cache key suffix' | ||
required: false | ||
|
@@ -22,7 +26,8 @@ runs: | |
- name: Setup sccache | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Cache Cargo | ||
- name: Cache Cargo for Github Runner | ||
if: inputs.runner == 'github' | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
|
@@ -33,6 +38,23 @@ runs: | |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | ||
${{ runner.os }}-cargo | ||
- name: Cache Cargo for AWS Self-Hosted Runner | ||
if: inputs.runner == 'aws' | ||
uses: everpcpc/actions-cache@v2 | ||
env: | ||
AWS_REGION: us-east-2 | ||
with: | ||
provider: s3 | ||
bucket: "databend-ci" | ||
root: "bendsql/cache" | ||
path: | | ||
~/.cargo/registry/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ steps.toolchain.outputs.cachekey }}-${{ inputs.cache-key }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ steps.toolchain.outputs.cachekey }} | ||
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | ||
${{ runner.os }}-cargo | ||
- name: Setup rust related environment variables | ||
shell: bash | ||
run: | | ||
|
@@ -48,6 +70,20 @@ runs: | |
echo "RUST_LOG=info" >> $GITHUB_ENV | ||
# Enable sparse index | ||
echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV | ||
# Enable sccache | ||
- name: Enable sccache for Github Actions | ||
shell: bash | ||
if: inputs.runner == 'github' | ||
run: | | ||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
- name: Enable sccache for AWS Self-Hosted Actions | ||
shell: bash | ||
if: inputs.runner == 'aws' | ||
run: | | ||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
export SCCACHE_BUCKET=databend-ci | ||
export SCCACHE_REGION=us-east-2 | ||
export SCCACHE_S3_KEY_PREFIX="bendsql/sccache/" | ||
export SCCACHE_S3_USE_SSL="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters