|
| 1 | +name: Debug Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - gh-readonly-queue/** |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-cmake: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + env: |
| 12 | + CARGO_HTTP_MULTIPLEXING: false |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, macOS-latest, windows-latest] |
| 17 | + include: |
| 18 | + - os: ubuntu-latest |
| 19 | + cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Debug -DDISCORD=ON -DDISCORD_DYNAMIC=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DAUTOUPDATE=ON |
| 20 | + cmake-init-env: CC=clang CXX=clang++ CFLAGS="-fsanitize=address,undefined -fsanitize-recover=all -fno-omit-frame-pointer -fno-common" CXXFLAGS="-fsanitize=address,undefined -fsanitize-recover=all -fno-omit-frame-pointer -fno-common" LDFLAGS="-fsanitize=address,undefined" |
| 21 | + package-file: "*-linux_x86_64.tar.xz" |
| 22 | + |
| 23 | + - os: macOS-latest |
| 24 | + name: macOS-arm64 |
| 25 | + cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Debug -DDISCORD=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib -DCMAKE_FIND_FRAMEWORK=LAST |
| 26 | + cmake-init-env: CC=clang CXX=clang++ CFLAGS="-fsanitize=address,undefined -fsanitize-recover=all -fno-omit-frame-pointer -fno-common" CXXFLAGS="-fsanitize=address,undefined -fsanitize-recover=all -fno-omit-frame-pointer -fno-common" LDFLAGS="-fsanitize=address,undefined" |
| 27 | + package-file: "*-macos-arm64.dmg" |
| 28 | + |
| 29 | + - os: macOS-latest |
| 30 | + name: macOS-x86_64 |
| 31 | + cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Debug -DDISCORD=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib -DCMAKE_FIND_FRAMEWORK=LAST |
| 32 | + cmake-init-env: CC=clang CXX=clang++ CFLAGS="-fsanitize=address,undefined -fsanitize-recover=all -fno-omit-frame-pointer -fno-common" CXXFLAGS="-fsanitize=address,undefined -fsanitize-recover=all -fno-omit-frame-pointer -fno-common" LDFLAGS="-fsanitize=address,undefined" |
| 33 | + package-file: "*-macos-x86_64.dmg" |
| 34 | + |
| 35 | + - os: windows-latest |
| 36 | + cmake-args: -A x64 -DCMAKE_BUILD_TYPE=Debug -T ClangCl -DDISCORD=ON -DTOOLS=OFF -DAUTOUPDATE=ON |
| 37 | + cmake-init-env: CC=clang-cl CXX=clang-cl |
| 38 | + package-file: "*-win64.zip" |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + submodules: true |
| 44 | + |
| 45 | + - name: Prepare Linux |
| 46 | + if: contains(matrix.os, 'ubuntu') |
| 47 | + run: | |
| 48 | + sudo apt-get update -y |
| 49 | + sudo apt-get install clang llvm pkg-config cmake ninja-build \ |
| 50 | + libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev \ |
| 51 | + libvulkan-dev glslang-tools spirv-tools \ |
| 52 | + libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \ |
| 53 | + libx264-dev libpng-dev libasan6 valgrind gcovr libglew-dev -y |
| 54 | +
|
| 55 | + - name: Prepare macOS |
| 56 | + if: contains(matrix.os, 'macOS') |
| 57 | + run: | |
| 58 | + brew update || true |
| 59 | + brew install llvm pkg-config ninja molten-vk vulkan-headers glslang spirv-tools glew googletest libpng x264 || true |
| 60 | + brew upgrade freetype |
| 61 | + pip3 install --break-system-packages dmgbuild |
| 62 | + echo /Library/Frameworks/Python.framework/Versions/3.12/bin >> $GITHUB_PATH |
| 63 | + echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH |
| 64 | + sudo rm -rf /Library/Developer/CommandLineTools |
| 65 | +
|
| 66 | + - name: Add rust macOS |
| 67 | + if: contains(matrix.os, 'macOS') |
| 68 | + run: | |
| 69 | + rustup default stable |
| 70 | + rustup update |
| 71 | + rustup target add x86_64-apple-darwin aarch64-apple-darwin |
| 72 | +
|
| 73 | + - name: Cache Rust dependencies |
| 74 | + uses: Swatinem/rust-cache@v2 |
| 75 | + |
| 76 | + - name: Build in debug mode with ASAN |
| 77 | + env: |
| 78 | + VERSION: ${{ secrets.VERSION }} |
| 79 | + shell: bash |
| 80 | + run: | |
| 81 | + VERSION_FILE="$GITHUB_WORKSPACE/versioninfo.h" |
| 82 | + printf '%s' "$VERSION" | base64 -d > "$VERSION_FILE" |
| 83 | +
|
| 84 | + if [[ "${{ matrix.os }}" == "windows-latest" ]]; then |
| 85 | + export MSYS_NO_PATHCONV=1 |
| 86 | + export MSYS_ARG_CONV_EXCL="/FI" |
| 87 | + VERSION_FILE="$GITHUB_WORKSPACE/versioninfo.h" |
| 88 | +
|
| 89 | + POST_FLAGS="-DCMAKE_C_FLAGS=\"-fsanitize=address /Zi /Oy- /FI$VERSION_FILE\"" |
| 90 | + POST_FLAGS+=" -DCMAKE_CXX_FLAGS=\"-fsanitize=address /Zi /Oy- /FI$VERSION_FILE\"" |
| 91 | + POST_FLAGS+=" -DCMAKE_EXE_LINKER_FLAGS=\"/INCREMENTAL:NO /fsanitize=address /LIBPATH:C:/Program Files/LLVM/lib/clang/16.0.0/lib/windows clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib\"" |
| 92 | + else |
| 93 | + ENVFLAGS="CXXFLAGS=-include$VERSION_FILE" |
| 94 | + POST_FLAGS="" |
| 95 | + fi |
| 96 | +
|
| 97 | + if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then |
| 98 | + POST_FLAGS+=" -DPNG_LIBRARY=${GITHUB_WORKSPACE}/ddnet-libs/png/mac/libfat/libpng16.16.dylib" |
| 99 | + POST_FLAGS+=" -DPNG_INCLUDEDIR=${GITHUB_WORKSPACE}/ddnet-libs/png/include" |
| 100 | + fi |
| 101 | +
|
| 102 | + mkdir release |
| 103 | + cd release |
| 104 | + ${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} $ENVFLAGS ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} $POST_FLAGS -DCMAKE_BUILD_TYPE=Debug -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. .. |
| 105 | + ${{ matrix.cmake-path }}cmake --build . --config Debug --target everything |
| 106 | +
|
| 107 | + - name: Package |
| 108 | + run: | |
| 109 | + cd release |
| 110 | + cmake --build . --config Debug --target package_default |
| 111 | + mkdir artifacts |
| 112 | + mv ${{ matrix.package-file }} artifacts |
| 113 | +
|
| 114 | + - name: Upload Artifacts |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: ddnet-debug-${{ matrix.os }} |
| 118 | + path: release/artifacts |
0 commit comments