diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abb5b48710..d4d6a4bd8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,9 +60,7 @@ jobs: iwr -useb get.scoop.sh | iex Set-ExecutionPolicy RemoteSigned -scope CurrentUser scoop install sccache - Get-ChildItem C:\Users\runneradmin\scoop\shims echo "C:\Users\runneradmin\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "$GITHUB_PATH" - name: Install Rust Stable uses: actions-rs/toolchain@v1 @@ -93,7 +91,6 @@ jobs: - name: Start sccache server run: | - echo "$GITHUB_PATH" sccache --start-server - name: Install cargo-all-features @@ -114,6 +111,10 @@ jobs: test-package-macos_m1: name: Test Package macOS M1 runs-on: macos-latest + env: + RUSTC_WRAPPER: sccache + SCCACHE_CACHE_SIZE: 2G + SCCACHE_DIR: /Users/runner/Library/Caches/Mozilla.sccache steps: - name: Xcode Select uses: devbotsxyz/xcode-select@v1.1.0 @@ -121,6 +122,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install sccache + run: | + brew update + brew install sccache + - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -129,6 +135,30 @@ jobs: toolchain: stable override: true components: rustfmt + + - name: Cache cargo registry + uses: actions/cache@v2 + continue-on-error: false + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: m1-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + m1-cargo- + + - name: Save sccache + uses: actions/cache@v2 + continue-on-error: false + with: + path: /Users/runner/Library/Caches/Mozilla.sccache + key: m1-sccache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + m1-sccache- + + - name: Start sccache server + run: | + sccache --start-server - name: Install cargo-all-features run: | @@ -142,15 +172,36 @@ jobs: MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) \ cd package && cargo test-all-features + - name: Print sccache stats + run: sccache --show-stats + + - name: Stop sccache server + run: sccache --stop-server || true + codecov: name: Code Coverage 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 with: @@ -159,6 +210,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: @@ -189,3 +264,9 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }} + + - name: Print sccache stats + run: sccache --show-stats + + - name: Stop sccache server + run: sccache --stop-server || true