2024-03-10 09:29:41 +00:00
|
|
|
name: CI (Linux)
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
compiler:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
cxxcompiler:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
libraries:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
extra-cmake-parameters:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
env:
|
|
|
|
CTEST_OUTPUT_ON_FAILURE: 1
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linux:
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
CC: ${{ inputs.compiler }}
|
|
|
|
CXX: ${{ inputs.cxxcompiler }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-03-12 17:44:28 +00:00
|
|
|
if: github.event_name != 'workflow_dispatch'
|
2024-03-10 09:29:41 +00:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2024-03-12 17:44:28 +00:00
|
|
|
- name: Checkout (Manual)
|
|
|
|
if: github.event_name == 'workflow_dispatch'
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.inputs.ref }}
|
|
|
|
|
2024-03-10 09:29:41 +00:00
|
|
|
- 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 dependencies
|
|
|
|
run: |
|
|
|
|
echo "::group::Update apt"
|
|
|
|
sudo apt-get update
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Install dependencies"
|
|
|
|
sudo apt-get install -y --no-install-recommends \
|
|
|
|
liballegro4-dev \
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
libfontconfig-dev \
|
|
|
|
libharfbuzz-dev \
|
|
|
|
libicu-dev \
|
|
|
|
liblzma-dev \
|
2024-03-12 17:44:28 +00:00
|
|
|
libzstd-dev \
|
2024-03-10 09:29:41 +00:00
|
|
|
liblzo2-dev \
|
|
|
|
${{ inputs.libraries }} \
|
|
|
|
zlib1g-dev \
|
|
|
|
# EOF
|
|
|
|
|
|
|
|
echo "::group::Install vcpkg dependencies"
|
|
|
|
|
|
|
|
# Disable vcpkg integration, as we mostly use system libraries.
|
|
|
|
mv vcpkg.json vcpkg-disabled.json
|
|
|
|
|
|
|
|
# We only use breakpad from vcpkg, as its CMake files
|
|
|
|
# are a bit special. So the Ubuntu's variant doesn't work.
|
2024-03-12 17:44:28 +00:00
|
|
|
#${{ runner.temp }}/vcpkg/vcpkg install breakpad
|
2024-03-10 09:29:41 +00:00
|
|
|
|
|
|
|
echo "::endgroup::"
|
|
|
|
env:
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
|
|
|
|
- name: Get OpenGFX
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.local/share/openttd/baseset
|
|
|
|
cd ~/.local/share/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"
|
2024-03-11 18:53:09 +00:00
|
|
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ inputs.extra-cmake-parameters }}
|
2024-03-10 09:29:41 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Build"
|
|
|
|
echo "Running on $(nproc) cores"
|
2024-03-12 17:44:28 +00:00
|
|
|
cmake --build . -j $(nproc) --target all openttd_test
|
2024-03-10 09:29:41 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
(
|
|
|
|
cd build
|
|
|
|
ctest -j $(nproc) --timeout 120
|
|
|
|
)
|
|
|
|
|
|
|
|
# Re-enable vcpkg.
|
|
|
|
mv vcpkg-disabled.json vcpkg.json
|
|
|
|
|
|
|
|
# Check no tracked files have been modified.
|
|
|
|
git diff --exit-code
|