diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 945811c60..23d398070 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -37,15 +37,31 @@ jobs: unittest: name: Run unit-tests on ${{ matrix.config.name }} runs-on: ubuntu-24.04 - env: - CC: ${{ matrix.config.cc }} strategy: fail-fast: false matrix: config: - - { name: "gcc 14", cc: gcc-14, tidy: "Off" } - - { name: "clang 18", cc: clang-18, tidy: "On" } + - name: GCC 14 + apt_deps: >- + libargtable2-dev libcunit1-dev libsdl2-mixer-dev libconfuse-dev + libenet-dev libsdl2-dev libxmp-dev libpng-dev libepoxy-dev gcc-14 + configure_flags: '-DCMAKE_C_COMPILER=gcc-14' + - name: Clang 18 + apt_deps: >- + libargtable2-dev libcunit1-dev libsdl2-mixer-dev libconfuse-dev + libenet-dev libsdl2-dev libxmp-dev libpng-dev libepoxy-dev clang-18 + clang-tidy-18 + configure_flags: '-DCMAKE_C_COMPILER=clang-18 -DUSE_TIDY=ON' + - name: MinGW-w64 + is_mingw: true + apt_deps: mingw-w64 wine wine64 + configure_flags: >- + --toolchain cmake-scripts/mingw-w64-toolchain.cmake + -DCMAKE_PREFIX_PATH=openomf-win-build-main/ + -DCMAKE_INCLUDE_PATH=openomf-win-build-main/include/ + -DCMAKE_LIBRARY_PATH=openomf-win-build-main/lib/ + -DCMAKE_FIND_ROOT_PATH=openomf-win-build-main/ steps: - uses: actions/checkout@v4 @@ -53,26 +69,38 @@ jobs: - name: Install Ubuntu Dependencies uses: Eeems-Org/apt-cache-action@v1.3 with: - packages: cmake cmake-data libargtable2-dev libcunit1-dev - libsdl2-mixer-dev libconfuse-dev libenet-dev libsdl2-dev libxmp-dev libpng-dev - libepoxy-dev clang-tidy-18 ${{ matrix.config.cc }} + packages: cmake cmake-data ninja-build ${{ matrix.config.apt_deps }} + + - if: ${{ matrix.config.is_mingw }} + name: Download prebuilt MinGW-W64 dependencies + run: | + wget -q https://github.com/omf2097/openomf-win-build/archive/refs/heads/main.zip + unzip -q main.zip && rm main.zip - name: Build tests run: | - mkdir build-test && cd build-test cmake -DCMAKE_BUILD_TYPE=Debug \ - -DUSE_TIDY=${{ matrix.config.tidy }} \ -DUSE_TESTS=On \ -DUSE_SANITIZERS=On \ -DUSE_FATAL_SANITIZERS=On \ -DUSE_TOOLS=On \ - .. - make -j $(getconf _NPROCESSORS_ONLN) + ${{ matrix.config.configure_flags }} \ + -G Ninja \ + -S. -B build-test + cmake --build build-test + + - if: ! ${{ matrix.config.is_mingw }} + name: Run tests (natively) + run: | + cd build-test + ./openomf_test_main -V - - name: Run tests + - if: ${{ matrix.config.is_mingw }} + name: Run tests (MinGW, so run via wine) run: | cd build-test - make test ARGS="-V" + # TODO: use wine in mingw build + wine openomf_test_main.exe -V # Build windows package, release artifact (MSVC) # -----------------------------------------------------------------------------------------------