Files
eepp/.github/workflows/eepp-macos-build-check.yml
2026-08-22 18:33:11 -03:00

119 lines
3.9 KiB
YAML

name: macOS
on: [push, pull_request]
permissions:
contents: write
jobs:
MacOS:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
fetch-depth: 2
- name: Checkout submodules
run: |
git submodule update --init --recursive
- name: Install dependencies
run: |
brew install wget SDL2 premake
- name: Build
run: |
premake5 --disable-static-build --with-debug-symbols gmake
make -C make/macosx/ -j$(sysctl -n hw.ncpu) -e config=release_arm64
- name: Set SDK version
id: sdk_version
run: |
if [[ "$GITHUB_REF" == refs/tags/eepp-* ]]; then
echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
else
echo "version=nightly" >> "$GITHUB_OUTPUT"
fi
- name: Package eepp SDK
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
bash projects/scripts/package_sdk.sh macos arm64 --version ${{ steps.sdk_version.outputs.version }}
- name: Upload SDK package
if: always()
uses: actions/upload-artifact@v4
with:
name: macos-eepp-sdk-arm64
path: projects/macos/sdk/eepp-sdk-*.tar.gz
- name: Publish nightly SDK package
if: github.ref == 'refs/heads/develop'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.sdk_version.outputs.version }}
draft: false
prerelease: true
generate_release_notes: false
fail_on_unmatched_files: true
files: |
projects/macos/sdk/eepp-sdk-macos-arm64-nightly.tar.gz
- name: Publish stable release package
if: startsWith(github.ref, 'refs/tags/eepp-')
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.sdk_version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: false
fail_on_unmatched_files: true
files: |
projects/macos/sdk/eepp-sdk-macos-arm64-*.tar.gz
- name: Unit Tests
run: |
set +e
cd bin/unit_tests
mkdir -p output
crash_report_marker="$PWD/output/.unit-test-started"
touch "$crash_report_marker"
./eepp-unit_tests
status=$?
if [ "$status" -ne 0 ]; then
echo "::group::macOS crash reports"
mkdir -p output/crash-reports
crash_report_list="output/crash-reports/reports.txt"
for attempt in 1 2 3 4 5; do
: > "$crash_report_list"
for dir in "$HOME/Library/Logs/DiagnosticReports" "/Library/Logs/DiagnosticReports"; do
if [ -d "$dir" ]; then
find "$dir" -maxdepth 1 \( -name 'eepp-unit_tests*.crash' -o -name 'eepp-unit_tests*.ips' \) \
-newer "$crash_report_marker" -print >> "$crash_report_list" 2>/dev/null || true
fi
done
if [ -s "$crash_report_list" ]; then
break
fi
sleep 2
done
if [ -s "$crash_report_list" ]; then
while IFS= read -r report; do
[ -n "$report" ] || continue
echo "$report"
cp "$report" output/crash-reports/ || true
cat "$report" || true
done < "$crash_report_list"
else
echo "No eepp-unit_tests crash report found in DiagnosticReports."
fi
echo "::endgroup::"
echo "::group::lldb crash backtrace rerun"
lldb --batch \
-o "run" \
-k "thread backtrace all" \
-k "quit" \
-- ./eepp-unit_tests || true
echo "::endgroup::"
fi
exit "$status"
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: macos-test-output
path: bin/unit_tests/output/*