2021-01-27 10:59:19 -05:00
|
|
|
# Copyright (C) 2020-2021 Jacob Burroughs <maths22@gmail.com>
|
|
|
|
# 2020-2021 A. Semphris <semphris@protonmail.com>
|
|
|
|
#
|
|
|
|
# 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)
|
|
|
|
|
2021-05-24 21:30:14 -04:00
|
|
|
name: linux
|
2021-01-27 10:59:19 -05:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
pull_request: {}
|
2021-01-28 12:38:37 -05:00
|
|
|
workflow_dispatch:
|
2021-01-27 10:59:19 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
2021-05-19 23:48:47 -04:00
|
|
|
os: [ubuntu-latest]
|
2021-01-27 10:59:19 -05:00
|
|
|
compiler: [gcc, clang]
|
|
|
|
build_type: [Debug, Release]
|
|
|
|
server_only: [ON, OFF]
|
|
|
|
exclude:
|
|
|
|
- os: macos-latest
|
|
|
|
compiler: gcc
|
2021-03-24 20:55:10 -04:00
|
|
|
- os: macos-latest
|
|
|
|
build_type: Debug
|
2021-01-27 10:59:19 -05:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
2021-03-24 20:55:10 -04:00
|
|
|
fetch-depth: 1
|
2021-01-27 10:59:19 -05:00
|
|
|
submodules: true
|
2021-03-24 20:55:10 -04:00
|
|
|
- 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 }}"
|
2021-01-27 10:59:19 -05:00
|
|
|
- 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 \
|
2021-02-21 00:40:06 -05:00
|
|
|
libpng-dev libsdl2-dev libvorbis-dev pkg-config zlib1g-dev clang
|
2021-03-24 20:55:10 -04:00
|
|
|
- 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
|
2021-01-27 10:59:19 -05:00
|
|
|
- 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
|
2021-04-29 00:24:22 -04:00
|
|
|
wget https://github.com/supertuxkart/dependencies/releases/download/preview/dependencies-mac.tar.xz
|
2021-03-24 20:55:10 -04:00
|
|
|
# Remove any existing installation to avoid conflict with bundled dependencies
|
|
|
|
rm -rf /usr/local/include/*
|
|
|
|
rm -rf /usr/local/opt/openssl@1.1/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
|
2021-01-27 10:59:19 -05:00
|
|
|
- name: Set compiler (gcc)
|
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler == 'gcc' }}
|
|
|
|
run: |
|
2021-02-21 00:40:06 -05:00
|
|
|
echo "CXX=g++" >> $GITHUB_ENV
|
|
|
|
echo "CC=gcc" >> $GITHUB_ENV
|
2021-01-27 10:59:19 -05:00
|
|
|
- name: Set compiler (clang)
|
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' }}
|
|
|
|
run: |
|
2021-02-21 00:40:06 -05:00
|
|
|
echo "CXX=clang++" >> $GITHUB_ENV
|
|
|
|
echo "CC=clang" >> $GITHUB_ENV
|
2021-01-27 10:59:19 -05:00
|
|
|
- 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;
|
|
|
|
- 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"
|
2021-03-24 20:55:10 -04:00
|
|
|
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;
|
2021-01-27 10:59:19 -05:00
|
|
|
- name: Build and install
|
|
|
|
working-directory: build
|
|
|
|
run: |
|
|
|
|
make -j3 VERBOSE=1
|
2021-03-24 20:55:10 -04:00
|
|
|
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 }}
|