From 01e024f62f6f04a71d5ab4838d3713db93118eb1 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:05:51 -0500 Subject: [PATCH 1/8] add ci --- ci_tests.yml | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 ci_tests.yml diff --git a/ci_tests.yml b/ci_tests.yml new file mode 100644 index 0000000..07ed3cc --- /dev/null +++ b/ci_tests.yml @@ -0,0 +1,130 @@ +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +name: Continuous Integration Tests + +on: + push: + pull_request: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + schedule: + - cron: '30 15 * * *' + +jobs: + preset-test: + runs-on: ubuntu-latest + strategy: + matrix: + preset: ["gcc-debug", "gcc-release"] + name: "Preset Test: ${{ matrix.preset }}" + steps: + - uses: actions/checkout@v4 + - name: Setup build environment + uses: lukka/get-cmake@latest + with: + cmakeVersion: "~3.25.0" + ninjaVersion: "^1.11.1" + - name: Run preset + run: cmake --workflow --preset ${{ matrix.preset }} + + test: + strategy: + fail-fast: false + matrix: + platform: [ubuntu-latest] + compiler: + - cpp: g++ + c: gcc + - cpp: clang++ + c: clang + cpp_version: [17, 20, 23, 26] + cmake_args: + - description: "Default" + args: "" + - description: "TSan" + args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread" + - description: "ASan" + args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined" + include: + - platform: ubuntu-latest + compiler: + cpp: g++ + c: gcc + cpp_version: 17 + cmake_args: + description: "Werror" + cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" + - platform: ubuntu-latest + compiler: + cpp: g++ + c: gcc + cpp_version: 17 + cmake_args: + description: "Dynamic" + cmake_args: "-DBUILD_SHARED_LIBS=on" + + name: "Bulid & Test: ${{ matrix.compiler.c }} ${{ matrix.cpp_version }} ${{ matrix.cmake_args.description }}" + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + - name: Install Ninja + uses: lukka/get-cmake@latest + with: + cmakeVersion: "~3.25.0" + ninjaVersion: "^1.11.1" + - name: Print installed softwares + run: | + clang++ --version + g++ --version + cmake --version + ninja --version + - name: Configure CMake + run: | + cmake -B build -S . "-DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }} ${{ matrix.cmake_args.args }}" + env: + CC: ${{ matrix.compiler.c }} + CXX: ${{ matrix.compiler.cpp }} + CMAKE_GENERATOR: "Ninja Multi-Config" + - name: Build Release + run: | + cmake --build build --config Release --verbose + cmake --build build --config Release --target all_verify_interface_header_sets + cmake --install build --config Release --prefix /opt/beman.exemplar + find /opt/beman.exemplar -type f + - name: Test Release + run: ctest --test-dir build --build-config Release + - name: Build Debug + run: | + cmake --build build --config Debug --verbose + cmake --build build --config Debug --target all_verify_interface_header_sets + cmake --install build --config Debug --prefix /opt/beman.exemplar + find /opt/beman.exemplar -type f + - name: Test Debug + run: ctest --test-dir build --build-config Debug + + create-issue-when-fault: + runs-on: ubuntu-latest + needs: [preset-test, test] + if: failure() && github.event_name == 'schedule' + steps: + # See https://github.com/cli/cli/issues/5075 + - uses: actions/checkout@v4 + - name: Create issue + run: | + issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end') + + body="**Build-and-Test Failure Report** + - **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z') + - **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) + - **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + The scheduled build-and-test triggered by cron has failed. + Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error." + + if [[ $issue_num -eq -1 ]]; then + gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body" + else + gh issue comment --repo ${{ github.repository }} $issue_num --body "$body" + fi + env: + GH_TOKEN: ${{ github.token }} From 1bfa6d1078a47ca5c553cca047846cad5e80aa46 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:07:38 -0500 Subject: [PATCH 2/8] move ci --- .github/workflows/ci.yml | 0 ci_tests.yml => .github/workflows/ci_tests.yml | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .github/workflows/ci.yml rename ci_tests.yml => .github/workflows/ci_tests.yml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index e69de29..0000000 diff --git a/ci_tests.yml b/.github/workflows/ci_tests.yml similarity index 100% rename from ci_tests.yml rename to .github/workflows/ci_tests.yml From 9dbf0bb7226e57c9691a2e96a3d74c508b5bd29e Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:10:10 -0500 Subject: [PATCH 3/8] conform to inplace_vector repo --- .github/workflows/ci_tests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 07ed3cc..aea06ed 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - preset: ["gcc-debug", "gcc-release"] + preset: [] name: "Preset Test: ${{ matrix.preset }}" steps: - uses: actions/checkout@v4 @@ -37,7 +37,7 @@ jobs: c: gcc - cpp: clang++ c: clang - cpp_version: [17, 20, 23, 26] + cpp_version: [20, 23, 26] cmake_args: - description: "Default" args: "" @@ -88,17 +88,17 @@ jobs: - name: Build Release run: | cmake --build build --config Release --verbose - cmake --build build --config Release --target all_verify_interface_header_sets - cmake --install build --config Release --prefix /opt/beman.exemplar - find /opt/beman.exemplar -type f + # cmake --build build --config Release --target all_verify_interface_header_sets + cmake --install build --config Release --prefix /opt/beman.inplace_vector + find /opt/beman.inplace_vector -type f - name: Test Release run: ctest --test-dir build --build-config Release - name: Build Debug run: | cmake --build build --config Debug --verbose - cmake --build build --config Debug --target all_verify_interface_header_sets - cmake --install build --config Debug --prefix /opt/beman.exemplar - find /opt/beman.exemplar -type f + # cmake --build build --config Debug --target all_verify_interface_header_sets + cmake --install build --config Debug --prefix /opt/beman.inplace_vector + find /opt/beman.inplace_vector -type f - name: Test Debug run: ctest --test-dir build --build-config Debug From 9e76626921348697c06e27b3d6662a2fcc25cc7c Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:10:53 -0500 Subject: [PATCH 4/8] remove presets --- .github/workflows/ci_tests.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index aea06ed..8cdb814 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -11,21 +11,21 @@ on: - cron: '30 15 * * *' jobs: - preset-test: - runs-on: ubuntu-latest - strategy: - matrix: - preset: [] - name: "Preset Test: ${{ matrix.preset }}" - steps: - - uses: actions/checkout@v4 - - name: Setup build environment - uses: lukka/get-cmake@latest - with: - cmakeVersion: "~3.25.0" - ninjaVersion: "^1.11.1" - - name: Run preset - run: cmake --workflow --preset ${{ matrix.preset }} + # preset-test: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # preset: [] + # name: "Preset Test: ${{ matrix.preset }}" + # steps: + # - uses: actions/checkout@v4 + # - name: Setup build environment + # uses: lukka/get-cmake@latest + # with: + # cmakeVersion: "~3.25.0" + # ninjaVersion: "^1.11.1" + # - name: Run preset + # run: cmake --workflow --preset ${{ matrix.preset }} test: strategy: From 62c140c49fad565b628f915b005564d0f0c28c09 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:11:25 -0500 Subject: [PATCH 5/8] fix ci --- .github/workflows/ci_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 8cdb814..511def2 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -104,7 +104,7 @@ jobs: create-issue-when-fault: runs-on: ubuntu-latest - needs: [preset-test, test] + needs: [test] if: failure() && github.event_name == 'schedule' steps: # See https://github.com/cli/cli/issues/5075 From 3b74962c4664a121382c465f368055278888e376 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:16:05 -0500 Subject: [PATCH 6/8] fix ci --- .github/workflows/ci_tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 511def2..38ec817 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -89,16 +89,16 @@ jobs: run: | cmake --build build --config Release --verbose # cmake --build build --config Release --target all_verify_interface_header_sets - cmake --install build --config Release --prefix /opt/beman.inplace_vector - find /opt/beman.inplace_vector -type f + cmake --install build --config Release --prefix /tmp/beman.inplace_vector + find /tmp/beman.inplace_vector -type f - name: Test Release run: ctest --test-dir build --build-config Release - name: Build Debug run: | cmake --build build --config Debug --verbose # cmake --build build --config Debug --target all_verify_interface_header_sets - cmake --install build --config Debug --prefix /opt/beman.inplace_vector - find /opt/beman.inplace_vector -type f + cmake --install build --config Debug --prefix /tmp/beman.inplace_vector + find /tmp/beman.inplace_vector -type f - name: Test Debug run: ctest --test-dir build --build-config Debug From 62a25f68c8715692e39ff7469a61eda435f39087 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:47:32 -0500 Subject: [PATCH 7/8] parital ci fix --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20fb750..e90c35a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ project( "A dynamically-resizable vector with fixed capacity and embedded storage" LANGUAGES CXX) +include(GNUInstallDirs) + add_library(beman.inplace_vector INTERFACE) target_include_directories( beman.inplace_vector From 623a4c2a5e63e78ed0eed25438d08032ca040de0 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:52:56 -0500 Subject: [PATCH 8/8] fix CI --- .github/workflows/ci_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 38ec817..5cb6c1e 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -50,7 +50,7 @@ jobs: compiler: cpp: g++ c: gcc - cpp_version: 17 + cpp_version: 20 cmake_args: description: "Werror" cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" @@ -58,7 +58,7 @@ jobs: compiler: cpp: g++ c: gcc - cpp_version: 17 + cpp_version: 20 cmake_args: description: "Dynamic" cmake_args: "-DBUILD_SHARED_LIBS=on"