2023-01-28 12:32:30 +00:00
|
|
|
name: Release (MacOS)
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
2023-04-25 17:43:45 +00:00
|
|
|
inputs:
|
|
|
|
survey_key:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: ""
|
2023-01-28 12:32:30 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
macos:
|
|
|
|
name: MacOS
|
|
|
|
|
2024-03-09 14:41:34 +00:00
|
|
|
runs-on: macos-14
|
2023-01-28 12:32:30 +00:00
|
|
|
env:
|
|
|
|
MACOSX_DEPLOYMENT_TARGET: 10.13
|
|
|
|
|
|
|
|
steps:
|
2024-03-28 20:22:20 +00:00
|
|
|
- name: Setup Xcode version
|
|
|
|
uses: maxim-lobanov/setup-xcode@v1
|
|
|
|
with:
|
|
|
|
xcode-version: latest-stable
|
|
|
|
|
2023-01-28 12:32:30 +00:00
|
|
|
- name: Download source
|
2024-01-25 21:22:33 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2023-01-28 12:32:30 +00:00
|
|
|
with:
|
|
|
|
name: internal-source
|
|
|
|
|
|
|
|
- name: Unpack source
|
|
|
|
run: |
|
|
|
|
tar -xf source.tar.gz --strip-components=1
|
|
|
|
|
2023-08-30 18:27:15 +00:00
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
|
|
|
|
- name: Enable Rust cache
|
|
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
|
2023-12-30 16:58:18 +00:00
|
|
|
- name: Setup vcpkg caching
|
2024-01-25 21:22:33 +00:00
|
|
|
uses: actions/github-script@v7
|
2023-12-30 16:58:18 +00:00
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
|
|
|
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
|
|
|
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
|
|
|
|
2024-03-09 14:01:18 +00:00
|
|
|
- name: Install vcpkg
|
|
|
|
run: |
|
2024-03-11 18:53:09 +00:00
|
|
|
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
|
|
|
|
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
2024-03-09 14:01:18 +00:00
|
|
|
|
2023-01-28 12:32:30 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
env:
|
|
|
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
|
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
|
|
|
run: |
|
2023-08-30 18:27:15 +00:00
|
|
|
echo "::group::Install brew dependencies"
|
2023-02-16 21:35:51 +00:00
|
|
|
brew install \
|
|
|
|
pandoc \
|
|
|
|
# EOF
|
2023-08-30 18:27:15 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Install breakpad dependencies"
|
2024-03-09 11:42:09 +00:00
|
|
|
cargo install --locked dump_syms
|
2023-08-30 18:27:15 +00:00
|
|
|
echo "::endgroup::"
|
2023-01-28 12:32:30 +00:00
|
|
|
|
|
|
|
- name: Install GCC problem matcher
|
|
|
|
uses: ammaraskar/gcc-problem-matcher@master
|
|
|
|
|
|
|
|
- name: Build tools
|
|
|
|
run: |
|
|
|
|
mkdir build-host
|
|
|
|
cd build-host
|
|
|
|
|
|
|
|
echo "::group::CMake"
|
|
|
|
cmake ${GITHUB_WORKSPACE} \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DOPTION_TOOLS_ONLY=ON \
|
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Build tools"
|
|
|
|
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
|
|
|
cmake --build . -j $(sysctl -n hw.logicalcpu) --target tools
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- name: Import code signing certificates
|
2023-04-26 13:21:29 +00:00
|
|
|
uses: Apple-Actions/import-codesign-certs@v2
|
2023-01-28 12:32:30 +00:00
|
|
|
with:
|
|
|
|
# The certificates in a PKCS12 file encoded as a base64 string
|
|
|
|
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
|
|
|
|
# The password used to import the PKCS12 file.
|
|
|
|
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
|
|
|
|
# If this is run on a fork, there may not be a certificate set up - continue in this case
|
|
|
|
continue-on-error: true
|
|
|
|
|
|
|
|
- name: Build arm64
|
|
|
|
run: |
|
|
|
|
mkdir build-arm64
|
|
|
|
cd build-arm64
|
|
|
|
|
|
|
|
echo "::group::CMake"
|
|
|
|
cmake ${GITHUB_WORKSPACE} \
|
|
|
|
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
|
|
|
-DVCPKG_TARGET_TRIPLET=arm64-osx \
|
2024-03-11 18:53:09 +00:00
|
|
|
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
2023-01-28 12:32:30 +00:00
|
|
|
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
2023-04-25 17:43:45 +00:00
|
|
|
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
2023-01-28 12:32:30 +00:00
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Build"
|
|
|
|
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
2023-05-02 21:43:16 +00:00
|
|
|
cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
|
2023-01-28 12:32:30 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- name: Build x64
|
|
|
|
run: |
|
|
|
|
mkdir build-x64
|
|
|
|
cd build-x64
|
|
|
|
|
|
|
|
echo "::group::CMake"
|
|
|
|
cmake ${GITHUB_WORKSPACE} \
|
|
|
|
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
|
|
|
|
-DVCPKG_TARGET_TRIPLET=x64-osx \
|
2024-03-11 18:53:09 +00:00
|
|
|
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
2023-01-28 12:32:30 +00:00
|
|
|
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
2023-04-25 17:43:45 +00:00
|
|
|
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
2023-01-28 12:32:30 +00:00
|
|
|
-DCPACK_BUNDLE_APPLE_CERT_APP=${{ secrets.APPLE_DEVELOPER_CERTIFICATE_ID }} \
|
|
|
|
"-DCPACK_BUNDLE_APPLE_CODESIGN_PARAMETER=--deep -f --options runtime" \
|
|
|
|
-DAPPLE_UNIVERSAL_PACKAGE=1 \
|
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Build"
|
|
|
|
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
2023-05-02 21:43:16 +00:00
|
|
|
cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
|
2023-01-28 12:32:30 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
2023-08-30 18:27:15 +00:00
|
|
|
- name: Create breakpad symbols
|
|
|
|
run: |
|
|
|
|
cd build-x64
|
|
|
|
mkdir dSYM
|
|
|
|
dsymutil ./openttd -o dSYM/openttd
|
|
|
|
dump_syms ./dSYM/openttd --inlines --store symbols
|
|
|
|
|
|
|
|
cd ../build-arm64
|
|
|
|
mkdir dSYM
|
|
|
|
dsymutil ./openttd -o dSYM/openttd
|
|
|
|
dump_syms ./dSYM/openttd --inlines --store ../build-x64/symbols
|
|
|
|
|
2023-01-28 12:32:30 +00:00
|
|
|
- name: Create bundles
|
|
|
|
run: |
|
|
|
|
cd build-x64
|
|
|
|
|
|
|
|
echo "::group::Create universal binary"
|
|
|
|
# Combine the `openttd` binaries from each build into a single file
|
|
|
|
lipo -create -output openttd-universal ../build-*/openttd
|
|
|
|
mv openttd-universal openttd
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Run CPack"
|
|
|
|
cpack
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Cleanup"
|
|
|
|
# Remove the sha256 files CPack generates; we will do this ourself at
|
|
|
|
# the end of this workflow.
|
|
|
|
rm -f bundles/*.sha256
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- name: Notarize
|
|
|
|
env:
|
|
|
|
AC_USERNAME: ${{ secrets.APPLE_DEVELOPER_APP_USERNAME }}
|
|
|
|
AC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_APP_PASSWORD }}
|
2023-06-14 15:14:45 +00:00
|
|
|
AC_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
|
2023-01-28 12:32:30 +00:00
|
|
|
run: |
|
2023-06-14 15:14:45 +00:00
|
|
|
if [ -z "${AC_USERNAME}" ]; then
|
|
|
|
# We may be running on a fork that doesn't have notarization secrets set up; skip this step
|
|
|
|
echo No notarization secrets set up, skipping.
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
xcrun notarytool store-credentials --apple-id "${AC_USERNAME}" --password "${AC_PASSWORD}" --team-id "${AC_TEAM_ID}" openttd
|
2023-01-28 12:32:30 +00:00
|
|
|
cd build-x64
|
|
|
|
../os/macosx/notarize.sh
|
|
|
|
|
|
|
|
- name: Build zip
|
|
|
|
run: |
|
|
|
|
cd build-x64
|
|
|
|
|
|
|
|
pushd _CPack_Packages/*/Bundle/openttd-*/
|
|
|
|
|
|
|
|
# Remove the Applications symlink from the staging folder
|
|
|
|
rm -f Applications
|
|
|
|
|
|
|
|
# Remove the original dmg built by CPack to avoid a conflict when resolving
|
|
|
|
# the zip_filename variable below
|
|
|
|
rm -f ../*.dmg
|
|
|
|
|
|
|
|
zip_filename=(../openttd-*)
|
|
|
|
|
|
|
|
# Package up the existing, notarised .app into a zip file
|
|
|
|
zip -r -9 ${zip_filename}.zip OpenTTD.app
|
|
|
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Now move it into place to be uploaded
|
|
|
|
mv _CPack_Packages/*/Bundle/openttd-*.zip bundles/
|
|
|
|
|
|
|
|
- name: Store bundles
|
2024-01-25 21:22:33 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-01-28 12:32:30 +00:00
|
|
|
with:
|
|
|
|
name: openttd-macos-universal
|
|
|
|
path: build-x64/bundles
|
|
|
|
retention-days: 5
|
2023-08-30 18:27:15 +00:00
|
|
|
|
|
|
|
- name: Store symbols
|
2024-01-25 21:22:33 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-08-30 18:27:15 +00:00
|
|
|
with:
|
|
|
|
name: symbols-macos-universal
|
|
|
|
path: build-x64/symbols
|
|
|
|
retention-days: 5
|