mirror of
https://github.com/xemu-project/xemu.git
synced 2026-10-20 17:49:17 +02:00
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 7.0.1 to 7.0.2. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 7.0.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
136 lines
4.5 KiB
YAML
136 lines
4.5 KiB
YAML
name: Build for macOS
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
pkg_version:
|
|
description: Build version
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
name: Build for macOS (${{ matrix.arch }}, ${{ matrix.configuration }})
|
|
runs-on: macos-15
|
|
strategy:
|
|
matrix:
|
|
arch: [x86_64, arm64]
|
|
configuration: [debug, release]
|
|
env:
|
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
|
CCACHE_DIR: ${{ github.workspace }}/xemu-ccache
|
|
CCACHE_MAXSIZE: 512M
|
|
LTO_CACHE_DIR: ${{ github.workspace }}/xemu-lto-cache
|
|
steps:
|
|
- name: Download source package
|
|
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v4
|
|
with:
|
|
name: src
|
|
- name: Extract source package
|
|
run: tar -xf xemu-${{ inputs.pkg_version }}.tar.zst --strip-components=2
|
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Install dependencies
|
|
run: |
|
|
brew install \
|
|
ccache \
|
|
coreutils \
|
|
dylibbundler
|
|
pip install pyyaml requests
|
|
- name: Initialize compiler, library cache
|
|
id: cache
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
|
|
with:
|
|
path: |
|
|
macos-pkgs
|
|
${{ env.CCACHE_DIR }}
|
|
${{ env.LTO_CACHE_DIR }}
|
|
key: cache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-${{ github.sha }}
|
|
restore-keys: cache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-
|
|
- name: Setup ccache
|
|
run: |
|
|
echo "PATH=/opt/homebrew/opt/ccache/libexec:$PATH" >> "$GITHUB_ENV"
|
|
mkdir -p ${CCACHE_DIR}
|
|
ccache -z
|
|
- name: Setup build options
|
|
run: |
|
|
if [[ "${{ matrix.configuration }}" == "debug" ]]; then
|
|
opts=(
|
|
--debug
|
|
)
|
|
else
|
|
opts=(
|
|
-Db_lto=true
|
|
-Db_lto_mode=thin
|
|
-Db_thinlto_cache=true
|
|
-Db_thinlto_cache_dir="$LTO_CACHE_DIR"
|
|
-Dx86_version=3
|
|
)
|
|
mkdir -p ${LTO_CACHE_DIR}
|
|
fi
|
|
echo "XEMU_BUILD_OPTIONS=${opts[*]}" >> "$GITHUB_ENV"
|
|
- name: Compile
|
|
run: ./build.sh -a ${{ matrix.arch }} ${XEMU_BUILD_OPTIONS}
|
|
- name: Report ccache stats
|
|
run: ccache -s
|
|
- name: Package
|
|
id: package
|
|
env:
|
|
VERSION: ${{ inputs.pkg_version }}${{ matrix.configuration == 'debug' && '-dbg' || '' }}
|
|
run: |
|
|
pkg_filename="xemu-${VERSION}-macos-${{ matrix.arch }}-unsigned.zip"
|
|
echo "pkg_filename=${pkg_filename}" >> $GITHUB_OUTPUT
|
|
|
|
pushd dist
|
|
zip -r ../${pkg_filename} *
|
|
popd
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v4
|
|
with:
|
|
name: xemu-macos-${{ matrix.arch }}-${{ matrix.configuration }}
|
|
path: ${{ steps.package.outputs.pkg_filename }}
|
|
compression-level: 0
|
|
|
|
build_universal:
|
|
name: Build macOS Universal bundle (${{ matrix.configuration }})
|
|
runs-on: macos-15
|
|
needs: build
|
|
strategy:
|
|
matrix:
|
|
configuration: [debug, release]
|
|
steps:
|
|
- name: Download architecture-specific builds
|
|
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v4
|
|
with:
|
|
pattern: "xemu-macos-*-${{ matrix.configuration }}"
|
|
merge-multiple: true
|
|
- name: Build Universal bundle
|
|
run: |
|
|
mkdir dist
|
|
pushd dist
|
|
for arch in x86_64 arm64; do
|
|
unzip -o ../xemu-*-${arch}-unsigned.zip
|
|
mv xemu.app/Contents/MacOS/xemu ../xemu_${arch}
|
|
done
|
|
lipo -create -output xemu.app/Contents/MacOS/xemu ../xemu_x86_64 ../xemu_arm64
|
|
codesign --force --deep --preserve-metadata=entitlements,requirements,flags,runtime --sign - xemu.app/Contents/MacOS/xemu
|
|
popd
|
|
- name: Package
|
|
id: package
|
|
env:
|
|
VERSION: ${{ inputs.pkg_version }}${{ matrix.configuration == 'debug' && '-dbg' || '' }}
|
|
run: |
|
|
pkg_filename="xemu-${VERSION}-macos-universal-unsigned.zip"
|
|
echo "pkg_filename=${pkg_filename}" >> $GITHUB_OUTPUT
|
|
pushd dist
|
|
zip -r ../${pkg_filename} *
|
|
popd
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v4
|
|
with:
|
|
name: xemu-macos-universal-${{ matrix.configuration }}
|
|
path: ${{ steps.package.outputs.pkg_filename }}
|
|
compression-level: 0
|