-
Notifications
You must be signed in to change notification settings - Fork 282
328 lines (289 loc) · 11.2 KB
/
main.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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
name: CI
run-name: >-
${{
join(fromJSON(format('["{0}", "{1}", "{2}"]',
((inputs.tools_make_branch != '' && inputs.tools_make_branch != 'master') || inputs.tools_windows_msvc_branch != '') && github.workflow || '',
(inputs.tools_make_branch != '' && inputs.tools_make_branch != 'master') && format('tools-make: {0}', inputs.tools_make_branch) || '',
inputs.tools_windows_msvc_branch != '' && format('tools-windows-msvc: {0}', inputs.tools_windows_msvc_branch) || ''
)), ' ')
}}
on:
push:
pull_request:
workflow_dispatch:
inputs:
tools_make_branch:
description: "tools-make branch"
default: "master"
required: true
tools_windows_msvc_branch:
description: "tools-windows-msvc branch (leave empty to use latest pre-built release)"
required: false
env:
APT_PACKAGES: >-
pkg-config
libgnutls28-dev
libffi-dev
libicu-dev
libxml2-dev
libxslt1-dev
libssl-dev
libavahi-client-dev
zlib1g-dev
gnutls-bin
libcurl4-gnutls-dev
# packages for GCC Objective-C runtime
APT_PACKAGES_gcc: >-
libobjc-10-dev
libblocksruntime-dev
gobjc
# packages for libobjc2 / libdispatch
APT_PACKAGES_clang: >-
libpthread-workqueue-dev
# GNUstep Windows MSVC toolchain release tag to be used (keep up to date with latest release):
# https://github.com/gnustep/tools-windows-msvc/releases
TOOLS_WINDOWS_MSVC_RELEASE_TAG: release-20230104
jobs:
########### Linux ###########
linux:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
# don't run pull requests from local branches twice
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu x64 GCC
library-combo: gnu-gnu-gnu
CC: gcc
CXX: g++
- name: Ubuntu x64 Clang gnustep-1.9
library-combo: ng-gnu-gnu
runtime-version: gnustep-1.9
CC: clang
CXX: clang++
- name: Ubuntu x64 Clang gnustep-2.0
library-combo: ng-gnu-gnu
runtime-version: gnustep-2.0
CC: clang
CXX: clang++
env:
SRC_PATH: ${{ github.workspace }}/source
DEPS_PATH: ${{ github.workspace }}/dependencies
INSTALL_PATH: ${{ github.workspace }}/build
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
LIBRARY_COMBO: ${{ matrix.library-combo }}
RUNTIME_VERSION: ${{ matrix.runtime-version }}
defaults:
run:
working-directory: ${{ env.SRC_PATH }}
steps:
- uses: actions/checkout@v3
with:
path: ${{ env.SRC_PATH }}
- name: Install packages
run: |
sudo apt-get -q -y update
sudo apt-get -q -y install $APT_PACKAGES $APT_PACKAGES_${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }}
# gnustep-2.0 runtime requires ld.gold or lld
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ]; then
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10
fi
- name: Install dependencies
env:
TOOLS_MAKE_BRANCH: ${{github.event.inputs.tools_make_branch}}
run: ./.github/scripts/dependencies.sh
- name: Build source
run: |
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
./configure
make && make install
- name: Run tests
run: |
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
make check
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: Logs - ${{ matrix.name }}
path: |
${{ env.SRC_PATH }}/config.log
${{ env.SRC_PATH }}/Tests/tests.log
########### Windows ###########
windows:
name: ${{ matrix.name }}
runs-on: windows-2019
# don't run pull requests from local branches twice
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
include:
- name: Windows x86 MinGW GCC
allow-test-failures: true
arch: i686
msystem: MINGW32
library-combo: gnu-gnu-gnu
CC: gcc
CXX: g++
- name: Windows x64 MinGW GCC
arch: x86_64
msystem: MINGW64
library-combo: gnu-gnu-gnu
CC: gcc
CXX: g++
- name: Windows x86 MSVC Clang gnustep-2.0
allow-test-failures: true
arch: x86
host: i686-pc-windows
library-combo: ng-gnu-gnu
runtime-version: gnustep-2.0
configure-opts: --disable-tls
CC: clang -m32
CXX: clang++ -m32
LDFLAGS: -fuse-ld=lld
- name: Windows x64 MSVC Clang gnustep-2.0
arch: x64
host: x86_64-pc-windows
library-combo: ng-gnu-gnu
runtime-version: gnustep-2.0
configure-opts: --disable-tls
CC: clang -m64
CXX: clang++ -m64
LDFLAGS: -fuse-ld=lld
env:
SRC_PATH: ${{ github.workspace }}\source
DEPS_PATH: ${{ github.workspace }}\dependencies
INSTALL_PATH: ${{ github.workspace }}\build
IS_WINDOWS_MINGW: ${{ startsWith(matrix.msystem, 'MINGW') }}
IS_WINDOWS_MSVC: ${{ endsWith(matrix.host, '-pc-windows') }}
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
LDFLAGS: ${{ matrix.LDFLAGS }}
HOST: ${{ matrix.host }}
ARCH: ${{ matrix.arch }}
LIBRARY_COMBO: ${{ matrix.library-combo }}
RUNTIME_VERSION: ${{ matrix.runtime-version }}
CONFIGURE_OPTS: ${{ matrix.configure-opts }}
# MSYS2: disable conversion to native-form paths when configuring GNUstep Make
# https://www.msys2.org/wiki/Porting/#filesystem-namespaces
MSYS2_ARG_CONV_EXCL: --prefix=
# provide GitHub token to scripts to prevent rate limit errors when accessing GitHub
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
shell: msys2 {0}
working-directory: ${{ env.SRC_PATH }}
steps:
- uses: actions/checkout@v3
with:
path: ${{ env.SRC_PATH }}
- name: Set up MSYS2 (MinGW)
uses: msys2/setup-msys2@v2
if: env.IS_WINDOWS_MINGW == 'true'
with:
msystem: ${{ matrix.msystem }}
install: >
git
make
pkg-config
libxml2-devel
libxslt-devel
libffi-devel
libgnutls-devel
icu-devel
mingw-w64-${{matrix.arch}}-gcc-objc
mingw-w64-${{matrix.arch}}-pkg-config
mingw-w64-${{matrix.arch}}-libxml2
mingw-w64-${{matrix.arch}}-libxslt
mingw-w64-${{matrix.arch}}-libffi
mingw-w64-${{matrix.arch}}-gnutls
mingw-w64-${{matrix.arch}}-icu
- name: Set up MSYS2 (MSVC)
uses: msys2/setup-msys2@v2
if: env.IS_WINDOWS_MSVC == 'true'
with:
msystem: MSYS
install: make autoconf automake libtool pkg-config
# make Windows packages like Clang available in MSYS
path-type: inherit
- name: Remove Perl Strawberry installation and MinGW gmake (MSVC)
if: env.IS_WINDOWS_MSVC == 'true'
# C:\Strawberry contains various MinGW libraries and binaries like pkg-config
# that can get picked up by configure/CMake and don't necessarily behave
# correctly when not using a MinGW environment, and more specifically we cannot
# use MinGW gmake but must use MSYS make for correctly handling of Windows paths,
# so we delete everything that could mess up our builds
run: rmdir /S /Q C:\Strawberry
shell: cmd
- name: Install Windows packages (MSVC)
if: env.IS_WINDOWS_MSVC == 'true'
shell: cmd
run: choco install ninja
- name: Set up VS Developer Command Prompt (MSVC)
if: env.IS_WINDOWS_MSVC == 'true'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build dependencies (MSVC)
if: env.IS_WINDOWS_MSVC == 'true' && github.event.inputs.tools_windows_msvc_branch
shell: cmd
run: |
mkdir %DEPS_PATH% & cd %DEPS_PATH%
git clone -q -b ${{github.event.inputs.tools_windows_msvc_branch}} https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
cd tools-windows-msvc
:: use msys2.cmd from setup-msys2 as Bash shell, as it doesn't have msys2_shell.cmd used normally by build.bat
set "BASH=msys2 -c"
build.bat --prefix=%INSTALL_PATH% --type Release --only-dependencies
- name: Install pre-built dependencies (MSVC)
if: env.IS_WINDOWS_MSVC == 'true' && !github.event.inputs.tools_windows_msvc_branch
shell: cmd
run: |
mkdir %INSTALL_PATH% & cd %INSTALL_PATH%
echo Downloading pre-built release...
curl --silent --show-error --fail-with-body --header "Authorization: Bearer $GITHUB_TOKEN" --location -o GNUstep-Windows-MSVC.zip ^
https://github.com/gnustep/tools-windows-msvc/releases/download/${{env.TOOLS_WINDOWS_MSVC_RELEASE_TAG}}/GNUstep-Windows-MSVC-${{matrix.arch}}.zip || exit /b 1
echo Extracting pre-built release... (dependencies only excluding debug build and GNUstep components)
tar -xvf GNUstep-Windows-MSVC.zip --strip 1 --exclude Debug --exclude "**/gnustep*" --exclude "**/GNUstep*" --exclude Foundation --exclude CoreFoundation || exit /b 1
del /Q GNUstep-Windows-MSVC.zip
- name: Set environment variables
run: |
# MSVC: update install path to include [x86|x64]/Release subdir used by build.bat above
if [ "$IS_WINDOWS_MSVC" = "true" ]; then
INSTALL_PATH=$INSTALL_PATH\\$ARCH\\Release
fi
# convert Windows paths to Unix paths for MSYS2 shell
echo "INSTALL_PATH=`cygpath -u $INSTALL_PATH`" >> $GITHUB_ENV
echo "DEPS_PATH=`cygpath -u $DEPS_PATH`" >> $GITHUB_ENV
- name: Install dependencies
env:
TOOLS_MAKE_BRANCH: ${{github.event.inputs.tools_make_branch}}
run: ./.github/scripts/dependencies.sh
- name: Build source
run: |
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
if [ -n "$HOST" ]; then
CONFIGURE_OPTS="$CONFIGURE_OPTS --host=$HOST"
fi
./configure $CONFIGURE_OPTS
make && make install
- name: Run tests
continue-on-error: ${{ matrix.allow-test-failures || false }}
run: |
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
# MSVC: build tests for release to match CRT of DLLs
if [ "$IS_WINDOWS_MSVC" = "true" ]; then
sed -i -e 's/debug=yes//g' `which gnustep-tests`
fi
make check
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: Logs - ${{ matrix.name }}
path: |
${{ env.SRC_PATH }}/config.log
${{ env.SRC_PATH }}/Tests/tests.log