Skip to content

Commit e13195b

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 e13195b

File tree

2 files changed

+148
-63
lines changed

2 files changed

+148
-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 ${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: 144 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,153 @@
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+
env:
99+
TOOLS_MAKE_BRANCH: ${{github.event.inputs.tools_make_branch}}
100+
run: ./.github/scripts/dependencies.sh
101+
102+
- name: Build source
103+
run: |
104+
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
105+
./configure
106+
make && make install
107+
108+
- name: Run tests
109+
run: |
110+
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
111+
make check
112+
113+
- name: Upload logs
114+
uses: actions/upload-artifact@v3
115+
if: always()
116+
with:
117+
name: Logs - ${{ matrix.name }}
118+
path: |
119+
${{ env.SRC_PATH }}/config.log
120+
${{ env.SRC_PATH }}/Tests/tests.log
121+
122+
123+
########### Windows ###########
124+
windows:
125+
name: ${{ matrix.name }}
126+
runs-on: windows-2019
127+
# don't run pull requests from local branches twice
128+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
129+
130+
strategy:
131+
fail-fast: false
132+
matrix:
133+
include:
134+
- name: Windows x86 MinGW GCC
37135
allow-test-failures: true
38-
os: windows-2019
39136
arch: i686
40137
msystem: MINGW32
41138
library-combo: gnu-gnu-gnu
42139
CC: gcc
43140
CXX: g++
44141

45-
- name: Windows MinGW GCC x86_64
46-
os: windows-2019
142+
- name: Windows x64 MinGW GCC
47143
arch: x86_64
48144
msystem: MINGW64
49145
library-combo: gnu-gnu-gnu
50146
CC: gcc
51147
CXX: g++
52148

53-
- name: Windows MSVC Clang gnustep-2.0 i686
149+
- name: Windows x86 MSVC Clang gnustep-2.0
54150
allow-test-failures: true
55-
os: windows-2019
56151
arch: x86
57152
host: i686-pc-windows
58153
library-combo: ng-gnu-gnu
@@ -62,8 +157,7 @@ jobs:
62157
CXX: clang++ -m32
63158
LDFLAGS: -fuse-ld=lld
64159

65-
- name: Windows MSVC Clang gnustep-2.0 x86_64
66-
os: windows-2019
160+
- name: Windows x64 MSVC Clang gnustep-2.0
67161
arch: x64
68162
host: x86_64-pc-windows
69163
library-combo: ng-gnu-gnu
@@ -74,11 +168,11 @@ jobs:
74168
LDFLAGS: -fuse-ld=lld
75169

76170
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') }}
171+
SRC_PATH: ${{ github.workspace }}\source
172+
DEPS_PATH: ${{ github.workspace }}\dependencies
173+
INSTALL_PATH: ${{ github.workspace }}\build
174+
IS_WINDOWS_MINGW: ${{ startsWith(matrix.msystem, 'MINGW') }}
175+
IS_WINDOWS_MSVC: ${{ endsWith(matrix.host, '-pc-windows') }}
82176
CC: ${{ matrix.CC }}
83177
CXX: ${{ matrix.CXX }}
84178
LDFLAGS: ${{ matrix.LDFLAGS }}
@@ -93,37 +187,15 @@ jobs:
93187

94188
defaults:
95189
run:
96-
shell: ${{ startsWith(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
190+
shell: msys2 {0}
97191
working-directory: ${{ env.SRC_PATH }}
98192

99193
steps:
100-
- uses: actions/checkout@v2
194+
- uses: actions/checkout@v3
101195
with:
102196
path: ${{ env.SRC_PATH }}
103197

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)
198+
- name: Set up MSYS2 (MinGW)
127199
uses: msys2/setup-msys2@v2
128200
if: env.IS_WINDOWS_MINGW == 'true'
129201
with:
@@ -145,7 +217,7 @@ jobs:
145217
mingw-w64-${{matrix.arch}}-gnutls
146218
mingw-w64-${{matrix.arch}}-icu
147219
148-
- name: Set up MSYS2 (Windows MSVC)
220+
- name: Set up MSYS2 (MSVC)
149221
uses: msys2/setup-msys2@v2
150222
if: env.IS_WINDOWS_MSVC == 'true'
151223
with:
@@ -154,35 +226,47 @@ jobs:
154226
# make Windows packages like Clang available in MSYS
155227
path-type: inherit
156228

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

162-
- name: Install Windows packages (Windows MSVC)
234+
- name: Install Windows packages (MSVC)
163235
if: env.IS_WINDOWS_MSVC == 'true'
164236
shell: cmd
165237
run: choco install ninja
166238

167-
- name: Set up VS Developer Command Prompt (Windows MSVC)
239+
- name: Set up VS Developer Command Prompt (MSVC)
168240
if: env.IS_WINDOWS_MSVC == 'true'
169241
uses: ilammy/msvc-dev-cmd@v1
170242
with:
171243
arch: ${{ matrix.arch }}
172244

173-
- name: Install dependencies (Windows MSVC)
174-
if: env.IS_WINDOWS_MSVC == 'true'
245+
- name: Build dependencies (MSVC)
246+
if: env.IS_WINDOWS_MSVC == 'true' && github.event.inputs.tools_windows_msvc_branch
175247
shell: cmd
248+
env:
249+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used by scripts to prevent GitHub rate limit errors
176250
run: |
177251
mkdir %DEPS_PATH% & cd %DEPS_PATH%
178-
git clone https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
252+
git clone -q -b ${{github.event.inputs.tools_windows_msvc_branch}} https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
179253
cd tools-windows-msvc
180254
:: use msys2.cmd from setup-msys2 as Bash shell, as it doesn't have msys2_shell.cmd used normally by build.bat
181255
set "BASH=msys2 -c"
182256
build.bat --prefix=%INSTALL_PATH% --type Release --only-dependencies
183257
184-
- name: Set environment variables (Windows)
185-
if: runner.os == 'Windows'
258+
- name: Install pre-built dependencies (MSVC)
259+
if: env.IS_WINDOWS_MSVC == 'true' && !github.event.inputs.tools_windows_msvc_branch
260+
shell: cmd
261+
run: |
262+
mkdir %INSTALL_PATH% & cd %INSTALL_PATH%
263+
# download latest pre-built release
264+
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
265+
# extract excluding debug build and GNUstep components (we need dependencies only)
266+
tar -xvf GNUstep-Windows-MSVC.zip --strip 1 --exclude Debug --exclude "**/gnustep*" --exclude "**/GNUstep*" --exclude Foundation --exclude CoreFoundation || exit /b 1
267+
del /Q GNUstep-Windows-MSVC.zip
268+
269+
- name: Set environment variables
186270
run: |
187271
# MSVC: update install path to include [x86|x64]/Release subdir used by build.bat above
188272
if [ "$IS_WINDOWS_MSVC" = "true" ]; then
@@ -193,8 +277,9 @@ jobs:
193277
echo "DEPS_PATH=`cygpath -u $DEPS_PATH`" >> $GITHUB_ENV
194278
195279
- name: Install dependencies
196-
run: |
197-
./.github/scripts/dependencies.sh
280+
env:
281+
TOOLS_MAKE_BRANCH: ${{github.event.inputs.tools_make_branch}}
282+
run: ./.github/scripts/dependencies.sh
198283

199284
- name: Build source
200285
run: |
@@ -216,7 +301,7 @@ jobs:
216301
make check
217302
218303
- name: Upload logs
219-
uses: actions/upload-artifact@v2
304+
uses: actions/upload-artifact@v3
220305
if: always()
221306
with:
222307
name: Logs - ${{ matrix.name }}

0 commit comments

Comments
 (0)