1
0

3 Commits

Author SHA1 Message Date
a0f032c28b chore: update yycc gh action build script 2026-02-03 15:23:21 +08:00
b51ded2101 chore: add lost cd in CI script 2026-02-02 16:22:32 +08:00
09f07d99f7 fix: fix wrong value hint in clap test.
- remove the bracker (<bla>) in clap test because clap will automatically add it.
2026-02-02 16:21:39 +08:00
14 changed files with 146 additions and 82 deletions

4
.github/scripts/README.md vendored Normal file
View File

@@ -0,0 +1,4 @@
# GitHub Action Scripts
These script files are only used for GitHub Action.
These script files should only be executed in their root directory respectively.

17
.github/scripts/gbenchmark/linux.sh vendored Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
# Create build and install directory
mkdir build install
# Build project
cd build
cmake -DCMAKE_CXX_STANDARD=23 -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Record install directory
cd install
export benchmark_ROOT=$(pwd)
cd ..

17
.github/scripts/gbenchmark/macos.sh vendored Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
# Create build and install directory
mkdir build install
# Build project
cd build
cmake -DCMAKE_CXX_STANDARD=23 -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Record install directory
cd install
export benchmark_ROOT=$(pwd)
cd ..

17
.github/scripts/gbenchmark/windows.bat vendored Normal file
View File

@@ -0,0 +1,17 @@
@ECHO OFF
:: Create build and install directory
MKDIR build
MKDIR install
:: Build project
CD build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 -DBENCHMARK_ENABLE_TESTING=OFF ..
cmake --build . --config Release
cmake --install . --prefix=../install --config Release
CD ..
:: Record install directory
CD install
SET benchmark_ROOT=%CD%
CD ..

17
.github/scripts/gtest/linux.sh vendored Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
# Create build and install directory
mkdir build install
# Build project
cd build
cmake -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Record install directory
cd install
export GTest_ROOT=$(pwd)
cd ..

17
.github/scripts/gtest/macos.sh vendored Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
# Create build and install directory
mkdir build install
# Build project
cd build
cmake -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Record install directory
cd install
export GTest_ROOT=$(pwd)
cd ..

17
.github/scripts/gtest/windows.bat vendored Normal file
View File

@@ -0,0 +1,17 @@
@ECHO OFF
:: Create build and install directory
MKDIR build
MKDIR install
:: Build project
CD build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON ..
cmake --build . --config Release
cmake --install . --prefix=../install --config Release
CD ..
:: Record install directory
CD install
SET GTest_ROOT=%CD%
CD ..

View File

@@ -1,22 +1,19 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
GTest_ROOT="${GTest_ROOT:?GTest_ROOT must be set}"
benchmark_ROOT="${benchmark_ROOT:?benchmark_ROOT must be set}"
# Create build directory and enter it # Create build directory and enter it
mkdir bin mkdir bin
cd bin cd bin
# Create internal build and install directory, then enter it # Create internal build and install directory, then enter it
mkdir build mkdir build
mkdir install mkdir install
cd build
# Build in Release mode # Build in Release mode
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=$benchmark_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 --build .
cmake --install . --prefix=../install cmake --install . --prefix=../install
cd ..
# Back to root directory # Back to root directory
cd .. cd ..
cd ..

View File

@@ -1,22 +1,19 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
GTest_ROOT="${GTest_ROOT:?GTest_ROOT must be set}"
benchmark_ROOT="${benchmark_ROOT:?benchmark_ROOT must be set}"
# Create build directory and enter it # Create build directory and enter it
mkdir bin mkdir bin
cd bin cd bin
# Create internal build and install directory, then enter it # Create internal build and install directory, then enter it
mkdir build mkdir build
mkdir install mkdir install
cd build
# Build in Release mode # Build in Release mode
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=$benchmark_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 --build .
cmake --install . --prefix=../install cmake --install . --prefix=../install
cd ..
# Back to root directory # Back to root directory
cd .. cd ..
cd ..

View File

