Skip to content

Commit 13fc09e

Browse files
authored
ci: sccache prefix with toolchain version (#19129)
1 parent 71f706c commit 13fc09e

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

.github/actions/setup_build_tool/action.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ inputs:
1212
runs:
1313
using: "composite"
1414
steps:
15+
- name: resolve toolchain
16+
id: toolchain
17+
shell: bash
18+
run: |
19+
TOOLCHAIN_VERSION=$(awk -F'[ ="]+' '$1 == "channel" { print $2 }' rust-toolchain.toml)
20+
if [[ -z "${TOOLCHAIN_VERSION}" ]]; then
21+
echo "::error title=Missing toolchain version::Failed to read toolchain.channel from rust-toolchain.toml"
22+
exit 1
23+
fi
24+
25+
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> "${GITHUB_OUTPUT}"
26+
1527
- name: clean the existing toolchain
1628
shell: bash
1729
run: |
@@ -46,7 +58,7 @@ runs:
4658
export SCCACHE_IDLE_TIMEOUT=0
4759
export SCCACHE_BUCKET=databend-ci
4860
export SCCACHE_REGION=us-east-2
49-
export SCCACHE_S3_KEY_PREFIX="cache/sccache/"
61+
export SCCACHE_S3_KEY_PREFIX="sccache/${{ steps.toolchain.outputs.TOOLCHAIN_VERSION }}/"
5062
export SCCACHE_S3_USE_SSL="true"
5163
export SCCACHE_ERROR_LOG=/workspace/target/sccache.log
5264
export SCCACHE_LOG=info
@@ -60,7 +72,7 @@ runs:
6072
export SCCACHE_IDLE_TIMEOUT=0
6173
export SCCACHE_GCS_RW_MODE=READ_WRITE
6274
export SCCACHE_GCS_BUCKET=databend-ci
63-
export SCCACHE_GCS_KEY_PREFIX="cache/sccache/"
75+
export SCCACHE_GCS_KEY_PREFIX="sccache/${{ steps.toolchain.outputs.TOOLCHAIN_VERSION }}/"
6476
export SCCACHE_ERROR_LOG=/workspace/target/sccache.log
6577
export SCCACHE_LOG=info
6678
EOF
@@ -108,19 +120,19 @@ runs:
108120
cat /proc/cpuinfo
109121
free -h
110122
111-
# - uses: everpcpc/actions-cache@v1
112-
# if: env.RUNNER_PROVIDER == 'aws'
113-
# env:
114-
# AWS_REGION: us-east-2
115-
# with:
116-
# bucket: "databend-ci"
117-
# root: "cache/cargo"
118-
# path: |
119-
# ~/.cargo/registry/cache
120-
# ~/.cargo/registry/index
121-
# ~/.cargo/git/db
122-
# key: |
123-
# ${{ runner.os }}/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}
124-
# restore-keys: |
125-
# ${{ runner.os }}/${{ inputs.target }}/
126-
# ${{ runner.os }}/
123+
- uses: everpcpc/actions-cache@v2
124+
if: env.RUNNER_PROVIDER == 'aws'
125+
env:
126+
AWS_REGION: us-east-2
127+
with:
128+
bucket: "databend-ci"
129+
root: "cache/cargo"
130+
path: |
131+
~/.cargo/registry/cache
132+
~/.cargo/registry/index
133+
~/.cargo/git/db
134+
key: |
135+
${{ runner.os }}/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}
136+
restore-keys: |
137+
${{ runner.os }}/${{ inputs.target }}/
138+
${{ runner.os }}/

0 commit comments

Comments
 (0)