diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbb32aa3e9..9f8bec2de3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,25 +3,38 @@ on: [push, pull_request] env: CARGO_TERM_COLOR: always + SCCACHE_DIR: ${{github.workspace}}/sccache/ + SCCACHE_CACHE_SIZE: 1G jobs: agent: runs-on: "${{ matrix.os }}" steps: - uses: actions/checkout@v2 - - uses: actions/cache@v2 - env: - cache-name: cache-rust-target + - name: Rust Prereq Cache + uses: actions/cache@v2 + id: cache-rust-prereqs with: path: | - src/agent/target + sccache ~/.cargo/registry ~/.cargo/git ~/.cargo/bin - ~/.cache/sccache - key: agent-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} + key: rust-${{ runner.os }}-2020-09 + restore-keys: | + rust-${{ runner.os }} + - name: Install Rust Prereqs + if: steps.cache-rust-prereqs.outputs.cache-hit != 'true' + shell: bash + run: src/ci/rust-prereqs.sh + - name: Rust Compile Cache + uses: actions/cache@v2 + with: + path: | + sccache + src/agent/target + key: agent-${{ runner.os }}-${{ hashFiles('src/agent/Cargo.lock') }} restore-keys: | - agent-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} agent-${{ runner.os }} - name: Linux Prereqs run: | @@ -111,19 +124,30 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - uses: actions/cache@v2 - env: - cache-name: cache-rust-proxy + - name: Rust Prereq Cache + uses: actions/cache@v2 + id: cache-rust-prereqs with: path: | - src/proxy-manager/target + sccache ~/.cargo/registry ~/.cargo/git ~/.cargo/bin - ~/.cache/sccache - key: proxy-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} + key: rust-${{ runner.os }}-2020-09 + restore-keys: | + rust-${{ runner.os }} + - name: Install Rust Prereqs + if: steps.cache-rust-prereqs.outputs.cache-hit != 'true' + shell: bash + run: src/ci/rust-prereqs.sh + - name: Rust Compile Cache + uses: actions/cache@v2 + with: + path: | + sccache + src/proxy-manager/target + key: proxy-${{ runner.os }}-${{ hashFiles('src/proxy-manager/Cargo.lock') }} restore-keys: | - proxy-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} proxy-${{ runner.os }} - run: src/ci/proxy.sh - uses: actions/upload-artifact@v2.1.4 diff --git a/src/ci/agent.sh b/src/ci/agent.sh index 5337553dae..642294a01d 100755 --- a/src/ci/agent.sh +++ b/src/ci/agent.sh @@ -5,16 +5,12 @@ set -ex +export RUSTC_WRAPPER=$(which sccache) + mkdir -p artifacts/agent cd src/agent -cargo install sccache || echo 'already installed?' -export RUSTC_WRAPPER=$(which sccache) -cargo install cargo-audit -cargo install cargo-license || echo 'already installed?' cargo fmt -- --check -rustup component add clippy -cargo clippy --release -- -D warnings # RUSTSEC-2019-0031: a dependency spin (pulled in from ring) is not actively maintained # RUSTSEC-2020-0016: a dependency net2 (pulled in from tokio) is deprecated # RUSTSEC-2020-0036: a dependency failure (pulled from proc-maps) is deprecated diff --git a/src/ci/proxy.sh b/src/ci/proxy.sh index 67ae04bc8c..6075b0e946 100755 --- a/src/ci/proxy.sh +++ b/src/ci/proxy.sh @@ -5,15 +5,12 @@ set -ex +export RUSTC_WRAPPER=$(which sccache) + mkdir -p artifacts/proxy cd src/proxy-manager -cargo install sccache || echo 'already installed?' -export RUSTC_WRAPPER=$(which sccache) -cargo install cargo-audit -cargo install cargo-license || echo 'already installed' cargo fmt -- --check -rustup component add clippy cargo clippy --release -- -D warnings # RUSTSEC-2020-0016: a dependency net2 (pulled in from tokio) is deprecated cargo audit -D --ignore RUSTSEC-2020-0016 diff --git a/src/ci/rust-prereqs.sh b/src/ci/rust-prereqs.sh new file mode 100755 index 0000000000..b9a42dca0b --- /dev/null +++ b/src/ci/rust-prereqs.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +set -ex + +cargo install sccache || echo 'already installed?' +export RUSTC_WRAPPER=$(which sccache) +cargo install cargo-audit +cargo install cargo-license || echo 'already installed?' +rustup component add clippy