Skip to content

Commit

Permalink
refactor: remove all Rust version references from .yml files (#3286)
Browse files Browse the repository at this point in the history
Makes it easier to update Rust toolchain. Mirrors dfinity/cycles-ledger#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: actions-rs/toolchain#126 (comment)
  • Loading branch information
sesi200 authored Aug 8, 2023
1 parent ff882af commit 133ac66
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 61 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down Expand Up @@ -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: |
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [ '1.71.1' ]
os: [ ubuntu-latest ]

steps:
Expand All @@ -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:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: [ '1.71.1' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
Expand All @@ -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:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/prepare-dfx-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: [ '1.71.1' ]
os: [ ubuntu-latest, macos-latest ]
steps:
- uses: actions/checkout@v3
Expand All @@ -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
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: [ '1.71.1' ]
os: [ ubuntu-latest, macos-latest ]
steps:
- uses: actions/checkout@v3
Expand All @@ -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

Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: ["1.71.1"]
os: [ ubuntu-20.04 ]
steps:
- uses: actions/[email protected]
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion scripts/workflows/audit-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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() ]
Expand Down
1 change: 0 additions & 1 deletion scripts/workflows/e2e-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 133ac66

Please sign in to comment.