diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dc2e0a622..f3dd8d8af2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -220,6 +220,14 @@ jobs: profile: minimal toolchain: stable override: true + + - name: Save sccache + uses: actions/cache@v2 + continue-on-error: false + with: + path: /home/runner/.cache/sccache + key: ubuntu-sccache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ubuntu-sccache- - name: Start sccache server run: sccache --start-server @@ -243,9 +251,24 @@ jobs: runs-on: ubuntu-latest env: RUSTC_BOOTSTRAP: 1 + RUSTC_WRAPPER: sccache + SCCACHE_CACHE_SIZE: 2G + SCCACHE_DIR: /home/runner/.cache/sccache steps: - name: Checkout uses: actions/checkout@v1 + + - name: Install sccache Ubuntu + env: + LINK: https://github.com/mozilla/sccache/releases/download + SCCACHE_VERSION: v0.2.15 + run: | + SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl + mkdir -p $HOME/.local/bin + curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz + mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache + chmod +x $HOME/.local/bin/sccache + echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install Rust uses: actions-rs/toolchain@v1 @@ -255,6 +278,30 @@ jobs: override: true components: rustfmt + - name: Cache cargo registry + uses: actions/cache@v2 + continue-on-error: false + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: codecov-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + codecov-cargo- + + - name: Save sccache + uses: actions/cache@v2 + continue-on-error: false + with: + path: /Users/runner/Library/Caches/Mozilla.sccache + key: codecov-sccache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + codecov-sccache- + + - name: Start sccache server + run: | + sccache --start-server + - name: Test uses: actions-rs/cargo@v1 with: @@ -284,4 +331,10 @@ jobs: uses: codecov/codecov-action@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Print sccache stats + run: sccache --show-stats + + - name: Stop sccache server + run: sccache --stop-server || true