From 6449ae197712a74fb4a6c01a1711430eb300075c Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Thu, 22 Jan 2026 16:24:21 +0800 Subject: [PATCH] chore: use github provided package to fetch dependencies --- .github/linux_build.sh | 2 +- .github/macos_build.sh | 2 +- .github/windows_build.bat | 2 +- .github/workflows/linux.yml | 22 +++++++++++++++++----- .github/workflows/macos.yml | 22 +++++++++++++++++----- .github/workflows/windows.yml | 22 +++++++++++++++++----- 6 files changed, 54 insertions(+), 18 deletions(-) diff --git a/.github/linux_build.sh b/.github/linux_build.sh index 56e82f3..7e6e571 100644 --- a/.github/linux_build.sh +++ b/.github/linux_build.sh @@ -10,7 +10,7 @@ mkdir install cd build # Build in Release mode -cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT ../.. +cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=$benchmark_ROOT ../.. cmake --build . cmake --install . --prefix=../install diff --git a/.github/macos_build.sh b/.github/macos_build.sh index 56e82f3..7e6e571 100644 --- a/.github/macos_build.sh +++ b/.github/macos_build.sh @@ -10,7 +10,7 @@ mkdir install cd build # Build in Release mode -cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT ../.. +cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=$benchmark_ROOT ../.. cmake --build . cmake --install . --prefix=../install diff --git a/.github/windows_build.bat b/.github/windows_build.bat index b0d6ada..e89058d 100644 --- a/.github/windows_build.bat +++ b/.github/windows_build.bat @@ -9,7 +9,7 @@ MKDIR install CD build :: Build with x64 architecture in Release mode -cmake -A x64 -DYYCC_BUILD_TEST=ON -DGTest_ROOT=%GTest_ROOT% ../.. +cmake -A x64 -DYYCC_BUILD_TEST=ON -DGTest_ROOT=%GTest_ROOT% -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=%benchmark_ROOT% ../.. cmake --build . --config Release cmake --install . --prefix=../install --config Release diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ee391e2..1356296 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -13,10 +13,15 @@ jobs: run: | sudo apt update sudo apt install -y build-essential cmake git - - name: Setup Google Test and Google Benchmark + - name: Fetch Google Test + uses: actions/checkout@v4 + with: + repository: 'google/googletest' + ref: 'v1.17.0' + path: 'extern/googletest' + - name: Build Google Test run: | - # Setup Google Test - git clone -b v1.17.0 https://github.com/google/googletest.git --depth 1 extern/googletest + # Build Google Test cd extern/googletest mkdir build install cd build @@ -27,8 +32,15 @@ jobs: cd install export GTest_ROOT=$(pwd) cd ../.. - # Setup Google Benchmark - git clone -b v1.9.4 https://github.com/google/benchmark.git --depth 1 extern/benchmark + - name: Fetch Google Benchmark + uses: actions/checkout@v4 + with: + repository: 'google/benchmark' + ref: 'v1.9.4' + path: 'extern/benchmark' + - name: Build Google Benchmark + run: | + # Build Google Benchmark cd extern/benchmark # Create symlink to googletest as required by benchmark ln -s ../googletest googletest diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6d9f1da..a8b9d10 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -9,10 +9,15 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Google Test and Google Benchmark + - name: Fetch Google Test + uses: actions/checkout@v4 + with: + repository: 'google/googletest' + ref: 'v1.17.0' + path: 'extern/googletest' + - name: Build Google Test run: | - # Setup Google Test - git clone -b v1.17.0 https://github.com/google/googletest.git --depth 1 extern/googletest + # Build Google Test cd extern/googletest mkdir build install cd build @@ -23,8 +28,15 @@ jobs: cd install export GTest_ROOT=$(pwd) cd ../.. - # Setup Google Benchmark - git clone -b v1.9.4 https://github.com/google/benchmark.git --depth 1 extern/benchmark + - name: Fetch Google Benchmark + uses: actions/checkout@v4 + with: + repository: 'google/benchmark' + ref: 'v1.9.4' + path: 'extern/benchmark' + - name: Build Google Benchmark + run: | + # Build Google Benchmark cd extern/benchmark # Create symlink to googletest as required by benchmark ln -s ../googletest googletest diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 998fa2e..555f92e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,10 +16,15 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Google Test and Google Benchmark + - name: Fetch Google Test + uses: actions/checkout@v4 + with: + repository: 'google/googletest' + ref: 'v1.17.0' + path: 'extern/googletest' + - name: Build Google Test run: | - # Setup Google Test - git clone -b v1.17.0 https://github.com/google/googletest.git --depth 1 extern/googletest + # Build Google Test cd extern/googletest mkdir build install cd build @@ -30,8 +35,15 @@ jobs: cd install set GTest_ROOT=%CD% cd ../.. - # Setup Google Benchmark - git clone -b v1.9.4 https://github.com/google/benchmark.git --depth 1 extern/benchmark + - name: Fetch Google Benchmark + uses: actions/checkout@v4 + with: + repository: 'google/benchmark' + ref: 'v1.9.4' + path: 'extern/benchmark' + - name: Build Google Benchmark + run: | + # Build Google Benchmark cd extern/benchmark # Create symlink to googletest as required by benchmark mklink /D googletest ../googletest