Skip to content

macos osxcross ci

macos osxcross ci #142

Workflow file for this run

name: Fast-Build
on:
push:
branches-ignore:
- gh-readonly-queue/**
jobs:
build-cmake:
runs-on: ${{ matrix.os }}
env:
CARGO_HTTP_MULTIPLEXING: false
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCORD=ON -DDISCORD_DYNAMIC=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON
cmake-init-env: CXXFLAGS=
package-file: "*-linux_x86_64.tar.xz"
crossosx: false
- os: windows-latest
cmake-args: -A x64 -DDISCORD=ON
cmake-init-env: CXXFLAGS= LDFLAGS=
package-file: "*-win64.zip"
crossosx: false
- os: ubuntu-latest
cmake-args: -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}/cmake/toolchains/darwin-arm64.toolchain" -DCMAKE_OSX_SYSROOT=$OSXCROSS_TARGET/SDK/MacOSX12.3.sdk
cmake-init-env: CXXFLAGS=
package-file: "*-macos.dmg"
crossosx: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
# mount: /var/lib/grub/esp: special device /dev/disk/by-id/scsi-... does not exist.
# sudo apt-get upgrade -y
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libvulkan-dev glslang-tools spirv-tools libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libpng-dev valgrind gcovr libglew-dev -y
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Set up MacOS Cross Compiler
if: matrix.crossosx
uses: Timmmm/setup-osxcross@v2
with:
osx-version: "12.3"
- name: Build in release mode
env:
VERSION: ${{ secrets.VERSION }}
shell: bash
run: |
VERSION_FILE="$GITHUB_WORKSPACE/versioninfo.h"
printf '%s' "$VERSION" | base64 -d > "$VERSION_FILE"
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
export MSYS_ARG_CONV_EXCL="/FI"
POST_FLAGS="-DCMAKE_CXX_FLAGS=\"/FI$VERSION_FILE\""
ENVFLAGS=""
else
ENVFLAGS="CXXFLAGS=-include$VERSION_FILE"
POST_FLAGS=""
fi
if [[ "${{ matrix.crossosx }}" == "true" ]]; then
export OSXCROSS_OSX_VERSION_MIN=10.9
eval "$(osxcross-conf)"
fi
mkdir release
cd release
${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} $ENVFLAGS ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} $POST_FLAGS -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
${{ matrix.cmake-path }}cmake --build . --config Release --target everything ${{ matrix.build-args }}
- name: Package
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config Release --target package_default ${{ matrix.build-args }}
mkdir artifacts
mv ${{ matrix.package-file }} artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ddnet-${{ matrix.os }}
path: release/artifacts