diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 000000000..856f31a4f --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,64 @@ +name: Build and Test + +on: + pull_request: + branches-ignore: + - 'gh-pages' + push: + branches: + - 'master' + tags: + - v* + +permissions: + contents: read + +jobs: + check_code_format: + name: Check code formatting + runs-on: 'ubuntu-20.04' + # The code currently doesn't pass formatting. + # Enable this workflow job once it does, to detect regressions. + if: false + steps: + - uses: actions/checkout@v4 + - name: Check clang-format (make test-formatting) + run: | + make test-formatting + + plain_makefile: + name: Build and test using plain Makefile + runs-on: 'ubuntu-20.04' + steps: + - name: Build environment setup + run: | + echo 'Nothing to do.' + echo 'GitHub runner includes tools we need already.' + - uses: actions/checkout@v4 + - name: Build (make all) + run: | + make all + - name: Test (make test) + run: | + make test + + cmake_build: + name: Build and test using CMake + runs-on: 'ubuntu-20.04' + steps: + - name: Build environment setup + run: | + echo 'Nothing to do.' + echo 'GitHub runner includes tools we need already.' + - uses: actions/checkout@v4 + - name: Configure (cmake) + run: | + cmake -B "${{github.workspace}}/build" + - name: Build (cmake --build) + working-directory: ${{github.workspace}}/build + run: | + cmake --build . + - name: Test (ctest)) + working-directory: ${{github.workspace}}/build + run: | + ctest --output-on-failure diff --git a/Makefile b/Makefile index 449ce0d67..d2950cf10 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ reformat: clang-format -i -style=file **/*.cpp **/*.h test-formatting: - test "`clang-format -style=file -output-replacements-xml **/*.cpp **/*.h | grep -c "