From 133ac66a7daec782e8033168ff873a224bd3127c Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 8 Aug 2023 12:14:45 +0200 Subject: [PATCH] refactor: remove all Rust version references from .yml files (#3286) Makes it easier to update Rust toolchain. Mirrors https://github.com/dfinity/cycles-ledger/pull/20 `@actions-rs/toolchain` does not support `rust-toolchain.toml` so I removed that action and replaced it with `rustup show` as per this comment: https://github.com/actions-rs/toolchain/issues/126#issuecomment-760081772 --- .github/workflows/audit.yml | 6 +----- .github/workflows/e2e.yml | 18 ++++++------------ .github/workflows/fmt.yml | 7 +------ .github/workflows/lint.yml | 7 +------ .github/workflows/prepare-dfx-assets.yml | 7 +------ .github/workflows/publish.yml | 17 +++++------------ .github/workflows/unit.yml | 7 +------ .github/workflows/update-docs.yml | 7 +------ scripts/workflows/audit-matrix.py | 1 - scripts/workflows/e2e-matrix.py | 1 - 10 files changed, 17 insertions(+), 61 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 4ff23ed686..18c74c9094 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -50,12 +50,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust - run: | - rustup update ${{ matrix.rust }} --no-self-update - rustup default ${{ matrix.rust }} - cargo install --force --version ${{ matrix.cargo-audit }} cargo-audit --locked + run: rustup show - name: Audit # ignores RUSTSEC-2020-0071 because it is 'only' in a dev dependency (ic-certified-responses -> ic-types -> chrono -> time) run: | diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 92720205fa..d5a2a00108 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -21,7 +21,6 @@ jobs: strategy: fail-fast: false matrix: - rust: [ '1.71.1' ] # We build a dynamic-linked linux binary because otherwise HSM support fails with: # Error: IO: Dynamic loading not supported os: [ macos-12, ubuntu-20.04, ubuntu-22.04 ] @@ -49,13 +48,9 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}-1 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true + key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}-1 + - name: Install Rust + run: rustup show if: contains(matrix.os, 'macos') - name: Build run: | @@ -69,7 +64,7 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v3 with: - name: dfx-${{ matrix.os }}-rs-${{ matrix.rust }} + name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} path: ${{ matrix.binary_path }}/dfx list_tests: @@ -93,13 +88,12 @@ jobs: # /home/runner/.cache/dfinity/versions/0.8.3-34-g36e39809/ic-starter: # /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found os: [macos-12, ubuntu-20.04, ubuntu-22.04] - rust: ["1.71.1"] steps: - uses: actions/checkout@v3 - name: Download dfx binary uses: actions/download-artifact@v3 with: - name: dfx-${{ matrix.os }}-rs-${{ matrix.rust }} + name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} path: /usr/local/bin - name: Setup dfx binary run: chmod +x /usr/local/bin/dfx @@ -132,7 +126,7 @@ jobs: - name: Download dfx binary uses: actions/download-artifact@v3 with: - name: dfx-${{ matrix.os }}-rs-${{ matrix.rust }} + name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} path: /usr/local/bin - name: Setup dfx binary run: chmod +x /usr/local/bin/dfx diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml index 87d2f669a9..e356f9bda9 100644 --- a/.github/workflows/fmt.yml +++ b/.github/workflows/fmt.yml @@ -18,7 +18,6 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - rust: [ '1.71.1' ] os: [ ubuntu-latest ] steps: @@ -32,12 +31,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1 - - name: Install Rust - run: | - rustup update ${{ matrix.rust }} --no-self-update - rustup default ${{ matrix.rust }} - rustup component add rustfmt + run: rustup show - name: Run Cargo Fmt run: cargo fmt --all -- --check env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 873c2ef3f5..a55c4b5575 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,6 @@ jobs: strategy: fail-fast: false matrix: - rust: [ '1.71.1' ] os: [ ubuntu-latest, macos-latest, windows-latest ] steps: @@ -32,12 +31,8 @@ jobs: ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust - run: | - rustup update ${{ matrix.rust }} --no-self-update - rustup default ${{ matrix.rust }} - rustup component add clippy + run: rustup show - name: Run Lint run: cargo clippy --verbose --tests --benches --workspace -- -D clippy::all env: diff --git a/.github/workflows/prepare-dfx-assets.yml b/.github/workflows/prepare-dfx-assets.yml index 07b5a43a5a..48a9455097 100644 --- a/.github/workflows/prepare-dfx-assets.yml +++ b/.github/workflows/prepare-dfx-assets.yml @@ -24,7 +24,6 @@ jobs: strategy: fail-fast: false matrix: - rust: [ '1.71.1' ] os: [ ubuntu-latest, macos-latest ] steps: - uses: actions/checkout@v3 @@ -37,11 +36,7 @@ jobs: !target/*/build/dfx-*/out/dfx-assets key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install Rust - run: | - rustup update ${{ matrix.rust }} --no-self-update - rustup component add clippy - rustup default ${{ matrix.rust }} - + run: rustup show - name: Run build script run: | cargo check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fd64a4f661..56dc8f6d1a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,7 +27,6 @@ jobs: strategy: fail-fast: false matrix: - rust: [ '1.71.1' ] # We build a dynamic-linked linux binary because otherwise HSM support fails with: # Error: IO: Dynamic loading not supported target: [ x86_64-apple-darwin, x86_64-unknown-linux-gnu ] @@ -63,14 +62,9 @@ jobs: path: | ~/.cargo/registry ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}-publish-1 - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}-publish-1 + - name: Install Rust + run: rustup show if: contains(matrix.os, 'macos') - name: Build @@ -120,7 +114,7 @@ jobs: if: github.ref_type == 'tag' uses: actions/upload-artifact@v3 with: - name: dfx-artifacts-${{ matrix.rust }}-${{ matrix.name }} + name: dfx-artifacts-${{ hashFiles('rust-toolchain.toml') }}-${{ matrix.name }} path: | ${{ env.TARBALL_FILENAME }} ${{ env.SHA256_FILENAME }} @@ -142,7 +136,6 @@ jobs: strategy: fail-fast: false matrix: - rust: [ '1.71.1' ] name: [ 'x86_64-darwin', 'x86_64-linux' ] steps: - name: Setup environment variables @@ -151,7 +144,7 @@ jobs: - name: Download Artifacts uses: actions/download-artifact@v3 with: - name: dfx-artifacts-${{ matrix.rust }}-${{ matrix.name }} + name: dfx-artifacts-${{ hashFiles('rust-toolchain.toml') }}-${{ matrix.name }} - name: Upload tarball and sha256 uses: svenstaro/upload-release-action@v2 diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 6549584fb0..6e26d8a7f3 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -21,7 +21,6 @@ jobs: strategy: fail-fast: false matrix: - rust: [ '1.71.1' ] os: [ ubuntu-latest, macos-latest ] steps: - uses: actions/checkout@v3 @@ -33,11 +32,7 @@ jobs: target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install Rust - run: | - rustup update ${{ matrix.rust }} --no-self-update - rustup component add clippy - rustup default ${{ matrix.rust }} - + run: rustup show - name: Check cargo test run: cargo test --workspace --all-features --no-fail-fast diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index 122d7d4289..a522efcdde 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -20,7 +20,6 @@ jobs: strategy: fail-fast: false matrix: - rust: ["1.71.1"] os: [ ubuntu-20.04 ] steps: - uses: actions/checkout@v3.0.2 @@ -29,11 +28,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{github.event.pull_request.head.repo.full_name}} - name: Install Rust - run: | - rustup update ${{ matrix.rust }} --no-self-update - rustup component add clippy - rustup default ${{ matrix.rust }} - + run: rustup show - name: Check cargo build run: cargo build - name: Show download worked diff --git a/scripts/workflows/audit-matrix.py b/scripts/workflows/audit-matrix.py index 087f50f519..3816dc53d3 100755 --- a/scripts/workflows/audit-matrix.py +++ b/scripts/workflows/audit-matrix.py @@ -9,7 +9,6 @@ def get_cargo_audit_ref(): return data[ 'advisory-db']['rev'] matrix = { - 'rust': [ '1.71.1' ], 'os': [ 'macos-latest', 'ubuntu-latest' ], 'cargo-audit': [ '0.17.4' ], 'advisory-db-rev': [ get_cargo_audit_ref() ] diff --git a/scripts/workflows/e2e-matrix.py b/scripts/workflows/e2e-matrix.py index ba909eeb12..e9fa2f521f 100755 --- a/scripts/workflows/e2e-matrix.py +++ b/scripts/workflows/e2e-matrix.py @@ -17,7 +17,6 @@ def test_scripts(prefix): "test": test, "backend": ["ic-ref", "replica"], "os": ["macos-12", "ubuntu-20.04"], - "rust": ["1.71.1"], "exclude": [ {"backend": "ic-ref", "test": "dfx/bitcoin"}, {"backend": "ic-ref", "test": "dfx/canister_http"},