name: 🍎 MacOS Builds # 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 tags: - v* 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/**' jobs: build: strategy: # Prevent one build from failing everything (although maybe those should be included as experimental builds instead) fail-fast: false matrix: os: [macos-11.0] 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. timeout-minutes: 60 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 - name: Checkout Submodules run: git submodule update --init --recursive -j $(getconf _NPROCESSORS_ONLN) - name: Install Packages env: PLATFORM: ${{ matrix.platform }} HOMEBREW_NO_INSTALL_CLEANUP: 1 HOMEBREW_NO_ANALYTICS: 1 run: | 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 - 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 - name: Generate CMake Files run: cmake -DCMAKE_PREFIX_PATH="$HOME/deps" -DCMAKE_BUILD_TYPE=Release -DUSE_OPENGL=OFF -DDISABLE_ADVANCE_SIMD=ON -DLTO_PCSX2_CORE=ON -B build . - name: Build PCSX2 working-directory: build run: make -j$(getconf _NPROCESSORS_ONLN) # macOS doesn't use make install - name: Run Tests working-directory: build run: make -j$(getconf _NPROCESSORS_ONLN) unittests - 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: | cp /usr/local/lib/libMoltenVK.dylib build/pcsx2/PCSX2.app/Contents/Frameworks/ 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