From 76335f69316fa4a29a75c782a90fa13af39c73d2 Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 4 Oct 2024 21:21:18 +0800 Subject: [PATCH] ci: fix windows pipeline --- .github/scripts/install-all-deps.sh | 12 ++++++++++++ .github/scripts/install-openssl.sh | 18 ++++++++++++++++++ ...lippy-before-script.sh => install-proto.sh} | 2 -- .github/workflows/cargo.yml | 4 +--- .github/workflows/release-artifacts.yml | 5 +---- 5 files changed, 32 insertions(+), 9 deletions(-) create mode 100755 .github/scripts/install-all-deps.sh create mode 100644 .github/scripts/install-openssl.sh rename .github/scripts/{cargo-clippy-before-script.sh => install-proto.sh} (79%) mode change 100755 => 100644 diff --git a/.github/scripts/install-all-deps.sh b/.github/scripts/install-all-deps.sh new file mode 100755 index 00000000000000..33d154453795c3 --- /dev/null +++ b/.github/scripts/install-all-deps.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +os_name="$1" + +# shellcheck source=.github/scripts/install-openssl.sh +source "$here/install-openssl.sh" "$os_name" +# shellcheck source=.github/scripts/install-proto.sh +source "$here/install-proto.sh" "$os_name" diff --git a/.github/scripts/install-openssl.sh b/.github/scripts/install-openssl.sh new file mode 100644 index 00000000000000..1bbcbd01a3773b --- /dev/null +++ b/.github/scripts/install-openssl.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -e + +os_name="$1" + +case "$os_name" in +"Windows") + choco install openssl --version 3.3.2 --install-arguments="'/DIR=C:\OpenSSL'" -y + export OPENSSL_LIB_DIR="C:\OpenSSL\lib\VC\x64\MT" + export OPENSSL_INCLUDE_DIR="C:\OpenSSL\include" + ;; +"macOS") ;; +"Linux") ;; +*) + echo "Unknown Operating System" + ;; +esac diff --git a/.github/scripts/cargo-clippy-before-script.sh b/.github/scripts/install-proto.sh old mode 100755 new mode 100644 similarity index 79% rename from .github/scripts/cargo-clippy-before-script.sh rename to .github/scripts/install-proto.sh index bba03060877434..478847562fdc0f --- a/.github/scripts/cargo-clippy-before-script.sh +++ b/.github/scripts/install-proto.sh @@ -6,8 +6,6 @@ os_name="$1" case "$os_name" in "Windows") - vcpkg install openssl:x64-windows-static-md - vcpkg integrate install choco install protoc export PROTOC='C:\ProgramData\chocolatey\lib\protoc\tools\bin\protoc.exe' ;; diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index b78d9d66de4016..0aa734792edf37 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -41,11 +41,9 @@ jobs: with: version: "v0.8.1" - - shell: bash - run: .github/scripts/cargo-clippy-before-script.sh ${{ runner.os }} - - shell: bash run: | + source .github/scripts/install-all-deps.sh ${{ runner.os }} source ci/rust-version.sh nightly rustup component add clippy --toolchain "$rust_nightly" scripts/cargo-clippy-nightly.sh diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml index 8b1da1d7e28426..07b8f468222e1f 100644 --- a/.github/workflows/release-artifacts.yml +++ b/.github/workflows/release-artifacts.yml @@ -43,10 +43,7 @@ jobs: id: build shell: bash run: | - vcpkg install openssl:x64-windows-static-md - vcpkg integrate install - choco install protoc - export PROTOC="C:\ProgramData\chocolatey\lib\protoc\tools\bin\protoc.exe" + source .github/scripts/install-all-deps.sh ${{ runner.os }} source /tmp/env.sh echo "tag=$CI_TAG" >> $GITHUB_OUTPUT eval "$(ci/channel-info.sh)"