diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml new file mode 100644 index 00000000..8d84ad04 --- /dev/null +++ b/.azure-pipelines.yml @@ -0,0 +1,136 @@ +# Documentation: https://wiki.unvanquished.net/wiki/Continuous_integration + +trigger: + branches: + include: + - master + +pr: + branches: + include: + - '*' + paths: + include: + - .azure-pipelines.yml + # The rest of this list should stay in sync with .appveyor.yml + - crunch/ + - crnlib/ + - inc/ + - example1/ + - example2/ + - example3/ + - cmake/ + - CMakeLists.txt + +strategy: + matrix: + Linux amd64 GCC: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: g++-8 + APT_PACKAGES: ninja-build g++-8 + NPROC_TOOL: nproc + BUILD_EXAMPLES: OFF + Linux i686 GCC: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: i686-linux-gnu-g++ + APT_PACKAGES: ninja-build g++-i686-linux-gnu + NPROC_TOOL: nproc + BUILD_EXAMPLES: OFF + Linux arm64 GCC: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: aarch64-linux-gnu-g++ + APT_PACKAGES: ninja-build g++-aarch64-linux-gnu + NPROC_TOOL: nproc + BUILD_EXAMPLES: OFF + Linux armhf GCC: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: arm-linux-gnueabihf-g++ + APT_PACKAGES: ninja-build g++-arm-linux-gnueabihf + NPROC_TOOL: nproc + BUILD_EXAMPLES: OFF + Linux amd64 Clang: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: clang++ + APT_PACKAGES: ninja-build + NPROC_TOOL: nproc + BUILD_EXAMPLES: OFF + Windows amd64 MinGW: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: x86_64-w64-mingw32-g++ + TOOLCHAIN_FILE: cmake/cross-toolchain-mingw64.cmake + INSTALL_TOOL: apt + APT_PACKAGES: ninja-build g++-mingw-w64-x86-64 mingw-w64-x86-64-dev + SETUP_COMMANDS: sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix + NPROC_TOOL: nproc + BUILD_EXAMPLES: ON + EXE_EXT: .exe + Windows i686 MinGW: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: i686-w64-mingw32-g++ + TOOLCHAIN_FILE: cmake/cross-toolchain-mingw32.cmake + INSTALL_TOOL: apt + APT_PACKAGES: ninja-build g++-mingw-w64-i686 mingw-w64-i686-dev + SETUP_COMMANDS: sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix ; sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix + NPROC_TOOL: nproc + BUILD_EXAMPLES: ON + EXE_EXT: .exe + macOS amd64 AppleClang: + VM_IMAGE: 'macOS-12' + CMAKE_GENERATOR: Unix Makefiles + CXX_COMPILER: clang++ + NPROC_TOOL: sysctl -n hw.logicalcpu + BUILD_EXAMPLES: OFF + macOS arm64 AppleClang: + VM_IMAGE: 'macOS-12' + CMAKE_GENERATOR: Unix Makefiles + CXX_COMPILER: clang++ + COMPILER_FLAGS: -target arm64-apple-macos11 -Wno-overriding-t-option + NPROC_TOOL: sysctl -n hw.logicalcpu + BUILD_EXAMPLES: OFF + Web Asm.js Emscripten: + VM_IMAGE: 'ubuntu-20.04' + CMAKE_GENERATOR: Ninja + CXX_COMPILER: emcc + TOOLCHAIN_FILE: /usr/share/emscripten/cmake/Modules/Platform/Emscripten.cmake + INSTALL_TOOLS: apt + APT_PACKAGES: ninja-build emscripten + NPROC_TOOL: nproc + SOURCE_DIR: emscripten + EXE_EXT: .{js,wasm} + +pool: + vmImage: $(VM_IMAGE) + +steps: +- bash: | + set -xe + if [ -n "${APT_PACKAGES:-}" ]; then + sudo apt-get update && sudo apt-get -y -q --no-install-recommends install ${APT_PACKAGES} + fi + if [ -n "${SETUP_COMMANDS:-}" ]; then + $(SETUP_COMMANDS) + fi + displayName: 'Setup' +- bash: | + set -xe + export CMAKE_BUILD_PARALLEL_LEVEL="$(${NPROC_TOOL})" + echo "${CMAKE_BUILD_PARALLEL_LEVEL}" + export CFLAGS="${CFLAGS:-}${CFLAGS:= }${COMPILER_FLAGS}" + export CXXFLAGS="${CXXFLAGS:-}${CXXFLAGS:= }${COMPILER_FLAGS}" + cmake -S${SOURCE_DIR:-.} -Bbuild \ + -G"${CMAKE_GENERATOR}" \ + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ + -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \ + -DBUILD_CRUNCH=ON -DBUILD_SHARED_LIBCRN=ON -DBUILD_EXAMPLES=${BUILD_EXAMPLES} + cmake --build build --config Release + displayName: 'Build' +- bash: | + file "build/crunch${EXE_EXT:-}" + displayName: 'Test'