17 MACOSX_DEPLOYMENT_TARGET: 10.13
20 - name: Setup Xcode version
21 uses: maxim-lobanov/setup-xcode@v1
23 xcode-version: latest-stable
25 - name: Download source
26 uses: actions/download-artifact@v4
32 tar -xf source.tar.gz --strip-components=1
34 - name: Install Rust toolchain
35 uses: dtolnay/rust-toolchain@stable
37 - name: Enable Rust cache
38 uses: Swatinem/rust-cache@v2
40 - name: Setup vcpkg caching
41 uses: actions/github-script@v7
44 core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
45 core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
46 core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
50 git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
51 ${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
53 - name: Install dependencies
55 HOMEBREW_NO_AUTO_UPDATE: 1
56 HOMEBREW_NO_INSTALL_CLEANUP: 1
58 echo "::group::Install brew dependencies"
64 echo "::group::Install breakpad dependencies"
65 cargo install --locked dump_syms
68 - name: Install GCC problem matcher
69 uses: ammaraskar/gcc-problem-matcher@master
77 cmake ${GITHUB_WORKSPACE} \
78 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
79 -DOPTION_TOOLS_ONLY=ON \
83 echo "::group::Build tools"
84 echo "Running on $(sysctl -n hw.logicalcpu) cores"
85 cmake --build . -j $(sysctl -n hw.logicalcpu) --target tools
88 - name: Import code signing certificates
89 uses: Apple-Actions/import-codesign-certs@v3
91 # The certificates in a PKCS12 file encoded as a base64 string
92 p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
93 # The password used to import the PKCS12 file.
94 p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
95 # If this is run on a fork, there may not be a certificate set up - continue in this case
96 continue-on-error: true
103 echo "::group::CMake"
104 cmake ${GITHUB_WORKSPACE} \
105 -DCMAKE_OSX_ARCHITECTURES=arm64 \
106 -DVCPKG_TARGET_TRIPLET=arm64-osx \
107 -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
108 -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
109 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
110 -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
114 echo "::group::Build"
115 echo "Running on $(sysctl -n hw.logicalcpu) cores"
116 cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
124 echo "::group::CMake"
125 cmake ${GITHUB_WORKSPACE} \
126 -DCMAKE_OSX_ARCHITECTURES=x86_64 \
127 -DVCPKG_TARGET_TRIPLET=x64-osx \
128 -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
129 -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
130 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
131 -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
132 -DCPACK_BUNDLE_APPLE_CERT_APP=${{ secrets.APPLE_DEVELOPER_CERTIFICATE_ID }} \
133 "-DCPACK_BUNDLE_APPLE_CODESIGN_PARAMETER=--deep -f --options runtime" \
134 -DAPPLE_UNIVERSAL_PACKAGE=1 \
138 echo "::group::Build"
139 echo "Running on $(sysctl -n hw.logicalcpu) cores"
140 cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
143 - name: Create breakpad symbols
147 dsymutil ./openttd -o dSYM/openttd
148 dump_syms ./dSYM/openttd --inlines --store symbols
152 dsymutil ./openttd -o dSYM/openttd
153 dump_syms ./dSYM/openttd --inlines --store ../build-x64/symbols
155 - name: Create bundles
159 echo "::group::Create universal binary"
160 # Combine the `openttd` binaries from each build into a single file
161 lipo -create -output openttd-universal ../build-*/openttd
162 mv openttd-universal openttd
165 echo "::group::Run CPack"
169 echo "::group::Cleanup"
170 # Remove the sha256 files CPack generates; we will do this ourself at
171 # the end of this workflow.
172 rm -f bundles/*.sha256
177 AC_USERNAME: ${{ secrets.APPLE_DEVELOPER_APP_USERNAME }}
178 AC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_APP_PASSWORD }}
179 AC_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
181 if [ -z "${AC_USERNAME}" ]; then
182 # We may be running on a fork that doesn't have notarization secrets set up; skip this step
183 echo No notarization secrets set up, skipping.
187 xcrun notarytool store-credentials --apple-id "${AC_USERNAME}" --password "${AC_PASSWORD}" --team-id "${AC_TEAM_ID}" openttd
189 ../os/macosx/notarize.sh
195 pushd _CPack_Packages/*/Bundle/openttd-*/
197 # Remove the Applications symlink from the staging folder
200 # Remove the original dmg built by CPack to avoid a conflict when resolving
201 # the zip_filename variable below
204 zip_filename=(../openttd-*)
206 # Package up the existing, notarised .app into a zip file
207 zip -r -9 ${zip_filename}.zip OpenTTD.app
211 # Now move it into place to be uploaded
212 mv _CPack_Packages/*/Bundle/openttd-*.zip bundles/
214 - name: Store bundles
215 uses: actions/upload-artifact@v4
217 name: openttd-macos-universal
218 path: build-x64/bundles
221 - name: Store symbols
222 uses: actions/upload-artifact@v4
224 name: symbols-macos-universal
225 path: build-x64/symbols