2024-03-10 09:29:41 +00:00
|
|
|
name: CI (MacOS)
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
arch:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
full_arch:
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-03-16 14:11:23 +00:00
|
|
|
extra-cmake-parameters:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: ""
|
2024-03-10 09:29:41 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
CTEST_OUTPUT_ON_FAILURE: 1
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
macos:
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
runs-on: macos-14
|
|
|
|
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
|
|
|
|
|
2024-03-10 09:29:41 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Setup vcpkg caching
|
|
|
|
uses: actions/github-script@v7
|
|
|
|
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')
|
|
|
|
|
|
|
|
- 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-10 09:29:41 +00:00
|
|
|
|
|
|
|
- name: Install OpenGFX
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/Documents/OpenTTD/baseset
|
|
|
|
cd ~/Documents/OpenTTD/baseset
|
|
|
|
|
|
|
|
echo "::group::Download OpenGFX"
|
|
|
|
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Unpack OpenGFX"
|
|
|
|
unzip opengfx-all.zip
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
rm -f opengfx-all.zip
|
|
|
|
|
|
|
|
- name: Install GCC problem matcher
|
|
|
|
uses: ammaraskar/gcc-problem-matcher@master
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
echo "::group::CMake"
|
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_OSX_ARCHITECTURES=${{ inputs.full_arch }} \
|
|
|
|
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-osx \
|
2024-03-11 18:53:09 +00:00
|
|
|
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
2024-03-16 14:11:23 +00:00
|
|
|
${{ inputs.extra-cmake-parameters }} \
|
2024-03-10 09:29:41 +00:00
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Build"
|
|
|
|
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
|
|
|
cmake --build . -j $(sysctl -n hw.logicalcpu)
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
cd build
|
|
|
|
ctest -j $(sysctl -n hw.logicalcpu) --timeout 120
|