-
Notifications
You must be signed in to change notification settings - Fork 2
426 lines (375 loc) · 17.1 KB
/
build-syntaxinterface.yml
File metadata and controls
426 lines (375 loc) · 17.1 KB
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# Build libSyntaxInterface for all platforms and upload to a GitHub Release.
#
# The configure script in jaspSyntax downloads these binaries during
# `install.packages()`. R-universe also uses this when building the package.
#
# Trigger: manual dispatch, or on a schedule (every 2 weeks on Monday 06:00 UTC).
name: Build SyntaxInterface Libraries
on:
workflow_dispatch:
inputs:
jasp_desktop_ref:
description: 'jasp-desktop branch/tag/SHA to build from'
required: false
default: 'development'
release_tag:
description: 'Release tag to upload assets to'
required: false
default: 'syntaxinterface-libs'
os_filter:
description: 'Limit build to one runner (e.g. macos-15, windows-latest, ubuntu-latest, ubuntu-24.04-arm, macos-15-intel). Leave empty to build all.'
required: false
default: ''
# schedule:
# - cron: '0 6 1,15 * *' # 1st and 15th of each month at 06:00 UTC
# Cancel previous runs of this workflow on the same ref
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
JASP_DESKTOP_REPO: ${{ github.repository_owner }}/jasp-desktop
JASP_DESKTOP_REF: ${{ github.event.inputs.jasp_desktop_ref || 'development' }}
RELEASE_TAG: ${{ github.event.inputs.release_tag || 'syntaxinterface-libs' }}
QT_VERSION: '6.10.2'
QT_SUBMODULES: 'qtbase,qtdeclarative,qtshadertools'
QT_SUBMODULES_CACHE_KEY: 'qtbase-qtdeclarative-qtshadertools'
jobs:
# ---------------------------------------------------------------------------
# Builds the matrix from the full list, filtered by os_filter when set.
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
ALL='{"include":[
{"os":"ubuntu-latest", "arch":"x86_64","artifact":"libSyntaxInterface-linux-x86_64.so", "lib_file":"libSyntaxInterface.so"},
{"os":"ubuntu-24.04-arm", "arch":"arm64", "artifact":"libSyntaxInterface-linux-arm64.so", "lib_file":"libSyntaxInterface.so"},
{"os":"macos-15-intel", "arch":"x86_64","artifact":"libSyntaxInterface-darwin-x86_64.dylib", "lib_file":"libSyntaxInterface.dylib"},
{"os":"macos-15", "arch":"arm64", "artifact":"libSyntaxInterface-darwin-arm64.dylib", "lib_file":"libSyntaxInterface.dylib"},
{"os":"windows-latest", "arch":"x86_64","artifact":"SyntaxInterface-windows-x86_64.dll", "lib_file":"SyntaxInterface.dll"}
]}'
FILTER='${{ github.event.inputs.os_filter }}'
if [ -z "$FILTER" ]; then
echo "matrix=$(echo "$ALL" | jq -c '.')" >> "$GITHUB_OUTPUT"
else
echo "matrix=$(echo "$ALL" | jq -c --arg os "$FILTER" '{include:[.include[]|select(.os==$os)]}')" >> "$GITHUB_OUTPUT"
fi
# ---------------------------------------------------------------------------
build:
needs: setup
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
# the runners are based on https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
# this may need to be updated over time
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (${{ matrix.arch }})
steps:
- name: Checkout jaspSyntax (for workflow context)
uses: actions/checkout@v6
# ---- System dependencies ----
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build \
autoconf bison flex g++ gfortran \
zlib1g-dev libssl-dev libgl1-mesa-dev \
libsqlite3-dev libarchive-dev \
libxkbcommon-dev libxkbcommon-x11-dev libxcb-xkb-dev \
libxcb-xinerama0 libxcb-cursor0 \
libboost-dev libboost-filesystem-dev libboost-system-dev \
libboost-date-time-dev libboost-timer-dev libboost-chrono-dev \
librdata-dev libfreexl-dev libminizip-dev libglpk-dev \
libjsoncpp-dev libnss3-dev libnspr4-dev \
libxcomposite-dev libxdamage-dev libxrandr-dev libxtst-dev \
libxi-dev libasound2-dev libxkbfile-dev \
libxcb-icccm4-dev libxcb-shape0-dev libxcb-keysyms1-dev \
patchelf pkg-config \
r-base r-base-dev
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake ninja autoconf automake libtool pkg-config
pip3 install --break-system-packages conan
conan profile detect --force
- name: Install system dependencies (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
choco install ninja -y
pip install conan
conan profile detect --force
# ---- Install readstat (Linux) ----
- name: Install ReadStat from source (Linux)
if: runner.os == 'Linux'
run: |
wget -q https://github.com/WizardMac/ReadStat/releases/download/v1.1.9/readstat-1.1.9.tar.gz
tar -xzf readstat-1.1.9.tar.gz
cd readstat-1.1.9
./configure --prefix=/usr/local
make -j$(nproc) CFLAGS='-Wno-error=use-after-free'
sudo make install
sudo ldconfig
# ---- Setup R ----
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.5'
- name: Install Rcpp and RInside
run: |
Rscript -e 'install.packages(c("Rcpp", "RInside"), repos = "https://cloud.r-project.org")'
- name: Install Rtools45 ucrt64 compiler (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
C:\rtools45\usr\bin\pacman.exe -Sy --noconfirm mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-make
if not exist C:\rtools45\ucrt64\bin\mingw32-make.exe (
if exist C:\rtools45\ucrt64\bin\make.exe (
copy C:\rtools45\ucrt64\bin\make.exe C:\rtools45\ucrt64\bin\mingw32-make.exe
)
)
# ---- Install Qt from source and build static ----
- name: Cache static Qt build
id: cache-qt
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/qt-static
key: qt-static-${{ matrix.os }}-${{ matrix.arch }}-${{ env.QT_VERSION }}-${{ env.QT_SUBMODULES_CACHE_KEY }}
- name: Install aqtinstall
if: steps.cache-qt.outputs.cache-hit != 'true'
run: pip3 install --break-system-packages aqtinstall
- name: Download Qt source
if: steps.cache-qt.outputs.cache-hit != 'true'
shell: bash
run: |
aqt install-src -O qt-src all_os desktop "${{ env.QT_VERSION }}"
- name: Build static Qt (Unix)
if: steps.cache-qt.outputs.cache-hit != 'true' && runner.os != 'Windows'
shell: bash
run: |
cd qt-src/${{ env.QT_VERSION }}/Src
./configure -release -static -opensource -confirm-license \
-prefix ${{ github.workspace }}/qt-static \
-submodules ${{ env.QT_SUBMODULES }} \
-- -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build . --parallel $(nproc 2>/dev/null || sysctl -n hw.ncpu)
cmake --install .
- name: Build static Qt (Windows)
if: steps.cache-qt.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
for /f "usebackq delims=" %%P in (`powershell -NoProfile -Command "($Env:PATH -split ';' | Where-Object {$_ -notmatch 'rtools'}) -join ';'"`) do set "PATH=%%P"
cd qt-src\${{ env.QT_VERSION }}\Src
call configure.bat -release -static -opensource -confirm-license ^
-prefix ${{ github.workspace }}\qt-static ^
-submodules ${{ env.QT_SUBMODULES }}
cmake --build . --parallel
cmake --install .
- name: Save Qt static cache
if: steps.cache-qt.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/qt-static
key: qt-static-${{ matrix.os }}-${{ matrix.arch }}-${{ env.QT_VERSION }}-${{ env.QT_SUBMODULES_CACHE_KEY }}
# ---- Clone and build jasp-desktop / SyntaxInterface ----
- name: Clone jasp-desktop
uses: actions/checkout@v6
with:
repository: ${{ env.JASP_DESKTOP_REPO }}
ref: ${{ env.JASP_DESKTOP_REF }}
path: jasp-desktop
token: ${{ secrets.GITHUB_TOKEN }}
- name: Initialize required submodules
shell: bash
run: git -C jasp-desktop submodule update --init Engine/jaspBase Engine/jaspModuleBundleManager
- name: Restore Conan package cache (macOS)
if: runner.os == 'macOS'
id: cache-conan
uses: actions/cache/restore@v5
with:
path: ~/.conan2/p
key: conan-v1-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('jasp-desktop/conanfile.py') }}
restore-keys: |
conan-v1-${{ matrix.os }}-${{ matrix.arch }}-
- name: Link system R.framework into build directory (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
mkdir -p build/Frameworks
ln -sfn /Library/Frameworks/R.framework build/Frameworks/R.framework
- name: Configure jasp-desktop (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
R_HOME=$(R RHOME)
cmake -G Ninja -S jasp-desktop -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/qt-static" \
-DCUSTOM_R_PATH="${R_HOME}" \
-DREQUIRE_GITHUB_PAT=OFF \
-DJASP_SYNTAX_INTERFACE_ONLY=ON \
-DSIGN_AT_BUILD_TIME=OFF \
-DTIMESTAMP_AT_BUILD_TIME=OFF \
-DINSTALL_R_FRAMEWORK=OFF \
-DINSTALL_R_MODULES=OFF \
-DBUILD_TESTS=OFF
- name: Configure jasp-desktop (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
R_HOME=$(R RHOME)
cmake -G Ninja -S jasp-desktop -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/qt-static" \
-DCUSTOM_R_PATH="${R_HOME}" \
-DREQUIRE_GITHUB_PAT=OFF \
-DJASP_SYNTAX_INTERFACE_ONLY=ON \
-DINSTALL_R_MODULES=OFF \
-DBUILD_TESTS=OFF
- name: Configure jasp-desktop (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
for /f %%i in ('Rscript -e "cat(R.home())"') do set R_HOME=%%i
cmake -G Ninja -S jasp-desktop -B build ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=${{ github.workspace }}\qt-static ^
-DREQUIRE_GITHUB_PAT=OFF ^
-DJASP_SYNTAX_INTERFACE_ONLY=ON ^
-DINSTALL_R_MODULES=OFF ^
-DBUILD_TESTS=OFF
- name: Build SyntaxInterface
if: runner.os != 'Windows'
shell: bash
run: cmake --build build --target SyntaxInterface --parallel
- name: Save Conan package cache (macOS)
if: runner.os == 'macOS' && steps.cache-conan.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ~/.conan2/p
key: conan-v1-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('jasp-desktop/conanfile.py') }}
- name: Build SyntaxInterface (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
cmake --build build --target SyntaxInterface --parallel
# ---- Collect and upload artifact ----
- name: Collect library (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
cp build/SyntaxInterface/${{ matrix.lib_file }} ${{ matrix.artifact }}
- name: Collect library (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
# On Windows CMAKE_RUNTIME_OUTPUT_DIRECTORY is set to CMAKE_BINARY_DIR,
# so SyntaxInterface.dll lands in build/ not build/SyntaxInterface/.
# libR-InterfaceNoRInside.dll is also needed at runtime.
cp build/${{ matrix.lib_file }} ${{ matrix.artifact }}
if [ -f build/R-Interface/libR-InterfaceNoRInside.dll ]; then
cp build/R-Interface/libR-InterfaceNoRInside.dll libR-InterfaceNoRInside-windows-x86_64.dll
fi
- name: Collect SyntaxInterface source bundle
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
shell: bash
run: |
mkdir -p syntaxinterface-sources/SyntaxInterface syntaxinterface-sources/Common/json
{
echo "schema=1"
echo "jasp_desktop_ref=${{ env.JASP_DESKTOP_REF }}"
echo "jasp_desktop_sha=$(git -C jasp-desktop rev-parse HEAD)"
echo "jasp_syntax_sha=$(git rev-parse HEAD)"
echo "qt_version=${{ env.QT_VERSION }}"
echo "qt_submodules=${{ env.QT_SUBMODULES }}"
} > syntaxinterface-sources/BUILD_PROVENANCE
cp jasp-desktop/SyntaxInterface/syntaxbridge_interface.h syntaxinterface-sources/SyntaxInterface/
for file in allocator.h assertions.h config.h forwards.h json.h json_features.h json_reader.cpp json_tool.h json_value.cpp json_valueiterator.inl json_writer.cpp reader.h value.h version.h writer.h; do
cp "jasp-desktop/Common/json/${file}" "syntaxinterface-sources/Common/json/${file}"
done
tar -czf SyntaxInterface-sources.tar.gz -C syntaxinterface-sources .
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: |
${{ matrix.artifact }}
libR-InterfaceNoRInside-windows-*.dll
if-no-files-found: error
- name: Upload SyntaxInterface source bundle
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v7
with:
name: SyntaxInterface-sources
path: SyntaxInterface-sources.tar.gz
if-no-files-found: error
# ---------------------------------------------------------------------------
release:
needs: [setup, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
merge-multiple: true
path: libs
# Full build: regenerate checksums and release notes from the source bundle.
- name: Generate checksums
if: github.event.inputs.os_filter == ''
working-directory: libs
run: sha256sum * > SHA256SUMS
- name: Show checksums
if: github.event.inputs.os_filter == ''
run: cat libs/SHA256SUMS
- name: Write release notes
if: github.event.inputs.os_filter == ''
shell: bash
run: |
tar -xOf libs/SyntaxInterface-sources.tar.gz ./BUILD_PROVENANCE > BUILD_PROVENANCE
JASP_DESKTOP_REF=$(grep -E '^jasp_desktop_ref=' BUILD_PROVENANCE | sed -E 's/^[^=]+=//')
JASP_DESKTOP_SHA=$(grep -E '^jasp_desktop_sha=' BUILD_PROVENANCE | sed -E 's/^[^=]+=//')
JASP_SYNTAX_SHA=$(grep -E '^jasp_syntax_sha=' BUILD_PROVENANCE | sed -E 's/^[^=]+=//')
QT_VERSION=$(grep -E '^qt_version=' BUILD_PROVENANCE | sed -E 's/^[^=]+=//')
QT_SUBMODULES=$(grep -E '^qt_submodules=' BUILD_PROVENANCE | sed -E 's/^[^=]+=//')
cat > release-body.md <<EOF
Pre-built \`libSyntaxInterface\` binaries for use by \`jaspSyntax\`.
Built from [jasp-desktop@${JASP_DESKTOP_REF}](https://github.com/${JASP_DESKTOP_REPO}/tree/${JASP_DESKTOP_REF}).
Resolved jasp-desktop SHA: \`${JASP_DESKTOP_SHA}\`
jaspSyntax workflow SHA: \`${JASP_SYNTAX_SHA}\`
Qt version: ${QT_VERSION} (static, submodules: ${QT_SUBMODULES}).
These are downloaded automatically by the \`configure\` script during \`install.packages("jaspSyntax")\`.
EOF
- name: Create or update release (full build)
if: github.event.inputs.os_filter == ''
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
name: "SyntaxInterface pre-built libraries"
body_path: release-body.md
files: libs/*
draft: false
prerelease: false
make_latest: false
# Single-OS build: upload only the library file; leave release notes and
# the full SHA256SUMS from the last complete build untouched.
- name: Upload library to release (single OS)
if: github.event.inputs.os_filter != ''
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
files: |
libs/*.so
libs/*.dylib
libs/*.dll
draft: false
prerelease: false
make_latest: false