From 72507b8b8563b8fb61a11b51689a7032989643b4 Mon Sep 17 00:00:00 2001 From: Henrik Friedrichsen Date: Sun, 4 Feb 2024 21:46:30 +0100 Subject: [PATCH] ci: Switch to `rustup` over 3rd party action --- .github/workflows/cd.yml | 16 +++++++++++----- .github/workflows/ci.yml | 33 ++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6844a2cf..1ed98b9f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -52,11 +52,16 @@ jobs: target: x86_64-pc-windows-msvc features: '--no-default-features --features rodio_backend,pancurses_backend,share_clipboard,notify' steps: - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} - toolchain: stable + - name: Install rustup + if: runner.os != 'Windows' + shell: bash + run: | + if ! command -v rustup &>/dev/null; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH + fi + - name: Add cross-compilation target + run: rustup target add ${{ matrix.target }} - name: Install macOS dependencies if: matrix.os == 'macos-latest' run: brew install portaudio pkg-config @@ -66,6 +71,7 @@ jobs: dpkg --add-architecture ${{ matrix.cross_arch }} echo "PKG_CONFIG_PATH=${{ matrix.pkg_config_path }}" >> $GITHUB_ENV echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV + echo "targets = [\"${{ matrix.target }}\"]" >> rust-toolchain.toml - name: Install Linux dependencies if: startsWith(matrix.build_target, 'linux-') run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f246ad20..f375c261 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,11 +41,16 @@ jobs: ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} - components: clippy, rustfmt + - name: Install rustup + if: runner.os != 'Windows' + shell: bash + run: | + if ! command -v rustup &>/dev/null; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --target ${{ matrix.target }} -y + echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH + fi + - name: Install clippy + rustfmt + run: rustup component add clippy rustfmt - name: Install macOS dependencies if: matrix.os == 'macos-latest' run: brew install portaudio pkg-config @@ -65,11 +70,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - target: x86_64-unknown-linux-gnu - components: clippy, rustfmt + - name: Install rustup + run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + - name: Install clippy + rustfmt + run: rustup component add rustfmt - name: cargo fmt run: cargo fmt --all -- --check @@ -90,11 +94,10 @@ jobs: ~/.cargo/git/db/ target/ key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - target: x86_64-unknown-linux-gnu - components: clippy, rustfmt + - name: Install rustup + run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + - name: Install clippy + rustfmt + run: rustup component add clippy - name: Install Linux dependencies run: | sudo apt update