From e008d5bb352498586f092a88dbca5f24ffe6edc4 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Thu, 22 Jun 2023 11:25:05 +0700 Subject: [PATCH] ci: merge `test.yaml` to `build.yaml` as `debug` job --- .github/workflows/build.yml | 41 +++++++++++++++++++++- .github/workflows/test.yml | 69 ------------------------------------- README.md | 1 - 3 files changed, 40 insertions(+), 71 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 598f034..1bb106f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,45 @@ on: push: branches: [main] jobs: + debug: + runs-on: ubuntu-latest + strategy: + matrix: + package: [error] + steps: + - name: Checkout repository + uses: actions/checkout@v3.5.3 + + - name: Install cmake-format + run: pip3 install cmake-format + + - name: Configure CMake + run: | + cmake ${{ matrix.package }} \ + -B ${{ matrix.package }}/build \ + -D CMAKE_CXX_FLAGS=-Werror \ + -D BUILD_TESTING=ON + + - name: Check code formatting + run: | + cmake --build ${{ matrix.package }}/build --target fix-format + git diff --exit-code HEAD + + - name: Build project + run: cmake --build ${{ matrix.package }}/build + + - name: Run unit tests + run: ctest --test-dir ${{ matrix.package }}/build --output-on-failure --no-tests=error + + - name: Check code coverage + uses: threeal/gcovr-action@main + with: + root: ${{ matrix.package }} + excludes: | + ${{ matrix.package }}/build/* + ${{ matrix.package }}/test/* + fail-under-line: 100 + release: runs-on: ubuntu-latest strategy: @@ -14,7 +53,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v3.5.3 - - name: Configure and build this project + - name: Configure and build project uses: threeal/cmake-action@v1.1.0 with: source-dir: ${{ matrix.package }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 8f50573..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: test -on: - workflow_dispatch: - pull_request: - push: - branches: [main] -jobs: - unit-tests: - runs-on: ubuntu-latest - strategy: - matrix: - package: [error] - steps: - - name: Checkout repository - uses: actions/checkout@v3.5.3 - - - name: Configure, build, and test this project - uses: threeal/cmake-action@v1.1.0 - with: - source-dir: ${{ matrix.package }} - build-dir: ${{ matrix.package }}/build - args: -DBUILD_TESTING=ON - run-test: true - - - name: Check code coverage - uses: threeal/gcovr-action@main - with: - root: ${{ matrix.package }} - excludes: | - ${{ matrix.package }}/build/* - ${{ matrix.package }}/test/* - fail-under-line: 100 - - check-warning: - runs-on: ubuntu-latest - strategy: - matrix: - package: [error] - steps: - - name: Checkout repository - uses: actions/checkout@v3.5.3 - - - name: Configure and build this project - uses: threeal/cmake-action@v1.1.0 - with: - source-dir: ${{ matrix.package }} - build-dir: ${{ matrix.package }}/build - cxx-flags: -Werror - args: -DBUILD_TESTING=ON - - check-formatting: - runs-on: ubuntu-latest - strategy: - matrix: - package: [error] - steps: - - name: Checkout repository - uses: actions/checkout@v3.5.3 - - - name: Install cmake-format - run: pip3 install cmake-format - - - name: Configure CMake - run: cmake ${{ matrix.package }} -B ${{ matrix.package }}/build - - - name: Check code formatting - run: | - cmake --build ${{ matrix.package }}/build --target format - cmake --build ${{ matrix.package }}/build --target check-format diff --git a/README.md b/README.md index 7e70752..fd4c18d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Overview [![build status](https://img.shields.io/github/actions/workflow/status/threeal/cpp/build.yml?branch=main)](https://github.com/threeal/cpp/actions/workflows/build.yml) -[![test status](https://img.shields.io/github/actions/workflow/status/threeal/cpp/test.yml?label=test&branch=main)](https://github.com/threeal/cpp/actions/workflows/test.yml) A comprehensive collection of [C++](https://isocpp.org/) utility packages.