summaryrefslogtreecommitdiff
path: root/.github/workflows/ci-build.yml
blob: 8ab2783e9ecc6bb13f7dc841f89994fc82334d78 (plain)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: CI

on:
  pull_request:
  push:
    branches:
    - master

jobs:
  linux:
    name: Linux

    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        compiler: [clang, gcc]
        include:
          - compiler: clang
            cxxcompiler: clang++
          - compiler: gcc
            cxxcompiler: g++
    env:
      CTEST_OUTPUT_ON_FAILURE: 1
      CC: ${{ matrix.compiler }}
      CXX: ${{ matrix.cxxcompiler }}

    steps:
    - name: Install dependencies
      run: |
        sudo apt-get install -y --no-install-recommends \
          libfontconfig-dev \
          libicu-dev \
          liblzma-dev \
          liblzo2-dev \
          libsdl1.2-dev \
          libsdl2-dev \
          libxdg-basedir-dev \
          zlib1g-dev \
          # EOF

    - name: Checkout
      uses: actions/checkout@v2

    - name: Get OpenGFX
      run: |
        mkdir -p ~/.local/share/openttd/baseset
        cd ~/.local/share/openttd/baseset
        curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
        unzip opengfx-all.zip
        rm -f opengfx-all.zip

    - name: CMake
      run: mkdir build && cd build && cmake ..

    - name: Build
      run: cd build && make -j2

    - name: Test
      run: cd build && make -j2 test

  windows:
    name: Windows

    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        arch: [x86, x64]

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

    - name: Prepare vcpkg (with cache)
      uses: lukka/run-vcpkg@v4
      with:
        vcpkgDirectory: 'c:/vcpkg'
        doNotUpdateVcpkg: true
        vcpkgArguments: 'liblzma libpng lzo zlib'
        vcpkgTriplet: '${{ matrix.arch }}-windows-static'

    - name: 'Build'
      uses: lukka/run-cmake@v3
      with:
        cmakeListsOrSettingsJson: CMakeListsTxtBasic
        useVcpkgToolchainFile: true
        buildDirectory: '${{ runner.workspace }}/build'

    - name: Install OpenGFX
      run: |
        mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
        cd "C:/Users/Public/Documents/OpenTTD/baseset"
        curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
        unzip opengfx-all.zip
        rm -f opengfx-all.zip
      shell: bash

    - name: Test
      run: |
        cd ${{ runner.workspace }}/build
        ctest -C Debug

  macos:
    name: Mac OS

    runs-on: macos-latest
    strategy:
      fail-fast: false
    env:
      CTEST_OUTPUT_ON_FAILURE: 1
      MACOSX_DEPLOYMENT_TARGET: 10.9

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

    - name: Install dependencies
      run: brew install pkg-config lzo xz libpng freetype
      env:
        HOMEBREW_NO_AUTO_UPDATE: 1

    - name: Install OpenGFX
      run: |
        mkdir -p ~/Documents/OpenTTD/baseset
        cd ~/Documents//OpenTTD/baseset
        curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
        unzip opengfx-all.zip
        rm -f opengfx-all.zip

    - name: CMake
      run: mkdir build && cd build && cmake ..

    - name: Build
      run: cd build && make -j2

    - name: Test
      run: cd build && make -j2 test