Skip to content

Commit 6072a1d

Browse files
committed
CI: various improvements
- update GitHub actions (fixes Node.js 12 deprecation warnings) - separate Linux and Windows jobs - add option to specify tools-make branch for manual run - Windows MSVC: use dependencies from pre-built release (with option to build dependencies via manual run) - Windows MSVC: set GitHub token when building dependencies to prevent GitHub rate limit errors - remove installation of libkqueue-dev package (not used by libdispatch) - update dependencies from libobjc-9-dev to libobjc-10-dev - add -q flag to git clone to prevent progress logs from spamming logs
1 parent 7f84bd9 commit 6072a1d

File tree

2 files changed

+144
-63
lines changed

2 files changed

+144
-63
lines changed

.github/scripts/dependencies.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -ex
55
install_gnustep_make() {
66
echo "::group::GNUstep Make"
77
cd $DEPS_PATH
8-
git clone https://github.com/gnustep/tools-make.git
8+
git clone -q -b ${INPUT_TOOLS_MAKE_BRANCH:-master} https://github.com/gnustep/tools-make.git
99
cd tools-make
1010
MAKE_OPTS=
1111
if [ -n "$HOST" ]; then
@@ -14,7 +14,7 @@ install_gnustep_make() {
1414
if [ -n "$RUNTIME_VERSION" ]; then
1515
MAKE_OPTS="$MAKE_OPTS --with-runtime-abi=$RUNTIME_VERSION"
1616
fi
17-
./configure --prefix=$INSTALL_PATH --with-library-combo=$LIBRARY_COMBO $MAKE_OPTS
17+
./configure --prefix=$INSTALL_PATH --with-library-combo=$LIBRARY_COMBO $MAKE_OPTS || cat config.log
1818
make install
1919

2020
echo Objective-C build flags:
@@ -25,7 +25,7 @@ install_gnustep_make() {
2525
install_libobjc2() {
2626
echo "::group::libobjc2"
2727
cd $DEPS_PATH
28-
git clone https://github.com/gnustep/libobjc2.git
28+
git clone -q https://github.com/gnustep/libobjc2.git
2929
cd libobjc2
3030
git submodule sync
3131
git submodule update --init
@@ -45,7 +45,7 @@ install_libdispatch() {
4545
echo "::group::libdispatch"
4646
cd $DEPS_PATH
4747
# will reference upstream after https://github.com/apple/swift-corelibs-libdispatch/pull/534 is merged
48-
git clone -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git libdispatch
48+
git clone -q -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git libdispatch
4949
mkdir libdispatch/build
5050
cd libdispatch/build
5151
# -Wno-error=void-pointer-to-int-cast to work around build error in queue.c due to -Werror

.github/workflows/main.yml

Lines changed: 140 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,151 @@
11
name: CI
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
tools_make_branch:
9+
description: "tools-make branch"
10+
default: "master"
11+
required: true
12+
tools_windows_msvc_branch:
13+
description: "tools-windows-msvc branch (leave empty to use latest pre-built release)"
14+
required: false
15+
16+
env:
17+
APT_PACKAGES: >-
18+
pkg-config
19+
libgnutls28-dev
20+
libffi-dev
21+
libicu-dev
22+
libxml2-dev
23+
libxslt1-dev
24+
libssl-dev
25+
libavahi-client-dev
26+
zlib1g-dev
27+
gnutls-bin
28+
libcurl4-gnutls-dev
29+
30+
# packages for GCC Objective-C runtime
31+
APT_PACKAGES_gcc: >-
32+
libobjc-10-dev
33+
libblocksruntime-dev
34+
gobjc
35+
36+
# packages for libobjc2 / libdispatch
37+
APT_PACKAGES_clang: >-
38+
libpthread-workqueue-dev
439
540
jobs:
6-
ci:
41+
########### Linux ###########
42+
linux:
743
name: ${{ matrix.name }}
8-
runs-on: ${{ matrix.os }}
44+
runs-on: ubuntu-latest
945
# don't run pull requests from local branches twice
1046
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
1147

1248
strategy:
1349
fail-fast: false
1450
matrix:
1551
include:
16-
- name: Ubuntu GCC
17-
os: ubuntu-latest
52+
- name: Ubuntu x64 GCC
1853
library-combo: gnu-gnu-gnu
1954
CC: gcc
2055
CXX: g++
2156

22-
- name: Ubuntu Clang gnustep-1.9
23-
os: ubuntu-latest
57+
- name: Ubuntu x64 Clang gnustep-1.9
2458
library-combo: ng-gnu-gnu
2559
runtime-version: gnustep-1.9
2660
CC: clang
2761
CXX: clang++
2862

29-
- name: Ubuntu Clang gnustep-2.0
30-
os: ubuntu-latest
63+
- name: Ubuntu x64 Clang gnustep-2.0
3164
library-combo: ng-gnu-gnu
3265
runtime-version: gnustep-2.0
3366
CC: clang
3467
CXX: clang++
3568

36-
- name: Windows MinGW GCC i686
69+
env:
70+
SRC_PATH: ${{ github.workspace }}/source
71+
DEPS_PATH: ${{ github.workspace }}/dependencies
72+
INSTALL_PATH: ${{ github.workspace }}/build
73+
CC: ${{ matrix.CC }}
74+
CXX: ${{ matrix.CXX }}
75+
LIBRARY_COMBO: ${{ matrix.library-combo }}
76+
RUNTIME_VERSION: ${{ matrix.runtime-version }}
77+
78+
defaults:
79+
run:
80+
working-directory: ${{ env.SRC_PATH }}
81+
82+
steps:
83+
- uses: actions/checkout@v3
84+
with:
85+
path: ${{ env.SRC_PATH }}
86+
87+
- name: Install packages
88+
run: |
89+
sudo apt-get -q -y update
90+
sudo apt-get -q -y install $APT_PACKAGES $APT_PACKAGES_${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }}
91+
92+
# gnustep-2.0 runtime requires ld.gold or lld
93+
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ]; then
94+
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10
95+
fi
96+
97+
- name: Install dependencies
98+
run: ./.github/scripts/dependencies.sh
99+
100+
- name: Build source
101+
run: |
102+
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
103+
./configure
104+
make && make install
105+
106+
- name: Run tests
107+
run: |
108+
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
109+
make check
110+
111+
- name: Upload logs
112+
uses: actions/upload-artifact@v3
113+
if: always()
114+
with:
115+
name: Logs - ${{ matrix.name }}
116+
path: |
117+
${{ env.SRC_PATH }}/config.log
118+
${{ env.SRC_PATH }}/Tests/tests.log
119+
120+
121+
########### Windows ###########
122+
windows:
123+
name: ${{ matrix.name }}
124+
runs-on: windows-2019
125+
# don't run pull requests from local branches twice
126+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
127+
128+
strategy:
129+
fail-fast: false
130+
matrix:
131+
include:
132+
- name: Windows x86 MinGW GCC
37133
allow-test-failures: true
38-
os: windows-2019
39134
arch: i686
40135
msystem: MINGW32
41136
library-combo: gnu-gnu-gnu
42137
CC: gcc
43138
CXX: g++
44139

45-
- name: Windows MinGW GCC x86_64
46-
os: windows-2019
140+
- name: Windows x64 MinGW GCC
47141
arch: x86_64
48142
msystem: MINGW64
49143
library-combo: gnu-gnu-gnu
50144
CC: gcc
51145
CXX: g++
52146

53-
- name: Windows MSVC Clang gnustep-2.0 i686
147+
- name: Windows x86 MSVC Clang gnustep-2.0
54148
allow-test-failures: true
55-
os: windows-2019
56149
arch: x86
57150
host: i686-pc-windows
58151
library-combo: ng-gnu-gnu
@@ -62,8 +155,7 @@ jobs:
62155
CXX: clang++ -m32
63156
LDFLAGS: -fuse-ld=lld
64157

65-
- name: Windows MSVC Clang gnustep-2.0 x86_64
66-
os: windows-2019
158+
- name: Windows x64 MSVC Clang gnustep-2.0
67159
arch: x64
68160
host: x86_64-pc-windows
69161
library-combo: ng-gnu-gnu
@@ -74,11 +166,11 @@ jobs:
74166
LDFLAGS: -fuse-ld=lld
75167

76168
env:
77-
SRC_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}source
78-
DEPS_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}dependencies
79-
INSTALL_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}build
80-
IS_WINDOWS_MINGW: ${{ startsWith(matrix.os, 'windows') && startsWith(matrix.msystem, 'MINGW') }}
81-
IS_WINDOWS_MSVC: ${{ startsWith(matrix.os, 'windows') && endsWith(matrix.host, '-pc-windows') }}
169+
SRC_PATH: ${{ github.workspace }}\source
170+
DEPS_PATH: ${{ github.workspace }}\dependencies
171+
INSTALL_PATH: ${{ github.workspace }}\build
172+
IS_WINDOWS_MINGW: ${{ startsWith(matrix.msystem, 'MINGW') }}
173+
IS_WINDOWS_MSVC: ${{ endsWith(matrix.host, '-pc-windows') }}
82174
CC: ${{ matrix.CC }}
83175
CXX: ${{ matrix.CXX }}
84176
LDFLAGS: ${{ matrix.LDFLAGS }}
@@ -93,37 +185,15 @@ jobs:
93185

