# Build LinTunes.app for both kinds of Mac, and publish a release on tags. # # tag vX.Y.Z pushed -> test, build both .dmg files, smoke-test them, # and attach them + SHA256SUMS to the GitHub Release # manual dispatch -> the same; publishes only when run on a vX.Y.Z tag # pull request, or a push to master touching the Mac packaging # -> test and build, artifacts only, nothing published # # macOS minutes are expensive on a private repository (docs/mac-release.md), # which is why an ordinary push to master doesn't build. name: macOS on: push: tags: ["v*"] branches: [master] paths: - "packaging/mac/**" - ".github/workflows/mac.yml" pull_request: paths: - "packaging/mac/**" - ".github/workflows/mac.yml" - "setup.py" - "requirements.txt" workflow_dispatch: permissions: contents: read concurrency: group: mac-${{ github.ref }} cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }} env: PYTHON_VERSION: "3.13" jobs: test: name: Tests (${{ matrix.label }}) strategy: fail-fast: false matrix: include: - runner: macos-15 # Apple Silicon (arm64) label: AppleSilicon - runner: macos-15-intel # Intel (x86_64) label: Intel runs-on: ${{ matrix.runner }} # The suite grew up on Linux, and until the Linux-only tests carry a # `linux_only` marker that conftest skips on macOS, some will fail # here. Reported, not blocking: the build below doesn't wait on it. continue-on-error: true timeout-minutes: 45 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: ${{ env.PYTHON_VERSION }} - name: Install run: | python -m pip install --upgrade pip python -m pip install --prefer-binary \ --only-binary=PyQt6,PyQt6-Qt6,PyQt6-sip,numpy,cryptography,zeroconf,pydantic-core,aiohttp,miniaudio,protobuf \ -e . pytest - name: ffmpeg and fpcalc (the pinned ones the app ships) run: | export SSL_CERT_FILE="$(python -m certifi)" python -I packaging/mac/fetch_tools.py --out "$RUNNER_TEMP/tools" echo "$RUNNER_TEMP/tools" >> "$GITHUB_PATH" - name: Test suite (headless) env: QT_QPA_PLATFORM: offscreen XDG_CONFIG_HOME: ${{ runner.temp }}/xdg/config XDG_DATA_HOME: ${{ runner.temp }}/xdg/share XDG_CACHE_HOME: ${{ runner.temp }}/xdg/cache run: python -m pytest -q -m "not linux_only" -p no:cacheprovider build: name: Build (${{ matrix.label }}) strategy: fail-fast: false matrix: include: - runner: macos-15 label: AppleSilicon - runner: macos-15-intel label: Intel runs-on: ${{ matrix.runner }} timeout-minutes: 60 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: ${{ env.PYTHON_VERSION }} - name: Tag matches __version__ if: startsWith(github.ref, 'refs/tags/v') run: | version="$(sed -n 's/^__version__ = "\(.*\)"$/\1/p' lintunes/__init__.py)" if [ "v$version" != "$GITHUB_REF_NAME" ]; then echo "::error::tag $GITHUB_REF_NAME but lintunes/__init__.py says $version" exit 1 fi - name: Build LinTunes.app and the .dmg env: PYTHON: python # Developer ID signing + notarization: inactive until these # secrets exist (docs/mac-release.md). Empty = ad-hoc signing. MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }} MACOS_NOTARY_APPLE_ID: ${{ secrets.MACOS_NOTARY_APPLE_ID }} MACOS_NOTARY_TEAM_ID: ${{ secrets.MACOS_NOTARY_TEAM_ID }} MACOS_NOTARY_PASSWORD: ${{ secrets.MACOS_NOTARY_PASSWORD }} run: packaging/mac/build.sh - name: Launch smoke test run: packaging/mac/smoke_test.sh build/mac/dist/LinTunes.app 20 - name: Mount the .dmg and check what's inside run: | dmg="$(ls build/mac/LinTunes-*-${{ matrix.label }}.dmg)" mnt="$(mktemp -d)" hdiutil attach -nobrowse -readonly -mountpoint "$mnt" "$dmg" test -d "$mnt/LinTunes.app" test -L "$mnt/Applications" codesign --verify --deep --strict "$mnt/LinTunes.app" hdiutil detach "$mnt" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: LinTunes-${{ matrix.label }} path: | build/mac/LinTunes-*.dmg build/mac/LinTunes-*.dmg.sha256 build/mac/pip-freeze-*.txt if-no-files-found: error retention-days: 14 release: name: Publish the GitHub Release needs: build if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: contents: write # create the release and upload its files steps: - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: pattern: LinTunes-* path: dist merge-multiple: true - name: SHA256SUMS working-directory: dist run: | sha256sum LinTunes-*.dmg > SHA256SUMS cat SHA256SUMS - name: Create or update the release env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} TAG: ${{ github.ref_name }} run: | notes="LinTunes ${TAG#v} for macOS. - Apple Silicon (M1 and later): LinTunes-${TAG#v}-AppleSilicon.dmg - Intel: LinTunes-${TAG#v}-Intel.dmg Not sure which Mac you have? Apple menu > About This Mac: \"Chip: Apple M…\" is Apple Silicon, \"Processor: … Intel …\" is Intel. The app is not signed by Apple yet: the first time, macOS will refuse to open it. Open System Settings > Privacy & Security, scroll down, and click Open Anyway. Full instructions: docs/mac.md in the repository. Check a download with: shasum -a 256 -c SHA256SUMS --ignore-missing" if gh release view "$TAG" >/dev/null 2>&1; then gh release upload "$TAG" dist/LinTunes-*.dmg dist/SHA256SUMS --clobber else gh release create "$TAG" dist/LinTunes-*.dmg dist/SHA256SUMS \ --title "LinTunes ${TAG#v}" --notes "$notes" --verify-tag fi