This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
227 lines (205 loc) · 7.33 KB
/
cmake.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Build all
on:
workflow_dispatch:
push:
branches:
- master
env:
CONAN_REVISIONS_ENABLED: 1
CONAN_SCM_TO_CONANDATA: 1
CONAN_SYSREQUIRES_MODE: enabled
CONAN_PASSWORD: ${{ secrets.CONAN_PASSWORD }}
CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }}
RSYNC_PASSWORD: ${{ secrets.RSYNC_PASSWORD }}
PROFILE_CONAN: conan-release
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
jobs:
build_unix:
name: Build on *NIX
runs-on: ${{ matrix.os }}
strategy:
matrix:
#Enable building on macOS when it can be fixed. Currently we're getting SDL linking errors.
# os: [ ubuntu-20.04, ubuntu-22.04, macos-12, macos-11 ]
os: [ ubuntu-20.04, ubuntu-22.04 ]
steps:
- uses: actions/[email protected]
- name: Cache media
uses: actions/[email protected]
with:
path: |
${{github.workspace}}/build/Release/media-0.8.0
key: dev-media
- name: Setup environment
shell: bash
run: |
if [[ "$ImageOS" == "ubuntu20" ]]; then
echo "BUILD_SNAP=true" >> $GITHUB_ENV
fi
if [[ "$ImageOS" == "ubuntu20" ]]; then
echo "BUILD_APPIMAGE=true" >> $GITHUB_ENV
fi
- name: Install autotools
shell: bash
if: runner.os == 'macOS'
run: |
brew install autoconf automake
- name: Install Snapcraft
if: env.BUILD_SNAP == 'true'
uses: samuelmeuli/action-snapcraft@v2
with:
snapcraft_token: ${{ secrets.SNAPCRAFT_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install Conan
shell: bash
run: |
pip install -r .github/workflows/requirements.txt
conan profile detect
#Set the default profile to use g++ 17 it it's not detected
sed -i.backup 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' ~/.conan2/profiles/default
conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan
- name: Have Conan install packages
shell: bash
run: |
export PATH=~/.local/bin:$PATH
conan install . -pr default --build=missing --update -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=True
if [[ x"$CONAN_PASSWORD" != "x" && x"$CONAN_LOGIN_USERNAME" != "x" ]]; then
conan remote login worldforge $CONAN_LOGIN_USERNAME -p $CONAN_PASSWORD
conan upload "*" -r worldforge -c
fi
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
run: |
mkdir -p ~/install/usr
cmake --preset $PROFILE_CONAN . -DCMAKE_INSTALL_PREFIX=~/install/usr
- name: Build
shell: bash
run: cmake --build --preset $PROFILE_CONAN
- name: Test
shell: bash
run: cmake --build --preset $PROFILE_CONAN --target check
- name: Install
shell: bash
run: cmake --build --preset $PROFILE_CONAN --target install
- name: Build Snap
if: env.BUILD_SNAP == 'true'
shell: bash
run: |
echo "Building Snap"
cd ~/install/usr
cp -a ${{github.workspace}}/build/Release/snap ~/install/usr/
snapcraft --destructive-mode
echo "Uploading Snap"
snapcraft upload ~/install/usr/*.snap --release edge
- name: Store Snap
if: env.BUILD_SNAP == 'true'
uses: actions/[email protected]
with:
name: snap
path: ~/install/usr/*.snap
- name: Build AppImage
if: env.BUILD_APPIMAGE == 'true'
working-directory: ${{github.workspace}}/build/Release
run: |
echo "Building AppImage"
ln -s ~/install/usr/share/icons/hicolor/64x64/apps/ember.png ~/install/
ln -s ~/install/usr/share/applications/org.worldforge.ember.desktop ~/install/
ln -s ~/install/usr/share/icons/hicolor/64x64/apps/ember.png ~/install/.DirIcon
curl -L https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-x86_64 > ~/install/AppRun
chmod a+x ~/install/AppRun
curl -L https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage > appimagetool-x86_64.AppImage
chmod a+x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage -n ~/install
- name: Store AppImage
if: env.BUILD_APPIMAGE == 'true'
uses: actions/[email protected]
with:
name: AppImage
path: ${{github.workspace}}/build/Release/Ember-x86_64.AppImage
- name: Upload AppImage to amber
if: env.BUILD_APPIMAGE == 'true'
working-directory: ${{github.workspace}}/build/Release
run: rsync -uzcP --no-p ${{github.workspace}}/build/Release/Ember-x86_64.AppImage ${{ secrets.RSYNC_USER }}@amber.worldforge.org::ember-unstable/
# build_windows:
# name: Build on Windows
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ windows-2022 ]
#
# steps:
# - uses: actions/[email protected]
#
# - name: Cache media
# uses: actions/[email protected]
# with:
# path: |
# ${{github.workspace}}/build_ci/media-0.8.0
# key: dev-media
#
# - uses: actions/setup-python@v4
# with:
# python-version: '3.9'
# cache: 'pip'
#
# - name: Install Conan
# shell: bash
# run: |
# pip install -r .github/workflows/requirements.txt
# conan --version
# conan profile detect
# conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan
#
# - name: Set up Cygwin
# uses: egor-tensin/[email protected]
# with:
# packages: rsync
#
# - name: Have Conan install packages
# shell: cmd
# run: |
# conan install . -pr default --build=missing --update
# conan remote login worldforge $CONAN_LOGIN_USERNAME -p $CONAN_PASSWORD
# conan upload "*" -r worldforge -c
#
# - name: Configure CMake
# shell: cmd
# run: |
# cmake --preset $PROFILE_CONAN -DCMAKE_INSTALL_PREFIX=%USERPROFILE%\install -DVERSION_PACKAGE=latest-DWF_USE_WIDGET_PLUGINS=OFF
#
# - name: Download media
# shell: cmd
# run: cmake --build --preset $PROFILE_CONAN --target media-download
#
# - name: Build
# shell: cmd
# run: cmake --build --preset $PROFILE_CONAN --parallel -- /m
#
# - name: Test
# shell: cmd
# run: ctest --preset $PROFILE_CONAN --output-on-failure
#
# - name: Install
# shell: cmd
# run: cmake --preset $PROFILE_CONAN --target install
#
# - name: Build NSIS
# working-directory: ${{github.workspace}}/build_ci
# shell: cmd
# run: makensis Ember.nsi
#
# - name: Store NSIS
# uses: actions/[email protected]
# with:
# name: NSIS
# path: ${{github.workspace}}/build_ci/*.exe
#
# - name: Upload exe to amber
# working-directory: ${{github.workspace}}/build_ci
# shell: cmd
# run: rsync -uzcP --no-p *.exe ${{ secrets.RSYNC_USER }}@amber.worldforge.org::ember-unstable/