kind: pipeline
name: default

steps:
  - name: test-debug-linux
    image: deukhoofd/linux64builder
    commands:
      - cmake -DCMAKE_BUILD_TYPE=Debug . -B build-debug
      - cmake --build build-debug --target all -- -j 4
      - build-debug/PorygonLangTests -s --durations yes --use-colour yes

  - name: test-release-linux
    image: deukhoofd/linux64builder
    commands:
      - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release
      - cmake --build build-release --target all -- -j 4
      - build-release/PorygonLangTests -s --durations yes --use-colour yes
      - valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no --error-exitcode=1 build-release/PorygonLangTests

  - name: test-release-windows
    image: deukhoofd/windowsbuilder
    commands:
      - update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
      - update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
      - update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
      - update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
      - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release-windows -D CMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc -D CMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -D WINDOWS=ON
      - cmake --build build-release-windows --target all -- -j 4
      - wine build-release-windows/PorygonLangTests.exe -s
