Skip to content

Commit

Permalink
z
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed Jul 8, 2024
1 parent b47be7a commit 63d4c22
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
40 changes: 38 additions & 2 deletions .github/actions/setup/action.yml
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
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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"
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,13 @@ jobs:

integration:
needs: check
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
runs-on: [self-hosted, Linux, X64, 4c8g, aws]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
runner: aws
cache-key: integration
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-duration-seconds: 600
role-to-assume: arn:aws:iam::034080348588:role/databend-ci
aws-region: us-east-2
- name: Get License from S3
run: |
aws s3 cp s3://databend-ci/misc/license.key license.key
Expand Down

0 comments on commit 63d4c22

Please sign in to comment.