-
Notifications
You must be signed in to change notification settings - Fork 1.1k
169 lines (162 loc) · 7.33 KB
/
linux.yml
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Copyright (C) 2020-2021 Jacob Burroughs <[email protected]>
# 2020-2021 A. Semphris <[email protected]>
#
# Released under the Creative Commons Zero (CC0) license, available at:
# Legal code: https://creativecommons.org/publicdomain/zero/1.0/legalcode
# Information: https://creativecommons.org/share-your-work/public-domain/cc0/
# Note: Parts of this code were taken from the SuperTux project.
# ~ Semphris (responsible for transfering and adapting the file)
name: linux
on:
push:
branches:
- master
tags:
- '*'
pull_request: {}
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
compiler: [gcc, clang]
build_type: [Debug, Release]
server_only: [ON, OFF]
exclude:
- os: macos-latest
compiler: gcc
- os: macos-latest
build_type: Debug
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: true
- name: Configure packaging name for git master branch
if: ${{ matrix.build_type == 'Release' && matrix.server_only == 'OFF' &&
github.ref == 'refs/heads/master' }}
run: |
echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV
echo "release_name=preview" >> $GITHUB_ENV
- name: Configure packaging name for tag
if: ${{ matrix.build_type == 'Release' && matrix.server_only == 'OFF' &&
startsWith(github.ref, 'refs/tags/') }}
run: |
echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV
echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV
- name: Configure packaging name for non-releasing branch
if: ${{ matrix.build_type != 'Release' || matrix.server_only != 'OFF' ||
!(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) ||
github.repository_owner != 'supertuxkart' }}
run: |
echo "release_tag=" >> $GITHUB_ENV
echo "release_name=" >> $GITHUB_ENV
- name: Check for prerelease
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }}
run: |
echo "release_pre=true" >> $GITHUB_ENV
- name: Check for non-prerelease
if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }}
run: |
echo "release_pre=false" >> $GITHUB_ENV
- name: Show packaging name
run : |
echo "${{ env.release_tag }}"
echo "${{ env.release_name }}"
echo "${{ env.release_pre }}"
- name: Install linux dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt install -y build-essential cmake libbluetooth-dev libcurl4-gnutls-dev \
libfreetype6-dev libharfbuzz-dev libjpeg-dev libogg-dev libopenal-dev \
libpng-dev libsdl2-dev libvorbis-dev pkg-config zlib1g-dev clang
- name: Install dylibbundler for packaging osx binary
if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }}
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install dylibbundler
- name: Install macos dependencies
if: ${{ matrix.os == 'macos-latest' }}
run: |
# Something funky happens with freetype if mono is left
sudo mv /Library/Frameworks/Mono.framework /Library/Frameworks/Mono.framework-disabled
wget https://github.com/supertuxkart/dependencies/releases/download/preview/dependencies-mac.tar.xz
# Remove any existing installation to avoid conflict with bundled dependencies
rm -rf /usr/local/include/*
rm -rf /usr/local/opt/[email protected]/include
rm -rf /usr/local/opt/freetype
rm -rf /usr/local/opt/harfbuzz
tar xf dependencies-mac.tar.xz -C /usr/local
rm dependencies-mac.tar.xz
- name: Set compiler (gcc)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler == 'gcc' }}
run: |
echo "CXX=g++" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
- name: Set compiler (clang)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' }}
run: |
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
- name: Set compiler (macos)
if: ${{ matrix.os == 'macos-latest' }}
run: |
# This ensures for now we use clang11
# Clang12 runs into a bunch of fun with `include location '/usr/local/include' is unsafe for cross-compilation`
# that we don't care about for now
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
- name: Configure bulid (linux)
if: ${{ matrix.os != 'macos-latest' }}
env:
BUILD_TYPE: ${{ matrix.build_type }}
SERVER_ONLY: ${{ matrix.server_only }}
run: |
cmake --version
$CXX --version
mkdir "build"
cd "build"
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSERVER_ONLY=$SERVER_ONLY -DCHECK_ASSETS=off -DBUILD_RECORDER=off -DNO_SHADERC=on;
- name: Configure bulid (macos)
if: ${{ matrix.os == 'macos-latest' }}
env:
BUILD_TYPE: ${{ matrix.build_type }}
SERVER_ONLY: ${{ matrix.server_only }}
run: |
cmake --version
$CXX --version
mkdir "build"
cd "build"
CFLAGS="-mmacosx-version-min=10.9" CXXFLAGS="-mmacosx-version-min=10.9" LINKFLAGS="-mmacosx-version-min=10.9" LDFLAGS="-mmacosx-version-min=10.9" /usr/local/opt/cmake/bin/cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSERVER_ONLY=$SERVER_ONLY -DCHECK_ASSETS=off -DBUILD_RECORDER=off;
- name: Build and install
working-directory: build
run: |
make -j3 VERBOSE=1
make install DESTDIR="/tmp/stk" VERBOSE=1
- name: Packaging (macos)
if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }}
working-directory: build
run: |
/usr/local/opt/dylibbundler/bin/dylibbundler -od -b -x ./bin/SuperTuxKart.app/Contents/MacOS/supertuxkart -d ./bin/SuperTuxKart.app/Contents/libs/ -p @executable_path/../libs/
wget https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip
unzip stk-assets-full.zip -d ../data
rm stk-assets-full.zip
cd bin
# Fix the name on case insensitive filesystem
mv supertuxkart.app stk.app
mv stk.app SuperTuxKart.app
zip -r ../SuperTuxKart-${{ env.release_tag }}-mac.zip .
- name: Create Release (macos)
if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }}
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "build/SuperTuxKart-${{ env.release_tag }}-mac.zip"
tag: ${{ env.release_name }}
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
allowUpdates: true
prerelease: ${{ env.release_pre }}