5353 env :
5454 CARGO_TERM_COLOR : always
5555 RUSTUP_TOOLCHAIN : stable
56+ RUSTC_WRAPPER : sccache
57+ SCCACHE_DIR : ${{ github.repository == 'web3infra-foundation/mega' && '/home/github/.cache/sccache' || '/home/runner/.cache/sccache' }}
5658 steps :
5759 - name : Checkout repository
5860 uses : actions/checkout@v4
6466 with :
6567 cache-key : sysdeps
6668 platform : ubuntu
69+ - name : Install sccache
70+ run : |
71+ sudo apt-get update
72+ sudo apt-get install -y sccache
73+ - name : Cache sccache
74+ uses : actions/cache@v4
75+ with :
76+ path : ${{ env.SCCACHE_DIR }}
77+ key : sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-clippy
78+ restore-keys : |
79+ sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-
80+ sccache-${{ runner.os }}-stable-
81+ - name : Rust cache
82+ uses : Swatinem/rust-cache@v2
83+ with :
84+ shared-key : base-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
85+ cache-on-failure : true
6786 - name : Run cargo clippy
6887 run : |
88+ sccache --start-server || true
6989 cargo +stable clippy --all-targets --all-features -- -D warnings
90+ sccache --show-stats || true
7091
7192 test :
7293 if : ${{ !(github.repository == 'web3infra-foundation/mega' && github.event_name == 'push') }}
7697 CARGO_TERM_COLOR : always
7798 RUSTUP_TOOLCHAIN : stable
7899 HOME : ${{ github.repository == 'web3infra-foundation/mega' && '/home/github' || '/home/runner' }}
100+ RUSTC_WRAPPER : sccache
101+ SCCACHE_DIR : ${{ github.repository == 'web3infra-foundation/mega' && '/home/github/.cache/sccache' || '/home/runner/.cache/sccache' }}
79102 steps :
80103 - name : Install Redis
81104 run : sudo apt-get update && sudo apt-get install -y redis-server
@@ -93,6 +116,23 @@ jobs:
93116 platform : ubuntu
94117 self-hosted : ${{ github.repository == 'web3infra-foundation/mega' }}
95118 use-gtk : false
119+ - name : Install sccache
120+ run : |
121+ sudo apt-get update
122+ sudo apt-get install -y sccache
123+ - name : Cache sccache
124+ uses : actions/cache@v4
125+ with :
126+ path : ${{ env.SCCACHE_DIR }}
127+ key : sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-test
128+ restore-keys : |
129+ sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-
130+ sccache-${{ runner.os }}-stable-
131+ - name : Rust cache
132+ uses : Swatinem/rust-cache@v2
133+ with :
134+ shared-key : base-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
135+ cache-on-failure : true
96136
97137 - name : Set up git lfs
98138 run : |
@@ -104,12 +144,14 @@ jobs:
104144
105145 - name : Run cargo test
106146 run : |
147+ sccache --start-server || true
107148 cargo test --manifest-path common/Cargo.toml --all-features --no-fail-fast -- --nocapture
108149 cargo test --manifest-path jupiter/Cargo.toml --all-features --no-fail-fast -- --nocapture
109150 cargo test --manifest-path ceres/Cargo.toml --all-features --no-fail-fast -- --nocapture
110151 cargo test --manifest-path vault/Cargo.toml --all-features --no-fail-fast -- --nocapture
111152 cargo test --manifest-path saturn/Cargo.toml --all-features --no-fail-fast -- --nocapture
112153 cargo test --manifest-path orion-server/Cargo.toml --all-features --no-fail-fast -- --nocapture
154+ sccache --show-stats || true
113155
114156 # Note: The fuse/scorpio job has been removed as scorpio has been moved
115157 # to its own repository: https://github.com/web3infra-foundation/scorpiofs
0 commit comments