From b3bf5fd30f9b31945ebcbc0349c7959efb5dc191 Mon Sep 17 00:00:00 2001 From: Xynnn007 Date: Tue, 15 Oct 2024 14:15:01 +0800 Subject: [PATCH] ci: replace Rust toolchain with actions-rust-lang/setup-rust-toolchain@v1 The original way to install rust dependency will not check if rust is already installed, thus it would require `rustup` be installed on the ci machine already while self-hosted CI machine may not. We use `actions-rust-lang/setup-rust-toolchain@v1` to install rust because `actions-rs` has not been maintained for over 1 year and is archived. Signed-off-by: Xynnn007 --- .github/workflows/as-e2e.yml | 8 ++++---- .github/workflows/as-rust.yml | 8 ++++---- .github/workflows/kbs-docker-e2e.yml | 8 ++++---- .github/workflows/kbs-e2e.yml | 9 +++++---- .github/workflows/kbs-rust.yml | 9 ++++----- .github/workflows/push-kbs-client-to-ghcr.yml | 8 ++++---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/as-e2e.yml b/.github/workflows/as-e2e.yml index fde6456ee..1ba4b9cdd 100644 --- a/.github/workflows/as-e2e.yml +++ b/.github/workflows/as-e2e.yml @@ -35,10 +35,10 @@ jobs: - uses: actions/checkout@v4 - name: Install Rust toolchain (${{ env.RUSTC_VERSION }}) - run: | - rustup update --no-self-update ${{ env.RUSTC_VERSION }} - rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustc - rustup default ${{ env.RUSTC_VERSION }} + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.RUSTC_VERSION }} + components: rustfmt, clippy - uses: actions/setup-go@v5 with: diff --git a/.github/workflows/as-rust.yml b/.github/workflows/as-rust.yml index 858757826..aa225e907 100644 --- a/.github/workflows/as-rust.yml +++ b/.github/workflows/as-rust.yml @@ -58,10 +58,10 @@ jobs: sudo apt-get install -y libsgx-dcap-quote-verify-dev libsgx-dcap-default-qpl - name: Install Rust toolchain (${{ env.RUSTC_VERSION }}) - run: | - rustup update --no-self-update ${{ env.RUSTC_VERSION }} - rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustfmt rustc clippy - rustup default ${{ env.RUSTC_VERSION }} + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.RUSTC_VERSION }} + components: rustfmt, clippy - name: Build working-directory: attestation-service diff --git a/.github/workflows/kbs-docker-e2e.yml b/.github/workflows/kbs-docker-e2e.yml index 24f5f8863..3d75f6f9c 100644 --- a/.github/workflows/kbs-docker-e2e.yml +++ b/.github/workflows/kbs-docker-e2e.yml @@ -19,10 +19,10 @@ jobs: uses: actions/checkout@v4 - name: Install Rust ${{ env.RUSTC_VERSION }} (for client) - run: | - rustup update --no-self-update ${{ env.RUSTC_VERSION }} - rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustc - rustup default ${{ env.RUSTC_VERSION }} + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.RUSTC_VERSION }} + components: rustfmt, clippy - name: Build client run: | diff --git a/.github/workflows/kbs-e2e.yml b/.github/workflows/kbs-e2e.yml index 7c7c7e473..6ecbeecad 100644 --- a/.github/workflows/kbs-e2e.yml +++ b/.github/workflows/kbs-e2e.yml @@ -33,10 +33,11 @@ jobs: run: tar xzf ./artifact/${{ inputs.tarball }} - name: Install Rust toolchain (${{ env.RUSTC_VERSION }}) - run: | - rustup update --no-self-update ${{ env.RUSTC_VERSION }} - rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustc - rustup default ${{ env.RUSTC_VERSION }} + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.RUSTC_VERSION }} + components: rustfmt, clippy + rustflags: "" - name: Set up rust build cache uses: actions/cache@v4 diff --git a/.github/workflows/kbs-rust.yml b/.github/workflows/kbs-rust.yml index f99c102a2..7207933d2 100644 --- a/.github/workflows/kbs-rust.yml +++ b/.github/workflows/kbs-rust.yml @@ -31,11 +31,10 @@ jobs: uses: actions/checkout@v4 - name: Install Rust toolchain (${{ env.RUSTC_VERSION }}) - run: | - rustup update --no-self-update ${{ env.RUSTC_VERSION }} - rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustfmt rustc clippy - rustup target add x86_64-unknown-linux-gnu - rustup default ${{ env.RUSTC_VERSION }} + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.RUSTC_VERSION }} + components: rustfmt, clippy - name: Building dependencies installation run: | diff --git a/.github/workflows/push-kbs-client-to-ghcr.yml b/.github/workflows/push-kbs-client-to-ghcr.yml index 49c5d3535..22d5c28d1 100644 --- a/.github/workflows/push-kbs-client-to-ghcr.yml +++ b/.github/workflows/push-kbs-client-to-ghcr.yml @@ -25,10 +25,10 @@ jobs: uses: actions/checkout@v4 - name: Install Rust toolchain (${{ env.RUSTC_VERSION }}) - run: | - rustup update --no-self-update ${{ env.RUSTC_VERSION }} - rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustc - rustup default ${{ env.RUSTC_VERSION }} + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.RUSTC_VERSION }} + components: rustfmt, clippy - name: Log in to ghcr.io uses: docker/login-action@v3