name: Macos Build on: push: branches: [ "main", "release-**"] pull_request: branches: [ "main", "dev" ] workflow_call: inputs: build_name: required: true type: string description: 'Build name passed as VC_BUILD_NAME define' version_patch: required: false type: string default: '' description: 'Engine version patch number passed as VC_VERSION_PATCH define' jobs: build-dmg: runs-on: macos-latest steps: - uses: actions/checkout@v2 with: submodules: 'true' - name: Install dependencies from brew run: | brew install glfw glew libpng openal-soft luajit libvorbis googletest glm freetype - name: Configure run: | cmake -DOPENAL_INCLUDE_DIR=$(brew --prefix openal-soft)/include \ -DOPENAL_LIBRARY=$(brew --prefix openal-soft)/lib/libopenal.dylib \ -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_MACOS_BUNDLE=ON -DVC_BUILD_NAME="${{ inputs.build_name }}" -DVC_VERSION_PATCH="${{ inputs.version_patch }}" - name: Build run: | cmake --build build - name: Run tests run: ctest --output-on-failure --test-dir build - name: Run engine tests timeout-minutes: 5 run: | build/vctest/vctest -e build/VoxelCore -d dev/tests -u build --output-always --debugger "lldb -batch -o 'run' -o 'thread backtrace all' -o 'quit' -- " - name: Create DMG run: | cd build cpack mv VoxelCore.dmg ../VoxelCoreMacApp.dmg - name: Check bundle run: | app=build/_CPack_Packages/Darwin/DragNDrop/VoxelCore/VoxelCore.app test -x "$app/Contents/MacOS/VoxelCore" test -d "$app/Contents/Resources/res" if find "$app/Contents" -type f -perm +111 -exec otool -L {} \; 2>/dev/null \ | grep -E '^[[:space:]]+(/opt/homebrew|/usr/local)/'; then echo "bundle depends on libraries outside of it" exit 1 fi codesign --verify --deep --strict "$app" - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: VoxelCoreMacOs path: VoxelCoreMacApp.dmg