Fix 95df7ea: Incorrect WindowClasses for deduplicated window descs. (#13412)
[openttd-github.git] / .github / workflows / release-linux.yml
blobc5ce597f4ce8cbf754125f9f49728c9d13547cf6
1 name: Release (Linux)
3 on:
4   workflow_call:
5     inputs:
6       survey_key:
7         required: false
8         type: string
9         default: ""
11 jobs:
12   linux:
13     name: Linux (Generic)
15     runs-on: ubuntu-latest
16     container:
17       # manylinux_2_28 is based on AlmaLinux 8, and already has a lot of things
18       # installed and preconfigured. It makes it easier to build OpenTTD.
19       # This distro is based on glibc 2.28, released in 2018.
20       image: quay.io/pypa/manylinux_2_28_x86_64
22     steps:
23     - name: Download source
24       uses: actions/download-artifact@v4
25       with:
26         name: internal-source
28     - name: Unpack source
29       run: |
30         tar -xf source.tar.gz --strip-components=1
32     - name: Install Rust toolchain
33       uses: dtolnay/rust-toolchain@stable
35     - name: Enable Rust cache
36       uses: Swatinem/rust-cache@v2
38     - name: Setup vcpkg caching
39       uses: actions/github-script@v7
40       with:
41         script: |
42           core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
43           core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
44           core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
46     - name: Install dependencies
47       run: |
48         echo "::group::Install system dependencies"
49         # perl-IPC-Cmd, wget, and zip are needed to run vcpkg.
50         # autoconf-archive is needed to build ICU.
51         yum install -y \
52           autoconf-archive \
53           perl-IPC-Cmd \
54           wget \
55           zip \
56           # EOF
58         # aclocal looks first in /usr/local/share/aclocal, and if that doesn't
59         # exist only looks in /usr/share/aclocal. We have files in both that
60         # are important. So copy the latter to the first, and we are good to
61         # go.
62         cp /usr/share/aclocal/* /usr/local/share/aclocal/
63         echo "::endgroup::"
65         # The yum variant of fluidsynth depends on all possible audio drivers,
66         # like jack, ALSA, pulseaudio, etc. This is not really useful for us,
67         # as we route the output of fluidsynth back via our sound driver, and
68         # as such do not use these audio driver outputs at all.
69         # The vcpkg variant of fluidsynth depends on ALSA. Similar issue here.
70         # So instead, we compile fluidsynth ourselves, with as few
71         # dependencies as possible. We do it before anything else is installed,
72         # to make sure it doesn't pick up on any of the drivers.
73         echo "::group::Install fluidsynth"
74         wget https://github.com/FluidSynth/fluidsynth/archive/v2.3.3.tar.gz
75         tar xf v2.3.3.tar.gz
76         (
77           cd fluidsynth-2.3.3
78           mkdir build
79           cd build
80           cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
81           cmake --build . -j $(nproc)
82           cmake --install .
83         )
85         echo "::group::Install audio drivers"
86         # These audio libs are to make sure the SDL version of vcpkg adds
87         # sound-support; these libraries are not added to the resulting
88         # binary, but the headers are used to enable them in SDL.
89         yum install -y \
90           alsa-lib-devel \
91           pulseaudio-libs-devel \
92           # EOF
93         echo "::endgroup::"
95         echo "::group::Install video drivers"
96         # These video libs are to make sure the SDL version of vcpkg adds
97         # video-support; these libraries are not added to the resulting
98         # binary, but the headers are used to enable them in SDL.
99         yum install -y \
100           libX11-devel \
101           libXcursor-devel \
102           libXext-devel \
103           libXfixes-devel \
104           libXi-devel \
105           libxkbcommon-devel \
106           libXrandr-devel \
107           libXScrnSaver-devel \
108           mesa-libEGL-devel \
109           mesa-libGL-devel \
110           mesa-libGLES-devel \
111           wayland-devel \
112           wayland-protocols-devel \
113           # EOF
114         echo "::endgroup::"
116         # We use vcpkg for our dependencies, to get more up-to-date version.
117         echo "::group::Install vcpkg and dependencies"
119         git clone https://github.com/microsoft/vcpkg /vcpkg
121         (
122           cd /vcpkg
123           ./bootstrap-vcpkg.sh -disableMetrics
124         )
126         echo "::group::Install breakpad dependencies"
127         cargo install --locked dump_syms
128         echo "::endgroup::"
130     - name: Install GCC problem matcher
131       uses: ammaraskar/gcc-problem-matcher@master
133     - name: Build
134       run: |
135         mkdir -p build
136         cd build
138         echo "::group::CMake"
139         cmake ${GITHUB_WORKSPACE} \
140           -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
141           -DCMAKE_BUILD_TYPE=RelWithDebInfo \
142           -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
143           -DOPTION_PACKAGE_DEPENDENCIES=ON \
144           # EOF
145         echo "::endgroup::"
147         echo "::group::Build"
148         echo "Running on $(nproc) cores"
149         cmake --build . -j $(nproc) --target openttd
150         echo "::endgroup::"
152     - name: Create breakpad symbols
153       run: |
154         cd build
155         dump_syms ./openttd --inlines --store symbols
157     - name: Create bundles
158       run: |
159         cd ${GITHUB_WORKSPACE}/build
160         echo "::group::Run CPack"
161         cpack
162         echo "::endgroup::"
164         echo "::group::Cleanup"
165         # Remove the sha256 files CPack generates; we will do this ourself at
166         # the end of this workflow.
167         rm -f bundles/*.sha256
168         echo "::endgroup::"
170     - name: Store bundles
171       uses: actions/upload-artifact@v4
172       with:
173         name: openttd-linux-generic
174         path: build/bundles
175         retention-days: 5
177     - name: Store symbols
178       uses: actions/upload-artifact@v4
179       with:
180         name: symbols-linux-generic
181         path: build/symbols
182         retention-days: 5