2022-05-14 05:56:57 +00:00
|
|
|
name: MacOS Build Steps
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
jobName:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
os:
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-06-26 23:12:10 +00:00
|
|
|
default: macos-13
|
2023-07-20 01:44:20 +00:00
|
|
|
patchesUrl:
|
2022-08-04 19:33:37 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: https://github.com/PCSX2/pcsx2_patches/releases/latest/download
|
2023-07-20 01:44:20 +00:00
|
|
|
fetchTags:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_macos:
|
|
|
|
name: ${{ inputs.jobName }}
|
|
|
|
runs-on: ${{ inputs.os }}
|
|
|
|
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
|
2022-05-26 05:30:00 +00:00
|
|
|
timeout-minutes: 90
|
2022-05-14 05:56:57 +00:00
|
|
|
env:
|
|
|
|
POWERSHELL_TELEMETRY_OPTOUT: 1
|
2022-08-22 07:22:36 +00:00
|
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
|
|
CCACHE_COMPRESS: true
|
|
|
|
CCACHE_COMPRESSLEVEL: 9
|
|
|
|
CCACHE_MAXSIZE: 100M
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout Repository
|
2023-09-11 04:33:40 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-05-14 05:56:57 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
2023-07-11 07:10:03 +00:00
|
|
|
# actions/checkout elides tags, fetch them primarily for releases
|
|
|
|
- name: Fetch Tags
|
2023-07-20 01:44:20 +00:00
|
|
|
if: ${{ inputs.fetchTags }}
|
2023-07-11 07:10:03 +00:00
|
|
|
run: git fetch --tags --no-recurse-submodules
|
|
|
|
|
2023-06-26 23:12:10 +00:00
|
|
|
- name: Use Xcode 14.3.1
|
|
|
|
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
|
|
|
|
|
2022-05-14 05:56:57 +00:00
|
|
|
- name: Prepare Artifact Metadata
|
|
|
|
id: artifact-metadata
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
OS: macos
|
|
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
|
|
PR_NUM: ${{ github.event.pull_request.number }}
|
|
|
|
PR_SHA: ${{ github.event.pull_request.head.sha }}
|
|
|
|
run: ./.github/workflows/scripts/common/name-artifacts.sh
|
|
|
|
|
|
|
|
- name: Install Packages
|
|
|
|
env:
|
2023-07-09 11:16:46 +00:00
|
|
|
PLATFORM: "x64"
|
2022-05-14 05:56:57 +00:00
|
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
|
|
|
HOMEBREW_NO_ANALYTICS: 1
|
|
|
|
run: |
|
|
|
|
# Unlike other packages, brew's MoltenVK build uses MoltenVK's minimum macOS version of 10.13 so we can use it
|
2023-06-27 05:24:31 +00:00
|
|
|
if ! brew install molten-vk ccache nasm; then
|
2022-05-14 05:56:57 +00:00
|
|
|
brew update
|
2023-06-27 05:24:31 +00:00
|
|
|
brew install molten-vk ccache nasm
|
2022-05-14 05:56:57 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Cache Dependencies
|
|
|
|
id: cache-deps
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ~/deps
|
2023-07-09 11:16:46 +00:00
|
|
|
key: ${{ inputs.os }} deps ${{ hashFiles('.github/workflows/scripts/macos/build-dependencies.sh') }}
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Build Dependencies
|
|
|
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
2023-12-30 06:54:14 +00:00
|
|
|
run: |
|
|
|
|
.github/workflows/scripts/macos/build-dependencies.sh "$HOME/deps"
|
2022-05-14 05:56:57 +00:00
|
|
|
|
2023-05-26 10:33:51 +00:00
|
|
|
- name: Download patches
|
2022-08-04 19:33:37 +00:00
|
|
|
run: |
|
|
|
|
cd bin/resources
|
2023-07-20 01:44:20 +00:00
|
|
|
aria2c -Z "${{ inputs.patchesUrl }}/patches.zip"
|
2022-08-04 19:33:37 +00:00
|
|
|
|
2022-08-22 07:22:36 +00:00
|
|
|
# -- SETUP CCACHE - https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/
|
|
|
|
- name: Prepare ccache timestamp
|
|
|
|
id: ccache_cache_timestamp
|
2022-10-19 21:49:51 +00:00
|
|
|
run: echo "timestamp=$(date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
2022-08-22 07:22:36 +00:00
|
|
|
|
|
|
|
- name: Cache ccache cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: .ccache
|
2023-07-09 11:16:46 +00:00
|
|
|
key: ${{ inputs.os }} ccache ${{ steps.ccache_cache_timestamp.outputs.timestamp }}
|
|
|
|
restore-keys: ${{ inputs.os }} ccache
|
2022-08-22 07:22:36 +00:00
|
|
|
|
2022-05-14 05:56:57 +00:00
|
|
|
- name: Generate CMake Files
|
2022-05-26 05:30:00 +00:00
|
|
|
run: |
|
2022-08-22 07:22:36 +00:00
|
|
|
cmake -DCMAKE_PREFIX_PATH="$HOME/deps" \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DUSE_OPENGL=OFF \
|
|
|
|
-DDISABLE_ADVANCE_SIMD=ON \
|
|
|
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
|
|
|
-DUSE_SYSTEM_LIBS=OFF \
|
|
|
|
-DUSE_SYSTEM_SDL2=ON \
|
2023-06-27 05:24:31 +00:00
|
|
|
-DUSE_LINKED_FFMPEG=ON \
|
2022-08-22 07:22:36 +00:00
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \
|
|
|
|
-B build .
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Build PCSX2
|
|
|
|
working-directory: build
|
2022-08-22 07:22:36 +00:00
|
|
|
run: |
|
|
|
|
ccache -p
|
|
|
|
ccache -s
|
|
|
|
ccache -z
|
|
|
|
make -j$(getconf _NPROCESSORS_ONLN) # macOS doesn't use make install
|
|
|
|
ccache -s
|
2022-08-31 06:57:53 +00:00
|
|
|
# Ensure there's no global constructors in multi-isa files
|
|
|
|
for dir in */CMakeFiles/GS-{avx,avx2}.dir; do
|
|
|
|
if find "$dir" -name "*.o" | xargs nm | grep _GLOBAL_; then
|
|
|
|
echo "::error::Multi-isa files must not have global constructors!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
working-directory: build
|
|
|
|
run: make -j$(getconf _NPROCESSORS_ONLN) unittests
|
|
|
|
|
|
|
|
- name: Prepare Build Artifacts
|
|
|
|
run: |
|
2022-05-26 05:30:00 +00:00
|
|
|
cp /usr/local/lib/libMoltenVK.dylib build/pcsx2*/PCSX2.app/Contents/Frameworks/
|
2022-05-26 02:17:16 +00:00
|
|
|
TAG="$(git tag --points-at HEAD)"
|
|
|
|
if [ -z "$TAG" ]; then
|
|
|
|
APPNAME="${{ steps.artifact-metadata.outputs.artifact-name }}"
|
|
|
|
else
|
|
|
|
APPNAME="PCSX2-$TAG"
|
|
|
|
fi
|
2022-05-26 05:30:00 +00:00
|
|
|
mv build/pcsx2*/PCSX2.app "$APPNAME.app"
|
2023-03-13 01:05:23 +00:00
|
|
|
tar --options xz:compression-level=9 -cvJf "${{ steps.artifact-metadata.outputs.artifact-name }}.tar.xz" "$APPNAME.app"
|
2022-05-14 05:56:57 +00:00
|
|
|
mkdir ci-artifacts
|
2023-07-09 11:16:46 +00:00
|
|
|
cp "${{ steps.artifact-metadata.outputs.artifact-name }}.tar.xz" ci-artifacts/macOS.tar.xz
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Upload Artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
2023-03-13 01:05:23 +00:00
|
|
|
path: "*.tar.xz"
|