94186
defaults:
95187
run:
96-
shell: ${{ startsWith(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
188+
shell: msys2 {0}
97189
working-directory: ${{ env.SRC_PATH }}
98190

99191
steps:
100-
- uses: actions/checkout@v2
192+
- uses: actions/checkout@v3
101193
with:
102194
path: ${{ env.SRC_PATH }}
103195

104-
- name: Install packages (Linux)
105-
if: runner.os == 'Linux'
106-
run: |
107-
PACKAGES="cmake pkg-config libgnutls28-dev libffi-dev libicu-dev libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev gnutls-bin libcurl4-gnutls-dev"
108-
case $LIBRARY_COMBO in
109-
gnu-gnu-gnu)
110-
# GCC Objective-C runtime
111-
PACKAGES="$PACKAGES libobjc-9-dev libblocksruntime-dev gobjc"
112-
;;
113-
ng-gnu-gnu)
114-
# packages for libdispatch
115-
PACKAGES="$PACKAGES libkqueue-dev libpthread-workqueue-dev"
116-
# gnustep-2.0 runtime requires ld.gold or lld
117-
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ]; then
118-
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10
119-
fi
120-
;;
121-
esac
122-
123-
sudo apt-get update
124-
sudo apt-get install $PACKAGES
125-
126-
- name: Set up MSYS2 (Windows MinGW)
196+
- name: Set up MSYS2 (MinGW)
127197
uses: msys2/setup-msys2@v2
128198
if: env.IS_WINDOWS_MINGW == 'true'
129199
with:
@@ -145,7 +215,7 @@ jobs:
145215
mingw-w64-${{matrix.arch}}-gnutls
146216
mingw-w64-${{matrix.arch}}-icu
147217
148-
- name: Set up MSYS2 (Windows MSVC)
218+
- name: Set up MSYS2 (MSVC)
149219
uses: msys2/setup-msys2@v2
150220
if: env.IS_WINDOWS_MSVC == 'true'
151221
with:
@@ -154,35 +224,47 @@ jobs:
154224
# make Windows packages like Clang available in MSYS
155225
path-type: inherit
156226

