From dfc4d50a1223467711d70b118c3f38d96307c830 Mon Sep 17 00:00:00 2001 From: Giuliano Bellini s294739 Date: Thu, 11 Jan 2024 22:05:31 +0100 Subject: [PATCH] substituted rust toolchain in CI (from actions-rs to dtlonay) --- .github/workflows/package.yml | 57 +++++++++++--------------------- .github/workflows/rust.yml | 61 +++++++---------------------------- 2 files changed, 30 insertions(+), 88 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index f3267464..f21e222c 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -64,25 +64,9 @@ jobs: Write-Host "::endgroup::" - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - profile: minimal - default: true - - - name: Add build targets - if: ${{ matrix.os == 'macos' }} - run: | - rustup target add \ - x86_64-apple-darwin \ - aarch64-apple-darwin - - - name: Add build targets - if: ${{ matrix.os == 'windows' }} - run: | - rustup target add ` - i686-pc-windows-msvc ` - x86_64-pc-windows-msvc + targets: ${{ matrix.target }} - name: Install Cross if: ${{ matrix.os == 'ubuntu' }} @@ -94,10 +78,7 @@ jobs: - name: Build binary if: ${{ matrix.os == 'macos' || matrix.os == 'windows' }} - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --target ${{ matrix.target }} + run: cargo build --release --target ${{ matrix.target }} - name: Upload build artifacts uses: actions/upload-artifact@v4 @@ -134,11 +115,9 @@ jobs: run: apt update -y && apt install -y curl build-essential - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - profile: minimal - default: true + targets: ${{ matrix.target }} - name: Install packaging tools run: cargo install cargo-deb @@ -147,6 +126,7 @@ jobs: with: name: build-ubuntu-${{ matrix.target }} path: target/ + if-no-files-found: error - name: Package for Debian-based Linux distros shell: bash @@ -160,6 +140,7 @@ jobs: with: name: deb-${{ matrix.arch }} path: artifacts/ + if-no-files-found: error rpm: runs-on: ubuntu-latest @@ -183,11 +164,9 @@ jobs: run: dnf update -y && dnf install -y @development-tools patchelf - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - profile: minimal - default: true + targets: ${{ matrix.target }} - name: Install packaging tools run: cargo install cargo-generate-rpm @@ -196,6 +175,7 @@ jobs: with: name: build-ubuntu-${{ matrix.target }} path: target/ + if-no-files-found: error - name: Package for RPM-based Linux distros shell: bash @@ -210,6 +190,7 @@ jobs: with: name: rpm-${{ matrix.arch }} path: artifacts/ + if-no-files-found: error dmg: runs-on: macos-latest @@ -228,11 +209,7 @@ jobs: uses: actions/checkout@v4 - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - default: true + uses: dtolnay/rust-toolchain@stable - name: Install packaging tools run: | @@ -243,6 +220,7 @@ jobs: with: name: build-macos-${{ matrix.target }} path: target/ + if-no-files-found: error - name: Package for macOS shell: bash @@ -277,6 +255,7 @@ jobs: with: name: dmg-${{ matrix.arch }} path: artifacts/ + if-no-files-found: error msi: runs-on: windows-latest @@ -306,11 +285,9 @@ jobs: Write-Host "::endgroup::" - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - profile: minimal - default: true + targets: ${{ matrix.target }} - name: Install packaging tools run: cargo install cargo-wix @@ -319,6 +296,7 @@ jobs: with: name: build-windows-${{ matrix.target }} path: target/ + if-no-files-found: error - name: Package for Microsoft Windows shell: powershell @@ -332,3 +310,4 @@ jobs: with: name: msi-${{ matrix.arch }} path: artifacts/ + if-no-files-found: error diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3d03d799..2774cae4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,27 +23,15 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true - - name: install fmt - run: rustup component add rustfmt - - name: install clippy - run: rustup component add clippy + components: rustfmt, clippy - name: fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check - name: build run: cargo build --verbose - name: clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + run: cargo clippy -- -D warnings - name: test run: cargo test --verbose @@ -52,33 +40,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true + components: rustfmt, clippy - name: Install libpcap run: sudo apt-get install libpcap-dev - name: Install dependency for alsa-sys run: sudo apt-get install libasound2-dev - name: Install dependency for rfd run: sudo apt-get install libgtk-3-dev - - name: install fmt - run: rustup component add rustfmt - - name: install clippy - run: rustup component add clippy - name: fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check - name: build run: cargo build --verbose - name: clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + run: cargo clippy -- -D warnings - name: test run: cargo test --verbose @@ -87,11 +63,9 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true + components: rustfmt, clippy - name: Install npcap sdk run: | Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "C:/npcap-sdk.zip" @@ -104,25 +78,14 @@ jobs: run: | Invoke-WebRequest -Uri ${{secrets.NPCAP_OEM_URL}} -OutFile C:/npcap-oem.exe C:/npcap-oem.exe /S - - name: install fmt - run: rustup component add rustfmt - - name: install clippy - run: rustup component add clippy - name: fmt - if: github.event_name != 'pull_request' - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check - name: build if: github.event_name != 'pull_request' run: cargo build --verbose - name: clippy if: github.event_name != 'pull_request' - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + run: cargo clippy -- -D warnings - name: test if: github.event_name != 'pull_request' run: cargo test --verbose