From 6468f8af58fd32bc86f770a131990d8fde5a385d Mon Sep 17 00:00:00 2001
From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
Date: Sat, 25 Jun 2022 23:03:14 -0400
Subject: [PATCH] ci: lock cross to 0.2.1 on CI as well (#756)

Locks CI to cross 0.2.1.
---
 .github/workflows/ci.yml       | 36 ++++++++++++++++++++++------------
 .github/workflows/coverage.yml |  2 --
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e79077ee..9b28cd0a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -27,11 +27,11 @@ env:
 jobs:
   # Runs rustfmt + tests + clippy on the main supported platforms.
   supported:
-    runs-on: ${{ matrix.triple.os }}
+    runs-on: ${{ matrix.info.os }}
     strategy:
       fail-fast: false
       matrix:
-        triple:
+        info:
           - {
               os: "ubuntu-latest",
               target: "x86_64-unknown-linux-gnu",
@@ -74,7 +74,7 @@ jobs:
         with:
           toolchain: stable
           components: rustfmt, clippy
-          target: ${{ matrix.triple.target }}
+          target: ${{ matrix.info.target }}
 
       - name: Enable Rust cache
         if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
@@ -84,13 +84,18 @@ jobs:
         if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
         run: cargo fmt --all -- --check
 
+      - name: Install cross if needed
+        if: matrix.info.cross == true
+        run: |
+          cargo install cross --locked --version=0.2.1
+
       - name: Build tests
         if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
         uses: actions-rs/cargo@v1
         with:
           command: test
           args: --no-run --locked ${{ matrix.features }}
-          use-cross: ${{ matrix.triple.cross }}
+          use-cross: ${{ matrix.info.cross }}
         env:
           RUST_BACKTRACE: full
 
@@ -100,7 +105,7 @@ jobs:
         with:
           command: test
           args: --no-fail-fast ${{ matrix.features }} -- --nocapture --quiet
-          use-cross: ${{ matrix.triple.cross }}
+          use-cross: ${{ matrix.info.cross }}
         env:
           RUST_BACKTRACE: full
 
@@ -110,18 +115,18 @@ jobs:
         with:
           command: clippy
           args: ${{ matrix.features }} --all-targets --workspace -- -D warnings
-          use-cross: ${{ matrix.triple.cross }}
+          use-cross: ${{ matrix.info.cross }}
         env:
           RUST_BACKTRACE: full
 
   # Run cargo check on all other platforms
   other_check:
-    runs-on: ${{ matrix.triple.os }}
+    runs-on: ${{ matrix.info.os }}
     continue-on-error: true
     strategy:
       fail-fast: false
       matrix:
-        triple:
+        info:
           # x86 or x64
           - {
               os: "ubuntu-latest",
@@ -232,19 +237,24 @@ jobs:
         if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
         uses: dtolnay/rust-toolchain@88e7c2e1da2693cf72d58fce9416206818e61dea # https://github.com/dtolnay/rust-toolchain/commit/88e7c2e1da2693cf72d58fce9416206818e61dea
         with:
-          toolchain: ${{ matrix.triple.rust }}
-          target: ${{ matrix.triple.target }}
+          toolchain: ${{ matrix.info.rust }}
+          target: ${{ matrix.info.target }}
 
       - name: Enable Rust cache
         uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # 1.4.0
         if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
         with:
-          key: ${{ matrix.triple.target }}
+          key: ${{ matrix.info.target }}
+
+      - name: Install cross if needed
+        if: matrix.info.cross == true
+        run: |
+          cargo install cross --locked --version=0.2.1
 
       - name: Check
         if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
         uses: actions-rs/cargo@v1
         with:
           command: check
-          args: --all-targets --verbose --target=${{ matrix.triple.target }} --locked
-          use-cross: ${{ matrix.triple.cross }}
+          args: --all-targets --verbose --target=${{ matrix.info.target }} --locked
+          use-cross: ${{ matrix.info.cross }}
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index cb879d86..4a67f147 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -41,8 +41,6 @@ jobs:
 
       - name: Enable Rust cache
         uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # 1.4.0
-        with:
-          key: ${{ matrix.triple.target }}
 
       - name: Install cargo-llvm-cov
         run: |