From a3241e8e0f30a8b8105b171c97575571c966e3be Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 28 Sep 2020 10:24:58 +0200 Subject: [PATCH 1/6] ci: Use smarter cache action --- .github/workflows/ci.yml | 82 +++++++++------------------------------- 1 file changed, 18 insertions(+), 64 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fadf2efe..cabbd7290 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,3 @@ -# Notes on Caching: -# -# Caches are keyed by OS, rustc version, job and Cargo.toml hash. -# We additionally cache the `Cargo.lock` file, as that is not being committed -# directly to git. - name: CI on: @@ -17,14 +11,11 @@ jobs: lints: name: Lints runs-on: ubuntu-latest - env: - cache-name: lints steps: - name: Checkout sources uses: actions/checkout@v2 - name: Install stable toolchain - id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -32,16 +23,9 @@ jobs: override: true components: rustfmt, clippy - - uses: actions/cache@v2 + - uses: Swatinem/rust-cache@v1 with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - Cargo.lock - key: ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }}- + key: lints - name: Run cargo fmt uses: actions-rs/cargo@v1 @@ -65,14 +49,11 @@ jobs: name: checkall using ${{ matrix.rust }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} - env: - cache-name: check steps: - name: Checkout sources uses: actions/checkout@v2 - name: Install rust toolchain - id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -80,22 +61,15 @@ jobs: override: true # workaround for: https://github.com/actions/cache/issues/403 - - name: Install GNU tar (macOS) - if: runner.os == 'macOS' - run: | - brew install gnu-tar - echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" + # - name: Install GNU tar (macOS) + # if: runner.os == 'macOS' + # run: | + # brew install gnu-tar + # echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" - - uses: actions/cache@v2 + - uses: Swatinem/rust-cache@v1 with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - Cargo.lock - key: ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }}- + key: check - run: make checkall @@ -109,14 +83,11 @@ jobs: name: testall using ${{ matrix.rust }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} - env: - cache-name: test steps: - name: Checkout sources uses: actions/checkout@v2 - name: Install rust toolchain - id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -124,22 +95,15 @@ jobs: override: true # workaround for: https://github.com/actions/cache/issues/403 - - name: Install GNU tar (macOS) - if: runner.os == 'macOS' - run: | - brew install gnu-tar - echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" + #- name: Install GNU tar (macOS) + # if: runner.os == 'macOS' + # run: | + # brew install gnu-tar + # echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" - - uses: actions/cache@v2 + - uses: Swatinem/rust-cache@v1 with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - Cargo.lock - key: ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }}- + key: test - name: Run cargo test uses: actions-rs/cargo@v1 @@ -157,30 +121,20 @@ jobs: name: checkfast/testfast using ${{ matrix.rust }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} - env: - cache-name: fast-MSRV steps: - name: Checkout sources uses: actions/checkout@v2 - name: Install rust toolchain - id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: ${{ matrix.rust }} override: true - - uses: actions/cache@v2 + - uses: Swatinem/rust-cache@v1 with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - Cargo.lock - key: ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ env.cache-name }} + key: fast-MSRV - run: make checkfast From 1fa33d81f6d564f7159fe6f3fadf8130162f2bea Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 28 Sep 2020 11:03:55 +0200 Subject: [PATCH 2/6] noop rebuild From 7876a7278aea71060882ac2437413f8aea68ce99 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 28 Sep 2020 11:30:33 +0200 Subject: [PATCH 3/6] re-add macOS workaround --- .github/workflows/ci.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cabbd7290..58f749132 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,19 +60,20 @@ jobs: toolchain: ${{ matrix.rust }} override: true - # workaround for: https://github.com/actions/cache/issues/403 - # - name: Install GNU tar (macOS) - # if: runner.os == 'macOS' - # run: | - # brew install gnu-tar - # echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" - - uses: Swatinem/rust-cache@v1 with: key: check - run: make checkall + # Workaround for actions/cache#403 (https://github.com/actions/cache/issues/403) + # + # rust-lang/cargo#8603 has the exact bug that we run into + # (https://github.com/rust-lang/cargo/issues/8603) + - name: Flush the disk cache for macOS + if: matrix.os == 'macos-latest' + run: sudo /usr/sbin/purge + test: strategy: fail-fast: false @@ -94,13 +95,6 @@ jobs: toolchain: ${{ matrix.rust }} override: true - # workaround for: https://github.com/actions/cache/issues/403 - #- name: Install GNU tar (macOS) - # if: runner.os == 'macOS' - # run: | - # brew install gnu-tar - # echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" - - uses: Swatinem/rust-cache@v1 with: key: test @@ -111,6 +105,14 @@ jobs: command: test args: --workspace --all-features + # Workaround for actions/cache#403 (https://github.com/actions/cache/issues/403) + # + # rust-lang/cargo#8603 has the exact bug that we run into + # (https://github.com/rust-lang/cargo/issues/8603) + - name: Flush the disk cache for macOS + if: matrix.os == 'macos-latest' + run: sudo /usr/sbin/purge + fast-MSRV: strategy: fail-fast: false From 09d6ea46509383f198b06a9a8f5a8e3f9d49f8de Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 28 Sep 2020 12:27:39 +0200 Subject: [PATCH 4/6] use master action --- .github/workflows/ci.yml | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58f749132..c69a8cb55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: override: true components: rustfmt, clippy - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@master with: key: lints @@ -60,20 +60,12 @@ jobs: toolchain: ${{ matrix.rust }} override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@master with: key: check - run: make checkall - # Workaround for actions/cache#403 (https://github.com/actions/cache/issues/403) - # - # rust-lang/cargo#8603 has the exact bug that we run into - # (https://github.com/rust-lang/cargo/issues/8603) - - name: Flush the disk cache for macOS - if: matrix.os == 'macos-latest' - run: sudo /usr/sbin/purge - test: strategy: fail-fast: false @@ -95,7 +87,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@master with: key: test @@ -105,14 +97,6 @@ jobs: command: test args: --workspace --all-features - # Workaround for actions/cache#403 (https://github.com/actions/cache/issues/403) - # - # rust-lang/cargo#8603 has the exact bug that we run into - # (https://github.com/rust-lang/cargo/issues/8603) - - name: Flush the disk cache for macOS - if: matrix.os == 'macos-latest' - run: sudo /usr/sbin/purge - fast-MSRV: strategy: fail-fast: false @@ -134,7 +118,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@master with: key: fast-MSRV From af1450a177fdf378c41093fe23adfadd3fc93c55 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 28 Sep 2020 12:48:53 +0200 Subject: [PATCH 5/6] noop rebuild From 30519f1fbfb2ab1a42f65b57f463e54f83ef5c04 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 28 Sep 2020 13:15:17 +0200 Subject: [PATCH 6/6] switch back to v1 action --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69a8cb55..26af57322 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: override: true components: rustfmt, clippy - - uses: Swatinem/rust-cache@master + - uses: Swatinem/rust-cache@v1 with: key: lints @@ -60,7 +60,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - - uses: Swatinem/rust-cache@master + - uses: Swatinem/rust-cache@v1 with: key: check @@ -87,7 +87,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - - uses: Swatinem/rust-cache@master + - uses: Swatinem/rust-cache@v1 with: key: test @@ -118,7 +118,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - - uses: Swatinem/rust-cache@master + - uses: Swatinem/rust-cache@v1 with: key: fast-MSRV