Update dependencies and refactor the build scripts #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build and Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Formatting | |
run: find src include test -iregex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|hxx\)$' | xargs clang-format -n -Werror | |
build-linux: | |
runs-on: ubuntu-latest | |
env: | |
TARGET: x86_64-linux | |
CMAKE_BUILD_TYPE: Debug | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup the toolchain | |
run: | | |
CMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/cmake/toolchain/${{ env.TARGET }}.cmake" | |
echo "CMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE" >> $GITHUB_ENV | |
- name: Build without getlibs | |
run: | | |
BUILD=build-$TARGET-$CMAKE_BUILD_TYPE | |
cmake -S . -B $BUILD | |
cmake --build $BUILD --config $CMAKE_BUILD_TYPE | |
(cd $BUILD ; ctest -C $CMAKE_BUILD_TYPE) | |
- name: Get dependencies | |
run: CMAKE_BUILD_TYPE=Release ./getlibs.sh $TARGET | |
- name: Build with getlibs | |
run: | | |
BUILD=build-$TARGET-libs-$CMAKE_BUILD_TYPE | |
cmake -S . -B $BUILD | |
cmake --build $BUILD --config $CMAKE_BUILD_TYPE | |
(cd $BUILD ; ctest -C $CMAKE_BUILD_TYPE) | |
build-win: | |
runs-on: ubuntu-latest | |
env: | |
TARGET: x86_64-w64-mingw32 | |
WINARCH: win64 | |
CMAKE_BUILD_TYPE: Debug | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup the toolchain | |
run: | | |
sudo apt-get -qqy update | |
sudo apt-get -qqy install cmake make g++-mingw-w64-x86-64 mingw-w64-x86-64-dev mingw-w64-tools wine wine-binfmt | |
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix | |
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix | |
WINEPATH=$(${{ github.workspace }}/winepath-for ${{ env.TARGET }}) | |
echo "WINEPATH=$WINEPATH" >> $GITHUB_ENV | |
CMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/cmake/toolchain/${{ env.TARGET }}.cmake" | |
echo "CMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE" >> $GITHUB_ENV | |
- name: Build without getlibs | |
run: | | |
BUILD=build-$TARGET-$CMAKE_BUILD_TYPE | |
cmake -S . -B $BUILD -DSTATIC=yes | |
cmake --build $BUILD --config $CMAKE_BUILD_TYPE | |
(cd $BUILD ; ctest -C $CMAKE_BUILD_TYPE) | |
- name: Get dependencies | |
run: | |
CMAKE_BUILD_TYPE=Release ./getlibs.sh $TARGET | |
- name: Build with getlibs | |
run: | | |
BUILD=build-$TARGET-libs-$CMAKE_BUILD_TYPE | |
cmake -S . -B $BUILD -DSTATIC=yes | |
cmake --build $BUILD --config $CMAKE_BUILD_TYPE | |
(cd $BUILD ; ctest -C $CMAKE_BUILD_TYPE) | |
build-macos: | |
runs-on: macos-latest | |
env: | |
TARGET: x86_64-darwin | |
CMAKE_BUILD_TYPE: Debug | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup the toolchain | |
run: | | |
CMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/cmake/toolchain/${{ env.TARGET }}.cmake" | |
echo "CMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE" >> $GITHUB_ENV | |
- name: Build without getlibs | |
run: | | |
BUILD=build-$TARGET-$CMAKE_BUILD_TYPE | |
cmake -S . -B $BUILD | |
cmake --build $BUILD --config $CMAKE_BUILD_TYPE | |
(cd $BUILD ; ctest -C $CMAKE_BUILD_TYPE) | |
- name: Get dependencies | |
run: CMAKE_BUILD_TYPE=Release ./getlibs.sh $TARGET | |
- name: Build with getlibs | |
run: | | |
BUILD=build-$TARGET-libs-$CMAKE_BUILD_TYPE | |
cmake -S . -B $BUILD | |
cmake --build $BUILD --config $CMAKE_BUILD_TYPE | |
(cd $BUILD ; ctest -C $CMAKE_BUILD_TYPE) |