Skip to content

Update MAC CI

Update MAC CI #601

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
jobs:
flatpak:
name: "Flatpak"
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-49
options: --privileged
strategy:
# Don't fail the whole workflow if one architecture fails
fail-fast: false
matrix:
variant:
- arch: x86_64
runner: ubuntu-24.04
- arch: aarch64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.variant.runner }}
steps:
- uses: actions/checkout@v4
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: reflection.flatpak
manifest-path: cx.modal.Reflection.json
cache-key: flatpak-builder-${{ github.sha }}
arch: ${{ matrix.variant.arch }}
run-tests: true
# The above job will build the application as a flatpak and
# publish it as an artifact. To test it locally you can download
# the zip artifact, extract it, install the flatpak and run it.
# unzip reflection-x86_64.zip
# flatpak --user install reflection.flatpak
# flatpak run cx.modal.Reflection
macos:
name: macOS (${{ matrix.variant.arch }})
runs-on: ${{ matrix.variant.runner }}
strategy:
fail-fast: false
matrix:
variant:
- arch: x86_64
target: x86_64-apple-darwin
runner: macos-15-intel
- arch: arm64
target: aarch64-apple-darwin
runner: macos-latest
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
targets: ${{ matrix.variant.target }}
channel: nightly
cache-target: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Cache Homebrew packages
- uses: actions/cache@v4
with:
path: |
~/Library/Caches/Homebrew
/usr/local/Homebrew
/opt/homebrew
key: ${{ runner.os }}-${{ matrix.variant.arch }}-brew-${{ hashFiles('**/Brewfile', '.github/workflows/build.yml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.variant.arch }}-brew-
- name: Run macOS Build Script
run: |
chmod +x build-aux/build_macos.sh
./build-aux/build_macos.sh --release --app-bundle --dmg
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
# Build script creates artifacts in the current directory
name: reflection-macos-${{ matrix.variant.arch }}
path: reflection-${{ matrix.variant.arch }}.dmg
- name: Smoke test the build
env:
RUST_BACKTRACE: "full"
RUST_LOG: "debug"
G_MESSAGES_DEBUG: "all"
run: |
/Applications/Reflection.app/Contents/MacOS/reflection &
PID=$!
sleep 5
echo Killing reflection
kill $PID || true
- name: Smoke test the bundle
env:
RUST_BACKTRACE: "full"
RUST_LOG: "debug"
G_MESSAGES_DEBUG: "all"
run: |
hdiutil attach reflection-${{ matrix.variant.arch }}.dmg
cp -R /Volumes/Reflection/Reflection.app /Applications
hdiutil unmount /Volumes/Reflection
ls -R /Applications/Reflection.app
/Applications/Reflection.app/Contents/MacOS/reflection &
PID=$!
sleep 5
echo Killing reflection
kill $PID || true