From af9051df58e7884678e8c48348ba0acfe7e6bfab Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 22:13:26 +0800 Subject: [PATCH] add std test. --- .github/workflows/build-classic.yml | 14 +++---- .github/workflows/build-gcc-std.yml | 60 ++++++++++++++++++++++++++ .github/workflows/build-msvc-std.yml | 63 ++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build-gcc-std.yml create mode 100644 .github/workflows/build-msvc-std.yml diff --git a/.github/workflows/build-classic.yml b/.github/workflows/build-classic.yml index 436b675..90c083f 100644 --- a/.github/workflows/build-classic.yml +++ b/.github/workflows/build-classic.yml @@ -60,15 +60,15 @@ jobs: g++ --version - name: Configure - run: >- - cmake -B build - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S . + run: | + mkdir -p build + pushd build + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTD=11 .. + popd - name: Build - run: >- - cmake --build build - --config ${{ matrix.build_type }} + run: | + cmake --build build --config ${{ matrix.build_type }} - name: Test working-directory: build diff --git a/.github/workflows/build-gcc-std.yml b/.github/workflows/build-gcc-std.yml new file mode 100644 index 0000000..f610cf6 --- /dev/null +++ b/.github/workflows/build-gcc-std.yml @@ -0,0 +1,60 @@ +name: Build GCC-std + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-gcc-std: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ ubuntu-latest ] + build_type: [ Release ] + std: [ '17', '14', '11' ] + + name: "On ${{matrix.os}} gcc -std=c++${{matrix.std}}" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure + run: > + cmake -B "${{ steps.strings.outputs.build-output-dir }}" + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S "${{ github.workspace }}" + + - name: Build + run: >- + cmake --build "${{ steps.strings.outputs.build-output-dir }}" + -DSTD=${{ matrix.std }} + --config ${{ matrix.build_type }} + + - name: Test + working-directory: "${{ steps.strings.outputs.build-output-dir }}" + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/build-msvc-std.yml b/.github/workflows/build-msvc-std.yml new file mode 100644 index 0000000..abd62de --- /dev/null +++ b/.github/workflows/build-msvc-std.yml @@ -0,0 +1,63 @@ +name: Build MSVC-std + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-msvc-std: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ windows-latest ] + build_type: [ Release ] + cl: [ cl ] + std: [ '17', '14', '11' ] + + name: "On ${{matrix.os}} cl -std=c++${{matrix.std}}" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure + run: > + cmake -B "${{ steps.strings.outputs.build-output-dir }}" + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S "${{ github.workspace }}" + + - name: Build + run: >- + cmake --build "${{ steps.strings.outputs.build-output-dir }}" + -DSTD=${{ matrix.std }} + -DCMAKE_CXX_COMPILER=${{ matrix.cl }} + -DCMAKE_C_COMPILER=${{ matrix.cl }} + --config ${{ matrix.build_type }} + + - name: Test + working-directory: "${{ steps.strings.outputs.build-output-dir }}" + run: ctest --output-on-failure --build-config ${{ matrix.build_type }}