From dc047df1aa25d254731a5e3af23d936c45827372 Mon Sep 17 00:00:00 2001 From: hit9 Date: Tue, 10 Oct 2023 20:20:10 +0800 Subject: [PATCH] Add a tests yaml for github actions --- .github/workflows/tests.yml | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6887030 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,48 @@ +name: compile_time_regexp.h tests + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + build_type: [Debug] + os: [ubuntu-latest] + cpp_compiler: [g++, clang++] + include: + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + steps: + - uses: actions/checkout@v3 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: > + cmake -B . -S ${{ github.workspace }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DBUILD_TESTS=1 + + - name: Build Test + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config ${{ matrix.build_type }} --target tests + + - name: Run mTest + working-directory: ${{runner.workspace}}/build + run: ctest --test-dir tests --config ${{ matrix.build_type }}