Skip to content

Commit

Permalink
Build and test in more configurations (jeremy-rifkin#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin authored Jul 27, 2023
1 parent 0a6d1f2 commit 2776b5e
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 17 deletions.
41 changes: 40 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,31 @@ jobs:
-DCPPTRACE_BACKTRACE_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/include/backtrace.h \
-DASSERT_BUILD_BASIC_TEST=On
make -j
build-macos:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
compiler: [g++-13, clang++]
target: [Debug, Release]
steps:
- uses: actions/checkout@v2
- name: build
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.target}} \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DASSERT_BUILD_BASIC_TEST=On
make -j
build-windows:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
compiler: [cl, clang++]
target: [Debug]
target: [Debug, Release]
steps:
- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
Expand All @@ -48,3 +66,24 @@ jobs:
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} `
-DASSERT_BUILD_BASIC_TEST=On
msbuild .\libassert.sln
build-mingw:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
compiler: [g++]
target: [Debug, Release]
steps:
- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
uses: ilammy/[email protected]
- name: build
run: |
mkdir -p build
cd build
cmake .. `
-DCMAKE_BUILD_TYPE=${{matrix.target}} `
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} `
-DASSERT_BUILD_BASIC_TEST=On `
"-GUnix Makefiles"
make -j
57 changes: 56 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,36 @@ jobs:
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCPPTRACE_BACKTRACE_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/include/backtrace.h \
-DASSERT_BUILD_TESTS=On
make -j VERBOSE=1
make -j
- name: test
working-directory: build
run: |
CTEST_OUTPUT_ON_FAILURE=1 make test
test-macos:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
compiler: [g++-13, clang++]
target: [Debug]
exclude:
- compiler: clang++ # Disabled due to #15 TODO TODO TODO
target: Debug
steps:
- uses: actions/checkout@v2
- name: dependencies
run: |
python3 -m pip install git+https://github.com/jeffkaufman/icdiff.git
- name: build
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.target}} \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCPPTRACE_BACKTRACE_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/include/backtrace.h \
-DASSERT_BUILD_TESTS=On
make -j
- name: test
working-directory: build
run: |
Expand Down Expand Up @@ -59,3 +88,29 @@ jobs:
working-directory: build
run: |
ctest -C ${{matrix.target}} --output-on-failure
test-mingw:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
compiler: [g++]
target: [Debug]
steps:
- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
uses: ilammy/[email protected]
- name: build
run: |
mkdir -p build
cd build
cmake .. `
-DCMAKE_BUILD_TYPE=${{matrix.target}} `
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} `
-DASSERT_BUILD_TESTS=On `
"-GUnix Makefiles"
make -j
- name: test
working-directory: build
run: |
$env:CTEST_OUTPUT_ON_FAILURE=1
make test
7 changes: 5 additions & 2 deletions include/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,12 +1252,15 @@ using libassert::ASSERTION;
#define LIBASSERT_STATIC_DATA(name, type, expr_str, ...) \
/* extra string here because of extra comma from map, also serves as terminator */ \
/* LIBASSERT_STRINGIFY LIBASSERT_VA_ARGS because msvc */ \
/* Trailing return type here to work around a gcc <= 9.2 bug */ \
/* Oddly only affecting builds under -DNDEBUG https://godbolt.org/z/5Treozc4q */ \
using libassert_params_t = libassert::detail::assert_static_parameters; \
/* NOLINTNEXTLINE(*-avoid-c-arrays) */ \
const libassert::detail::assert_static_parameters* libassert_params = []() { \
const libassert_params_t* libassert_params = []() -> const libassert_params_t* { \
static constexpr const char* const libassert_arg_strings[] = { \
LIBASSERT_MAP(LIBASSERT_STRINGIFY LIBASSERT_VA_ARGS(__VA_ARGS__)) "" \
}; \
static constexpr libassert::detail::assert_static_parameters _libassert_params = { \
static constexpr libassert_params_t _libassert_params = { \
name LIBASSERT_COMMA \
type LIBASSERT_COMMA \
expr_str LIBASSERT_COMMA \
Expand Down
4 changes: 2 additions & 2 deletions tests/demo/demo.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#define _CRT_SECURE_NO_WARNINGS // for fopen

#include "assert.hpp"

#include <array>
#include <algorithm>
#include <fstream>
Expand All @@ -13,6 +11,8 @@
#include <string_view>
#include <string>

#include "assert.hpp"

#define ESC "\033["
#define RED ESC "1;31m"
#define GREEN ESC "1;32m"
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/integration.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "assert.hpp"

#include <algorithm>
#include <array>
#include <fstream>
Expand All @@ -11,6 +9,8 @@
#include <string_view>
#include <string>

#include "assert.hpp"

using namespace std::literals;

void test_path_differentiation();
Expand Down
3 changes: 2 additions & 1 deletion tests/pyutils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,5 @@ def test_critical_difference(): # self test cases
""".strip()
assert(critical_difference(a, b, max_line_diff))

test_critical_difference()
if __name__ == "main":
test_critical_difference()
4 changes: 2 additions & 2 deletions tests/unit/disambiguation.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "assert.hpp"

#include <iostream>
#include <string_view>
#include <string>
#include <tuple>

#include "assert.hpp"

#define ESC "\033["
#define RED ESC "1;31m"
#define GREEN ESC "1;32m"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_public_utilities.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "assert.hpp"

#include <map>
#include <string>
#include <utility>

#include "assert.hpp"

using namespace libassert::utility;

int main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_type_prettier.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "assert.hpp"

#include <iostream>

#include "assert.hpp"

int main() {
bool success = true;
auto test = [&success](const std::string& type, const std::string& expected) {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/tokens_and_highlighting.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "assert.hpp"

#include <fstream>
#include <iostream>

#include "assert.hpp"

namespace libassert::detail {
[[nodiscard]] std::string highlight(const std::string& expression);
}
Expand Down

0 comments on commit 2776b5e

Please sign in to comment.