Skip to content

Commit bc49f18

Browse files
committed
CI: various improvements
- update GitHub actions (fixes Node.js 12 deprecation warnings) - separate Linux and Windows jobs - 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 bc49f18

File tree

2 files changed

+140
-63
lines changed

2 files changed

+140
-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 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: 136 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,147 @@
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_windows_msvc_branch:
9+
description: "Windows MSVC dependencies branch (leave empty to use latest pre-built release)"
10+
required: false
11+
12+
env:
13+
APT_PACKAGES: >-
14+
pkg-config
15+
libgnutls28-dev
16+
libffi-dev
17+
libicu-dev
18+
libxml2-dev
19+
libxslt1-dev
20+
libssl-dev
21+
libavahi-client-dev
22+
zlib1g-dev
23+
gnutls-bin
24+
libcurl4-gnutls-dev
25+
26+
# packages for GCC Objective-C runtime
27+
APT_PACKAGES_gcc: >-
28+
libobjc-10-dev
29+
libblocksruntime-dev
30+
gobjc
31+
32+
# packages for libobjc2 / libdispatch
33+
APT_PACKAGES_clang: >-
34+
libpthread-workqueue-dev
435
536
jobs:
6-
ci:
37+
########### Linux ###########
38+
linux:
739
name: ${{ matrix.name }}
8-
runs-on: ${{ matrix.os }}
40+
runs-on: ubuntu-latest
941
# don't run pull requests from local branches twice
1042
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
1143

1244
strategy:
1345
fail-fast: false
1446
matrix:
1547
include:
16-
- name: Ubuntu GCC
17-
os: ubuntu-latest
48+
- name: Ubuntu x64 GCC
1849
library-combo: gnu-gnu-gnu
1950
CC: gcc
2051
CXX: g++
2152

22-
- name: Ubuntu Clang gnustep-1.9
23-
os: ubuntu-latest
53+
- name: Ubuntu x64 Clang gnustep-1.9
2454
library-combo: ng-gnu-gnu
2555
runtime-version: gnustep-1.9
2656
CC: clang
2757
CXX: clang++
2858

29-
- name: Ubuntu Clang gnustep-2.0
30-
os: ubuntu-latest
59+
- name: Ubuntu x64 Clang gnustep-2.0
3160
library-combo: ng-gnu-gnu
3261
runtime-version: gnustep-2.0
3362
CC: clang
3463
CXX: clang++
3564

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

45-
- name: Windows MinGW GCC x86_64
46-
os: windows-2019
136+
- name: Windows x64 MinGW GCC
47137
arch: x86_64
48138
msystem: MINGW64
49139
library-combo: gnu-gnu-gnu
50140
CC: gcc
51141
CXX: g++
52142

53-
- name: Windows MSVC Clang gnustep-2.0 i686
143+
- name: Windows x86 MSVC Clang gnustep-2.0
54144
allow-test-failures: true
55-
os: windows-2019
56145
arch: x86
57146
host: i686-pc-windows
58147
library-combo: ng-gnu-gnu
@@ -62,8 +151,7 @@ jobs:
62151
CXX: clang++ -m32
63152
LDFLAGS: -fuse-ld=lld
64153

65-
- name: Windows MSVC Clang gnustep-2.0 x86_64
66-
os: windows-2019
154+
- name: Windows x64 MSVC Clang gnustep-2.0
67155
arch: x64
68156
host: x86_64-pc-windows
69157
library-combo: ng-gnu-gnu
@@ -74,11 +162,11 @@ jobs:
74162
LDFLAGS: -fuse-ld=lld
75163

76164
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') }}
165+
SRC_PATH: ${{ github.workspace }}\source
166+
DEPS_PATH: ${{ github.workspace }}\dependencies
167+
INSTALL_PATH: ${{ github.workspace }}\build
168+
IS_WINDOWS_MINGW: ${{ startsWith(matrix.msystem, 'MINGW') }}
169+
IS_WINDOWS_MSVC: ${{ endsWith(matrix.host, '-pc-windows') }}
82170
CC: ${{ matrix.CC }}
83171
CXX: ${{ matrix.CXX }}
84172
LDFLAGS: ${{ matrix.LDFLAGS }}
@@ -93,37 +181,15 @@ jobs:
93181

