File: ci-linux.yml

package info (click to toggle)
openttd 15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 57,232 kB
  • sloc: cpp: 292,178; ansic: 18,478; awk: 226; javascript: 86; makefile: 43; sh: 29; python: 29; xml: 27
file content (117 lines) | stat: -rw-r--r-- 2,831 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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-24.04
    env:
      CC: ${{ inputs.compiler }}
      CXX: ${{ inputs.cxxcompiler }}

    steps:
    - name: Checkout
      uses: actions/checkout@v6

    - name: Setup vcpkg
      id: vcpkg
      uses: OpenTTD/actions/setup-vcpkg@v6

    - 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 \
          liblzo2-dev \
          libogg-dev \
          libopus-dev \
          libopusfile-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.
        ${{ steps.vcpkg.outputs.vcpkg }} install breakpad

        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"
        cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ inputs.extra-cmake-parameters }}
        echo "::endgroup::"

        echo "::group::Build"
        echo "Running on $(nproc) cores"
        cmake --build . -j $(nproc)
        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