@@ -6,13 +6,13 @@ CD bin
:: Create internal build and install directory, then enter it :: Create internal build and install directory, then enter it
MKDIR build MKDIR build
MKDIR install MKDIR install
CD build
:: Build with x64 architecture in Release mode :: Build with x64 architecture in Release mode
CD build
cmake -A x64 -DYYCC_BUILD_TEST=ON -DGTest_ROOT=%GTest_ROOT% -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=%benchmark_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 --build . --config Release
cmake --install . --prefix=../install --config Release cmake --install . --prefix=../install --config Release
CD ..
:: Back to root directory :: Back to root directory
CD .. CD ..
CD ..

View File

@@ -23,16 +23,11 @@ jobs:
- name: Build Google Test - name: Build Google Test
shell: bash shell: bash
run: | run: |
# Build Google Test
cd extern/googletest cd extern/googletest
mkdir build install # Build Google Test
cd build source ../../.github/scripts/gtest/linux.sh
cmake -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON -DCMAKE_BUILD_TYPE=Release .. # Record environment variable
cmake --build . echo "GTest_ROOT=$GTest_ROOT" >> "$GITHUB_ENV"
cmake --install . --prefix=../install
cd ..
cd install
echo "GTest_ROOT=$(pwd)" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Fetch Google Benchmark - name: Fetch Google Benchmark
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -43,24 +38,18 @@ jobs:
- name: Build Google Benchmark - name: Build Google Benchmark
shell: bash shell: bash
run: | run: |
# Build Google Benchmark
cd extern/benchmark cd extern/benchmark
# Create symlink to googletest as required by benchmark # Create symlink to googletest as required by benchmark
ln -s ../googletest googletest ln -s ../googletest googletest
mkdir build install # Build Google Benchmark
cd build source ../../.github/scripts/gbenchmark/linux.sh
cmake -DCMAKE_CXX_STANDARD=23 -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release .. # Record environment variable
cmake --build . echo "benchmark_ROOT=$benchmark_ROOT" >> "$GITHUB_ENV"
cmake --install . --prefix=../install
cd ..
cd install
echo "benchmark_ROOT=$(pwd)" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Build YYCC - name: Build YYCC
shell: bash shell: bash
run: | run: |
chmod +x ./.github/linux_build.sh source ./.github/scripts/linux.sh
./.github/linux_build.sh
- name: Run YYCC Test - name: Run YYCC Test
shell: bash shell: bash
run: | run: |

View File

@@ -18,16 +18,11 @@ jobs:
- name: Build Google Test - name: Build Google Test
shell: bash shell: bash
run: | run: |
# Build Google Test
cd extern/googletest cd extern/googletest
mkdir build install # Build Google Test
cd build source ../../.github/scripts/gtest/macos.sh
cmake -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON -DCMAKE_BUILD_TYPE=Release .. # Record environment variable
cmake --build . echo "GTest_ROOT=$GTest_ROOT" >> "$GITHUB_ENV"
cmake --install . --prefix=../install
cd ..
cd install
echo "GTest_ROOT=$(pwd)" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Fetch Google Benchmark - name: Fetch Google Benchmark
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -38,24 +33,18 @@ jobs:
- name: Build Google Benchmark - name: Build Google Benchmark
shell: bash shell: bash
run: | run: |
# Build Google Benchmark
cd extern/benchmark cd extern/benchmark
# Create symlink to googletest as required by benchmark # Create symlink to googletest as required by benchmark
ln -s ../googletest googletest ln -s ../googletest googletest
mkdir build install # Build Google Benchmark
cd build source ../../.github/scripts/gbenchmark/macos.sh
cmake -DCMAKE_CXX_STANDARD=23 -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release .. # Record environment variable
cmake --build . echo "benchmark_ROOT=$benchmark_ROOT" >> "$GITHUB_ENV"
cmake --install . --prefix=../install
cd ..
cd install
echo "benchmark_ROOT=$(pwd)" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Build YYCC - name: Build YYCC
shell: bash shell: bash
run: | run: |
chmod +x ./.github/macos_build.sh source ./.github/scripts/macos.sh
./.github/macos_build.sh
- name: Run YYCC Test - name: Run YYCC Test
shell: bash shell: bash
run: | run: |