94182
defaults:
95183
run:
96-
shell: ${{ startsWith(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
184+
shell: msys2 {0}
97185
working-directory: ${{ env.SRC_PATH }}
98186

99187
steps:
100-
- uses: actions/checkout@v2
188+
- uses: actions/checkout@v3
101189
with:
102190
path: ${{ env.SRC_PATH }}
103191

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)
192+
- name: Set up MSYS2 (MinGW)
127193
uses: msys2/setup-msys2@v2
128194
if: env.IS_WINDOWS_MINGW == 'true'
129195
with:
@@ -145,7 +211,7 @@ jobs:
145211
mingw-w64-${{matrix.arch}}-gnutls
146212
mingw-w64-${{matrix.arch}}-icu
147213
148-
- name: Set up MSYS2 (Windows MSVC)
214+
- name: Set up MSYS2 (MSVC)
149215
uses: msys2/setup-msys2@v2
150216
if: env.IS_WINDOWS_MSVC == 'true'
151217
with:
@@ -154,35 +220,47 @@ jobs:
154220
# make Windows packages like Clang available in MSYS
155221
path-type: inherit
156222

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

162-
- name: Install Windows packages (Windows MSVC)
228+
- name: Install Windows packages (MSVC)
163229
if: env.IS_WINDOWS_MSVC == 'true'
164230
shell: cmd
165231
run: choco install ninja
166232

167-
- name: Set up VS Developer Command Prompt (Windows MSVC)
233+
- name: Set up VS Developer Command Prompt (MSVC)
168234
if: env.IS_WINDOWS_MSVC == 'true'
169235
uses: ilammy/msvc-dev-cmd@v1
170236
with:
171237
arch: ${{ matrix.arch }}
172238

173-
- name: Install dependencies (Windows MSVC)
174-
if: env.IS_WINDOWS_MSVC == 'true'
239+
- name: Build dependencies (MSVC)
240+
if: env.IS_WINDOWS_MSVC == 'true' && github.event.inputs.tools_windows_msvc_branch
175241
shell: cmd
242+
env:
243+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used by scripts to prevent GitHub rate limit errors
176244
run: |
177245
mkdir %DEPS_PATH% & cd %DEPS_PATH%
178-
git clone https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
246+
git clone -q -b ${{github.event.inputs.tools_windows_msvc_branch}} https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
179247
cd tools-windows-msvc
180248
:: use msys2.cmd from setup-msys2 as Bash shell, as it doesn't have msys2_shell.cmd used normally by build.bat
181249
set "BASH=msys2 -c"
182250
build.bat --prefix=%INSTALL_PATH% --type Release --only-dependencies
183251
184-
- name: Set environment variables (Windows)
185-
if: runner.os == 'Windows'
252+
- name: Install pre-built dependencies (MSVC)
253+
if: env.IS_WINDOWS_MSVC == 'true' && !github.event.inputs.tools_windows_msvc_branch
254+
shell: cmd
255+
run: |
256+
mkdir %INSTALL_PATH% & cd %INSTALL_PATH%
257+
# download latest pre-built release
258+
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
259+
# extract excluding debug build and GNUstep components (we need dependencies only)
260+
tar -xvf GNUstep-Windows-MSVC.zip --strip 1 --exclude Debug --exclude "**/gnustep*" --exclude "**/GNUstep*" --exclude Foundation --exclude CoreFoundation || exit /b 1
261+
del /Q GNUstep-Windows-MSVC.zip
262+
263+
- name: Set environment variables
186264
run: |
187265
# MSVC: update install path to include [x86|x64]/Release subdir used by build.bat above
188266
if [ "$IS_WINDOWS_MSVC" = "true" ]; then
@@ -193,8 +271,7 @@ jobs:
193271
echo "DEPS_PATH=`cygpath -u $DEPS_PATH`" >> $GITHUB_ENV
194272
195273
- name: Install dependencies
196-
run: |
197-
./.github/scripts/dependencies.sh
274+
run: ./.github/scripts/dependencies.sh
198275

199276
- name: Build source
200277
run: |
@@ -216,7 +293,7 @@ jobs:
216293
make check
217294
218295
- name: Upload logs
219-
uses: actions/upload-artifact@v2
296+
uses: actions/upload-artifact@v3
220297
if: always()
221298
with:
222299
name: Logs - ${{ matrix.name }}

0 commit comments

Comments
 (0)