-
-
Notifications
You must be signed in to change notification settings - Fork 492
160 lines (144 loc) · 5.77 KB
/
macos.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
# SuperTux
# Copyright (C) 2020-2021 Jacob Burroughs <[email protected]>
# 2020-2022 A. Semphris <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
name: MacOS
on:
workflow_dispatch:
push:
branches:
- master
tags:
- '*'
pull_request: {}
jobs:
macos:
strategy:
fail-fast: false
matrix:
os: [macos-12]
build_type: [Debug, RelWithDebInfo]
glbinding: [ON, OFF]
include:
- os: macos-12
build_type: RelWithDebInfo
glbinding: OFF
release: ON
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# Fetch the whole tree so git describe works
fetch-depth: 0
submodules: recursive
- name: Install macos dependencies
if: ${{ matrix.os == 'macos-12' }}
run: |
# Use GLM 1.0.0 as later versions don't build with clang
HOMEBREW_NO_AUTO_UPDATE=1 brew install --formula ./mk/brew/glm.rb --build-from-source
brew install cmake googletest bash rename libogg libvorbis glew \
openal-soft sdl2 sdl2_image sdl2_ttf freetype harfbuzz \
fribidi glib gtk-doc glbinding@2 libraqm zlib
brew link glbinding@2
install_name_tool -change \
'@rpath/libsharpyuv.0.dylib' \
/usr/local/opt/webp/lib/libsharpyuv.0.dylib \
/usr/local/opt/webp/lib/libwebp.7.dylib
install_name_tool -change \
'@rpath/libjxl_cms.0.10.dylib' \
/usr/local/opt/jpeg-xl/lib/libjxl_cms.0.10.dylib \
/usr/local/opt/jpeg-xl/lib/libjxl.dylib
# Something funky happens with freetype if mono is left
sudo mv /Library/Frameworks/Mono.framework \
/Library/Frameworks/Mono.framework-disabled
- name: Set compiler
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 build
env:
BUILD_TYPE: ${{ matrix.build_type }}
GLBINDING: ${{ matrix.glbinding }}
run: |
cmake --version
$CXX --version
mkdir "build"
cd "build"
# TODO add -DGLBINDING_ENABLED=$USE_GLBINDING
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE $ARCH -DBUILD_TESTS=ON \
-DWARNINGS=ON -DWERROR=ON -DGLBINDING_ENABLED=$GLBINDING \
-DENABLE_DISCORD=ON -DCMAKE_INSTALL_MESSAGE=NEVER \
-DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_SUBDIR_BIN=bin \
-DINSTALL_SUBDIR_SHARE=share/supertux2
- name: Build and install
working-directory: build
run: |
make -j3 VERBOSE=1
make install DESTDIR="/tmp/supertux" VERBOSE=1
- name: Run tests
working-directory: build
run: ./test_supertux2
- name: Package
env:
OS_NAME: ${{ matrix.os }}
ARCH: 64
COMPILER_NAME: ${{ matrix.compiler }}
BUILD_NAME: ${{ matrix.build_type }}
PACKAGE: 'ON'
working-directory: build
run: ../.ci_scripts/package.sh
- uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-dmg"
path: build/upload/*.dmg
if-no-files-found: ignore
- uses: anshulrgoyal/upload-s3-action@master
if: matrix.release && env.CI_KEY != null
env:
CI_KEY: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
with:
aws_bucket: supertux-ci-downloads
aws_key_id: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.CI_DOWNLOAD_SECRET_ACCESS_KEY }}
source_dir: 'build/upload'
destination_dir: "${{ github.sha }}/gh-actions/${{ matrix.os }}-${{ matrix.arch }}/${{ github.run_id }}"
- name: Post uploaded file
if: matrix.release && env.DOWNLOAD_APIKEY != null
working-directory: build
run: ../.ci_scripts/deploy.sh
env:
PREFIX: "${{ github.sha }}/gh-actions/${{ matrix.os }}-${{ matrix.arch }}/${{ github.run_id }}"
DOWNLOAD_APIKEY: ${{ secrets.DOWNLOAD_APIKEY }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
- name: Prepare Release
if: startsWith(github.ref, 'refs/tags/') && matrix.release && github.repository_owner == 'supertux'
env:
OS: ${{ matrix.os }}
run: |
if [ "$OS" = "macos-12" ]; then
rename 's/.dmg/-12.dmg/' build/upload/SuperTux-*
fi
- name: Create Release
if: startsWith(github.ref, 'refs/tags/') && matrix.release && github.repository_owner == 'supertux'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: 'build/upload/SuperTux-*'
draft: true