157-
- name: Delete MinGW gmake (Windows MSVC)
227+
- name: Delete MinGW gmake (MSVC)
158228
if: env.IS_WINDOWS_MSVC == 'true'
159229
# delete /c/Strawberry/c/bin/gmake built for MinGW that is found on runners, because we must use make built for MSYS
160230
run: if GMAKE_PATH=`which gmake`; then rm -f "$GMAKE_PATH"; fi
161231

162-
- name: Install Windows packages (Windows MSVC)
232+
- name: Install Windows packages (MSVC)
163233
if: env.IS_WINDOWS_MSVC == 'true'
164234
shell: cmd
165235
run: choco install ninja
166236

167-
- name: Set up VS Developer Command Prompt (Windows MSVC)
237+
- name: Set up VS Developer Command Prompt (MSVC)
168238
if: env.IS_WINDOWS_MSVC == 'true'
169239
uses: ilammy/msvc-dev-cmd@v1
170240
with:
171241
arch: ${{ matrix.arch }}
172242

173-
- name: Install dependencies (Windows MSVC)
174-
if: env.IS_WINDOWS_MSVC == 'true'
243+
- name: Build dependencies (MSVC)
244+
if: env.IS_WINDOWS_MSVC == 'true' && github.event.inputs.tools_windows_msvc_branch
175245
shell: cmd
246+
env:
247+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used by scripts to prevent GitHub rate limit errors
176248
run: |
177249
mkdir %DEPS_PATH% & cd %DEPS_PATH%
178-
git clone https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
250+
git clone -q -b ${{github.event.inputs.tools_windows_msvc_branch}} https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
179251
cd tools-windows-msvc
180252
:: use msys2.cmd from setup-msys2 as Bash shell, as it doesn't have msys2_shell.cmd used normally by build.bat
181253
set "BASH=msys2 -c"
182254
build.bat --prefix=%INSTALL_PATH% --type Release --only-dependencies
183255
184-
- name: Set environment variables (Windows)
185-
if: runner.os == 'Windows'
256+
- name: Install pre-built dependencies (MSVC)
257+
if: env.IS_WINDOWS_MSVC == 'true' && !github.event.inputs.tools_windows_msvc_branch
258+
shell: cmd
259+
run: |
260+
mkdir %INSTALL_PATH% & cd %INSTALL_PATH%
261+
# download latest pre-built release
262+
curl -L -o GNUstep-Windows-MSVC.zip https://github.com/gnustep/tools-windows-msvc/releases/download/latest/GNUstep-Windows-MSVC-${{matrix.arch}}.zip || exit /b 1
263+
# extract excluding debug build and GNUstep components (we need dependencies only)
264+
tar -xvf GNUstep-Windows-MSVC.zip --strip 1 --exclude Debug --exclude "**/gnustep*" --exclude "**/GNUstep*" --exclude Foundation --exclude CoreFoundation || exit /b 1
265+
del /Q GNUstep-Windows-MSVC.zip
266+
267+
- name: Set environment variables
186268
run: |
187269
# MSVC: update install path to include [x86|x64]/Release subdir used by build.bat above
188270
if [ "$IS_WINDOWS_MSVC" = "true" ]; then
@@ -193,8 +275,7 @@ jobs:
193275
echo "DEPS_PATH=`cygpath -u $DEPS_PATH`" >> $GITHUB_ENV
194276
195277
- name: Install dependencies
196-
run: |
197-
./.github/scripts/dependencies.sh
278+
run: ./.github/scripts/dependencies.sh
198279

199280
- name: Build source
200281
run: |
@@ -216,7 +297,7 @@ jobs:
216297
make check
217298
218299
- name: Upload logs
219-
uses: actions/upload-artifact@v2
300+
uses: actions/upload-artifact@v3
220301
if: always()
221302
with:
222303
name: Logs - ${{ matrix.name }}

0 commit comments

Comments
 (0)