-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathaction.yml
67 lines (67 loc) · 3.62 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: 'Rust Cache'
description: 'Cache rust dep and build artifacts'
runs:
using: "composite"
steps:
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: |
cargo-deps-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-deps-
- uses: actions/cache@v3
with:
path: ~/.cargo/target/
key: |
cargo-target-global-${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index }}-${{ github.sha }}
restore-keys: |
cargo-target-global-${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index }}-
cargo-target-global-${{ github.workflow }}-${{ github.job }}-
- shell: bash
env:
SCCACHE_VERSION: v0.4.1
SCCACHE_FILE: >-
${{ (runner.os == 'Linux' && runner.arch == 'X64' && 'sccache-v0.4.1-x86_64-unknown-linux-musl.tar.gz')
|| (runner.os == 'Linux' && runner.arch == 'ARM64' && 'sccache-v0.4.1-aarch64-unknown-linux-musl.tar.gz')
|| (runner.os == 'macOS' && runner.arch == 'X64' && 'sccache-v0.4.1-x86_64-apple-darwin.tar.gz')
|| (runner.os == 'macOS' && runner.arch == 'ARM64' && 'sccache-v0.4.1-aarch64-apple-darwin.tar.gz')
|| (runner.os == 'Windows' && 'sccache-v0.4.1-x86_64-pc-windows-msvc.tar.gz') }}
SCCACHE_FILE_SHA256: >-
${{ (runner.os == 'Linux' && runner.arch == 'X64' && 'f077d92ca86d71bc55aebeeb6e8dc557fef481446ccc82504aeedf1fe6e1f657')
|| (runner.os == 'Linux' && runner.arch == 'ARM64' && '263a43ba0cb211e5c1c10fe437c636d601bed7a47be0ca07beeba7973ba61461')
|| (runner.os == 'macOS' && runner.arch == 'X64' && 'a291f1d90c6b25726866f018ec6071fa4d20ca443ad91fe5dfb9740eb4ebc45a')
|| (runner.os == 'macOS' && runner.arch == 'ARM64' && '593c6c78796db712c29fe766caef4b8bd2e3d4a68ed5b2b8eca39e03ce2432df')
|| (runner.os == 'Windows' && '7508cfa20b045a891eba2f7298afb8faec886d40d10b844830160b096fe99874') }}
SCCACHE_DIR: >-
${{ (runner.os == 'Linux' && runner.arch == 'X64' && 'sccache-v0.4.1-x86_64-unknown-linux-musl')
|| (runner.os == 'Linux' && runner.arch == 'ARM64' && 'sccache-v0.4.1-aarch64-unknown-linux-musl')
|| (runner.os == 'macOS' && runner.arch == 'X64' && 'sccache-v0.4.1-x86_64-apple-darwin')
|| (runner.os == 'macOS' && runner.arch == 'ARM64' && 'sccache-v0.4.1-aarch64-apple-darwin')
|| (runner.os == 'Windows' && 'sccache-v0.4.1-x86_64-pc-windows-msvc') }}
SCCACHE_BIN_FILE: sccache${{ runner.os == 'Windows' && '.exe' || '' }}
SHASUM: ${{ runner.os == 'macOS' && 'shasum' || 'sha256sum' }}
run: |
curl --fail --location --output /tmp/$SCCACHE_FILE https://github.com/mozilla/sccache/releases/download/$SCCACHE_VERSION/$SCCACHE_FILE
$SHASUM -c <(echo "$SCCACHE_FILE_SHA256 /tmp/$SCCACHE_FILE")
mkdir -p "$HOME/.local/bin"
tar xz -f /tmp/$SCCACHE_FILE -C "$HOME/.local/bin" --strip-components=1 $SCCACHE_DIR/$SCCACHE_BIN_FILE
chmod +x "$HOME/.local/bin/$SCCACHE_BIN_FILE"
- shell: bash
run: |
echo "RUSTC_WRAPPER=$HOME/.local/bin/sccache${{ runner.os == 'Windows' && '.exe' || '' }}" >> $GITHUB_ENV
echo 'SCCACHE_CACHE_SIZE=9G' >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/sccache
key: |
cargo-sccache-${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index }}-${{ github.sha }}
restore-keys: |
cargo-sccache-${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index }}-
cargo-sccache-${{ github.workflow }}-${{ github.job }}-
- if: github.ref_protected
shell: bash
run: rm -fr ~/.cache/sccache