|
| 1 | +--- |
1 | 2 | name: Build and Test |
2 | 3 |
|
3 | 4 | on: |
|
7 | 8 | branches: [ main ] |
8 | 9 |
|
9 | 10 | jobs: |
10 | | - format: |
| 11 | + formatting: |
11 | 12 | runs-on: ubuntu-latest |
12 | 13 | steps: |
13 | | - - uses: actions/checkout@v2 |
14 | | - - name: Format |
15 | | - run: find src include test -iregex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|hxx\)$' | xargs clang-format -n -Werror |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + - name: Formatting |
| 16 | + run: find src include test -iregex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|hxx\)$' | xargs clang-format -n -Werror |
16 | 17 | build-linux: |
17 | 18 | runs-on: ubuntu-latest |
| 19 | + env: |
| 20 | + TARGET: x86_64-linux |
| 21 | + CMAKE_BUILD_TYPE: Debug |
| 22 | + CTEST_OUTPUT_ON_FAILURE: 1 |
18 | 23 | steps: |
19 | | - - uses: actions/checkout@v2 |
20 | | - - name: Get dependencies |
21 | | - run: sudo apt-get update && sudo apt-get install libboost-all-dev doctest-dev && ./getlibs.sh |
22 | | - - name: Build and test |
23 | | - run: | |
24 | | - export CTEST_OUTPUT_ON_FAILURE=1 |
25 | | - cmake -DTESTING=yes . -B build |
26 | | - cmake --build build |
27 | | - (cd build ; ctest) |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + - name: Setup the toolchain |
| 26 | + run: | |
| 27 | + CMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/cmake/toolchain/${{ env.TARGET }}.cmake" |
| 28 | + echo "CMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE" >> $GITHUB_ENV |
| 29 | +# - name: Build without getlibs |
| 30 | +# run: | |
| 31 | +# BUILD=build-$TARGET-$CMAKE_BUILD_TYPE |
| 32 | +# cmake -B $BUILD |
| 33 | +# cmake --build $BUILD --config $CMAKE_BUILD_TYPE |
| 34 | +# ctest --test-dir $BUILD -C $CMAKE_BUILD_TYPE |
| 35 | + - name: Get dependencies |
| 36 | + run: CMAKE_BUILD_TYPE=Release ./getlibs.sh $TARGET |
| 37 | + - name: Build with getlibs |
| 38 | + run: | |
| 39 | + BUILD=build-$TARGET-libs-$CMAKE_BUILD_TYPE |
| 40 | + cmake -B $BUILD -DCMAKE_PREFIX_PATH="${{ github.workspace }}/local/$TARGET" |
| 41 | + cmake --build $BUILD --config $CMAKE_BUILD_TYPE |
| 42 | + ctest --test-dir $BUILD -C $CMAKE_BUILD_TYPE |
28 | 43 | build-win: |
29 | 44 | runs-on: ubuntu-latest |
| 45 | + env: |
| 46 | + TARGET: x86_64-w64-mingw32 |
| 47 | + WINARCH: win64 |
| 48 | + CMAKE_BUILD_TYPE: Debug |
| 49 | + CTEST_OUTPUT_ON_FAILURE: 1 |
30 | 50 | steps: |
31 | | - - uses: actions/checkout@v2 |
32 | | - - name: Get dependencies |
33 | | - run: | |
34 | | - sudo apt-get update |
35 | | - sudo apt-get install cmake make g++-mingw-w64-x86-64 mingw-w64-x86-64-dev mingw-w64-tools wine wine-binfmt |
| 51 | + - uses: actions/checkout@v3 |
| 52 | + - name: Setup the toolchain |
| 53 | + run: | |
| 54 | + sudo apt-get -qqy update |
| 55 | + sudo apt-get -qqy install cmake make g++-mingw-w64-x86-64 mingw-w64-x86-64-dev mingw-w64-tools wine wine-binfmt |
36 | 56 | sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix |
37 | 57 | sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix |
38 | | - CMAKE_TOOLCHAIN_FILE="$(pwd)/toolchains/x86_64-w64-mingw32.cmake" ./getlibs.sh |
39 | | - - name: Build and test |
40 | | - run: | |
41 | | - export CTEST_OUTPUT_ON_FAILURE=1 |
42 | | - cmake -DSTATIC=yes -DTESTING=yes -DCMAKE_TOOLCHAIN_FILE=toolchains/x86_64-w64-mingw32.cmake . -B build |
43 | | - cmake --build build |
44 | | - (cd build ; ctest) |
| 58 | + WINEPATH=$(${{ github.workspace }}/winepath-for $TARGET) |
| 59 | + echo "WINEPATH=$WINEPATH" >> $GITHUB_ENV |
| 60 | + CMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/cmake/toolchain/${{ env.TARGET }}.cmake" |
| 61 | + echo "CMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE" >> $GITHUB_ENV |
| 62 | +# - name: Build without getlibs |
| 63 | +# run: | |
| 64 | +# BUILD=build-$TARGET-$CMAKE_BUILD_TYPE |
| 65 | +# cmake -S . -B $BUILD -DSTATIC=yes |
| 66 | +# cmake --build $BUILD --config $CMAKE_BUILD_TYPE |
| 67 | +# ctest --test-dir $BUILD -C $CMAKE_BUILD_TYPE |
| 68 | + - name: Get dependencies |
| 69 | + run: |
| 70 | + CMAKE_BUILD_TYPE=Release ./getlibs.sh $TARGET |
| 71 | + - name: Build with getlibs |
| 72 | + run: | |
| 73 | + BUILD=build-$TARGET-libs-$CMAKE_BUILD_TYPE |
| 74 | + cmake -B $BUILD -DCMAKE_PREFIX_PATH="${{ github.workspace }}/local/$TARGET" -DSTATIC=yes |
| 75 | + cmake --build $BUILD --config $CMAKE_BUILD_TYPE |
| 76 | + ctest --test-dir $BUILD -C $CMAKE_BUILD_TYPE |
45 | 77 | build-macos: |
46 | 78 | runs-on: macos-latest |
| 79 | + env: |
| 80 | + TARGET: x86_64-darwin |
| 81 | + CMAKE_BUILD_TYPE: Debug |
| 82 | + CTEST_OUTPUT_ON_FAILURE: 1 |
47 | 83 | steps: |
48 | | - - uses: actions/checkout@v2 |
49 | | - - name: Get dependencies |
50 | | - run: brew install boost doctest && ./getlibs.sh |
51 | | - - name: Build and test |
52 | | - run: | |
53 | | - export CTEST_OUTPUT_ON_FAILURE=1 |
54 | | - cmake -DTESTING=yes . -B build |
55 | | - cmake --build build |
56 | | - (cd build ; ctest) |
| 84 | + - uses: actions/checkout@v3 |
| 85 | + - name: Setup the toolchain |
| 86 | + run: | |
| 87 | + CMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/cmake/toolchain/$TARGET.cmake" |
| 88 | + echo "CMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE" >> $GITHUB_ENV |
| 89 | +# - name: Build without getlibs |
| 90 | +# run: | |
| 91 | +# BUILD=build-$TARGET-$CMAKE_BUILD_TYPE |
| 92 | +# cmake -B $BUILD |
| 93 | +# cmake --build $BUILD --config $CMAKE_BUILD_TYPE |
| 94 | +# ctest --test-dir $BUILD -C $CMAKE_BUILD_TYPE |
| 95 | + - name: Get dependencies |
| 96 | + run: CMAKE_BUILD_TYPE=Release ./getlibs.sh $TARGET |
| 97 | + - name: Build with getlibs |
| 98 | + run: | |
| 99 | + BUILD=build-$TARGET-libs-$CMAKE_BUILD_TYPE |
| 100 | + cmake -S . -B $BUILD -DCMAKE_PREFIX_PATH="${{ github.workspace }}/local/$TARGET" |
| 101 | + cmake --build $BUILD --config $CMAKE_BUILD_TYPE |
| 102 | + ctest --test-dir $BUILD -C $CMAKE_BUILD_TYPE |
0 commit comments