pcsx2/.github/workflows/macos-workflow.yml

153 lines
5.4 KiB
YAML
Raw Normal View History

name: 🍎 MacOS Builds
2020-09-20 02:40:57 +00:00
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
2022-04-11 07:18:20 +00:00
tags:
- v*
2020-09-20 02:40:57 +00:00
pull_request:
branches:
- master
paths-ignore:
- '**/*.md'
- '**/*.bat'
- '**/*.cmd'
- '**/*.props'
- '**/*.sln'
- '.clang-format'
- '.codacy.yaml'
- '.github/*'
- '.github/workflows/lint-gamedb.yml'
- '.github/workflows/linux-workflow.yml'
- '.github/workflows/pr-triage.yml'
- '.github/workflows/scripts/windows/**'
- '.github/workflows/scripts/validation/**'
- '.github/workflows/windows-workflow.yml'
- '.gitignore'
- 'bin/PCSX2_keys.ini.default'
- 'build.sh'
- 'buildbot.xml'
- 'pcsx2/CDVD/Windows/**'
- 'pcsx2/DEV9/Win32/**'
- 'pcsx2/PAD/Windows/**'
- 'pcsx2/SPU2/Windows/**'
- 'pcsx2/USB/Win32/**'
- 'pcsx2/windows/**'
2020-09-20 02:40:57 +00:00
jobs:
build:
strategy:
# Prevent one build from failing everything (although maybe those should be included as experimental builds instead)
fail-fast: false
matrix:
2021-09-28 20:37:23 +00:00
os: [macos-11.0]
2020-09-20 02:40:57 +00:00
platform: [x64]
experimental: [false]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
2022-04-10 21:05:37 +00:00
timeout-minutes: 60
2020-09-20 02:40:57 +00:00
steps:
# NOTE - useful for debugging
# - name: Dump GitHub context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: |
# echo "$GITHUB_CONTEXT"
# echo ${{ github.event.pull_request.title }}
- name: Checkout Repository
uses: actions/checkout@v3
2020-09-20 02:40:57 +00:00
- name: Checkout Submodules
run: git submodule update --init --recursive -j $(getconf _NPROCESSORS_ONLN)
2020-09-20 02:40:57 +00:00
2022-04-11 07:20:08 +00:00
- name: Install Packages
2020-09-20 02:40:57 +00:00
env:
PLATFORM: ${{ matrix.platform }}
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_ANALYTICS: 1
2020-09-20 02:40:57 +00:00
run: |
2022-04-11 07:20:08 +00:00
brew unlink libjpeg libpng # Conflicts with our self-built dependencies
# Unlike other packages, brew's MoltenVK build uses MoltenVK's minimum macOS version of 10.13 so we can use it
if ! brew install molten-vk; then
brew update
brew install molten-vk
fi
2022-04-10 21:05:37 +00:00
- name: Cache Dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: ~/deps
key: ${{ matrix.os }} ${{ matrix.platform }} deps ${{ hashFiles('.github/workflows/scripts/macos/build-dependencies.sh') }}
- name: Build Dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: .github/workflows/scripts/macos/build-dependencies.sh
2020-09-20 02:40:57 +00:00
- name: Generate CMake Files
2022-04-17 07:47:49 +00:00
run: cmake -DCMAKE_PREFIX_PATH="$HOME/deps" -DCMAKE_BUILD_TYPE=Release -DUSE_OPENGL=OFF -DDISABLE_ADVANCE_SIMD=ON -DLTO_PCSX2_CORE=ON -B build .
2020-09-20 02:40:57 +00:00
- name: Build PCSX2
working-directory: build
run: make -j$(getconf _NPROCESSORS_ONLN) # macOS doesn't use make install
2021-04-24 04:51:02 +00:00
- name: Run Tests
working-directory: build
run: make -j$(getconf _NPROCESSORS_ONLN) unittests
2022-04-11 07:18:20 +00:00
- name: Prepare Artifact Metadata
id: artifact-metadata
run: |
if [ ${{ github.event_name }} == "pull_request" ]; then
PR_SHA=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")
ARTIFACT_NAME="PCSX2"
if [ -n "${{ github.event.pull_request.number }}" ]; then
PR_NUM=${{ github.event.pull_request.number }}
ARTIFACT_NAME="${ARTIFACT_NAME}-pr[${PR_NUM}]"
fi
ARTIFACT_NAME="${ARTIFACT_NAME}-sha[${PR_SHA}]"
if [ -n "${{ github.event.pull_request.title }}" ]; then
PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | tr -cd '[a-zA-Z0-9[:space:]]_-')
ARTIFACT_NAME="${ARTIFACT_NAME}-title[${PR_TITLE}"
fi
else
SHA=$(git rev-parse --short "$GITHUB_SHA")
ARTIFACT_NAME="PCSX2-sha[${SHA}"
fi
TRIMMED_ARTIFACT_NAME=$(printf "%.199s]" "$ARTIFACT_NAME")
echo "name=$TRIMMED_ARTIFACT_NAME"
echo "##[set-output name=name;]${TRIMMED_ARTIFACT_NAME}"
- name: Prepare Build Artifacts
run: |
2022-04-11 07:20:08 +00:00
cp /usr/local/lib/libMoltenVK.dylib build/pcsx2/PCSX2.app/Contents/Frameworks/
2022-04-11 07:18:20 +00:00
mv build/pcsx2/PCSX2.app "${{ steps.artifact-metadata.outputs.name }}.app"
tar cvzf "${{ steps.artifact-metadata.outputs.name }}.tar.gz" "${{ steps.artifact-metadata.outputs.name }}.app"
mkdir ci-artifacts
cp "${{ steps.artifact-metadata.outputs.name }}.tar.gz" ci-artifacts/macOS.tar.gz
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact-metadata.outputs.name }}
path: "*.tar.gz"
- name: Upload Assets and Potential Publish Release
if: github.repository == 'PCSX2/pcsx2' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
ASSET_DIR: ${{ github.WORKSPACE }}/ci-artifacts
ASSET_EXTENSION: tar.gz
TAG_TO_SEARCH_FOR: ${{ github.REF }}
run: |
cd .github/workflows/scripts/releases/upload-release-artifacts
npm ci
node index.js