View File

@@ -25,20 +25,13 @@ jobs:
- name: Build Google Test - name: Build Google Test
shell: cmd shell: cmd
run: | run: |
CD extern\googletest
:: Build Google Test :: Build Google Test
cd extern/googletest CALL ..\..\.github\scripts\gtest\windows.bat
mkdir build
mkdir install
cd build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON ..
cmake --build . --config Release
cmake --install . --prefix=../install --config Release
cd ..
cd install
:: Idk why I can't use $GITHUB_ENV, so I use this stupid way to do this. :: Idk why I can't use $GITHUB_ENV, so I use this stupid way to do this.
:: This is first entry so we override it. :: This is first entry so we override it.
echo set GTest_ROOT=%CD% > ../../envs.bat ECHO SET GTest_ROOT=%GTest_ROOT% > ..\envs.bat
cd ../.. CD ..\..
- name: Fetch Google Benchmark - name: Fetch Google Benchmark
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@@ -48,21 +41,14 @@ jobs:
- name: Build Google Benchmark - name: Build Google Benchmark
shell: cmd shell: cmd
run: | run: |
:: Build Google Benchmark CD extern\benchmark
cd extern/benchmark
:: Create symlink to googletest as required by benchmark :: Create symlink to googletest as required by benchmark
mklink /D googletest ../googletest mklink /D googletest ..\googletest
mkdir build :: Build Google Benchmark
mkdir install CALL ..\..\.github\scripts\gbenchmark\windows.bat
cd build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 -DBENCHMARK_ENABLE_TESTING=OFF ..
cmake --build . --config Release
cmake --install . --prefix=../install --config Release
cd ..
cd install
:: This is second entry so we append it. :: This is second entry so we append it.
echo set benchmark_ROOT=%CD% >> ../../envs.bat ECHO SET benchmark_ROOT=%benchmark_ROOT% >> ..\envs.bat
cd ../.. CD ..\..
- name: Build YYCC - name: Build YYCC
shell: cmd shell: cmd
run: | run: |
@@ -72,9 +58,9 @@ jobs:
if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
call %VCVARS% ${{ matrix.msvc_arch }} call %VCVARS% ${{ matrix.msvc_arch }}
:: Extract saved environment variables :: Extract saved environment variables
call .\extern\envs.bat CALL .\extern\envs.bat
:: Build Project :: Build Project
.\.github\windows_build.bat CALL .\.github\scripts\windows.bat
- name: Run YYCC Test - name: Run YYCC Test
shell: cmd shell: cmd
run: | run: |

View File

@@ -72,10 +72,10 @@ namespace yycctest::carton::clap {
// Add options // Add options
auto options = CLAP::option::OptionCollection(); auto options = CLAP::option::OptionCollection();
int_option = options.add_option(CLAP::option::Option(u8"i", u8"int", u8"<integer>", u8"integral argument")); int_option = options.add_option(CLAP::option::Option(u8"i", u8"int", u8"integer", u8"integral argument"));
float_option = options.add_option(CLAP::option::Option(u8"f", std::nullopt, u8"<float>", u8"")); float_option = options.add_option(CLAP::option::Option(u8"f", std::nullopt, u8"float", u8""));
string_option = options.add_option(CLAP::option::Option(std::nullopt, u8"string", u8"<string>", u8"")); string_option = options.add_option(CLAP::option::Option(std::nullopt, u8"string", u8"string", u8""));
clamped_float_option = options.add_option(CLAP::option::Option(std::nullopt, u8"clamped-float", u8"<float>", u8"")); clamped_float_option = options.add_option(CLAP::option::Option(std::nullopt, u8"clamped-float", u8"float", u8""));
novalue_option = options.add_option(CLAP::option::Option(u8"b", std::nullopt, std::nullopt, u8"")); novalue_option = options.add_option(CLAP::option::Option(u8"b", std::nullopt, std::nullopt, u8""));
// Add variables // Add variables