-
Notifications
You must be signed in to change notification settings - Fork 25
780 lines (687 loc) · 33.7 KB
/
app_build.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
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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
name: C++ CI for OpenStudioApplication
on:
push:
branches: [ master, develop ]
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [ master, develop ]
types: [ opened, reopened, synchronize, ready_for_review ]
env:
BUILD_TYPE: Release
BUILD_DOCUMENTATION: OFF
BUILD_TESTING: ON
BUILD_BENCHMARK: ON
BUILD_PACKAGE: ON
QT_VERSION: 6.5.2
QT_DEBUG_PLUGINS: 1
jobs:
build:
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
outputs:
OS_APP_VERSION: ${{ steps.parse_cmake_versions.outputs.OS_APP_VERSION }}
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
# fail-fast: Default is true, switch to false to allow one platform to fail and still run others
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, macos-13, macos-arm64]
include:
- os: ubuntu-22.04
SELF_HOSTED: false
PLATFORM_NAME: Linux
BINARY_EXT: deb
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Linux/DEB
COMPRESSED_PKG_PATH: _CPack_Packages/Linux/TGZ
QT_OS_NAME: linux
QT_ARCH: gcc_64
arch: x86_64
- os: ubuntu-24.04
SELF_HOSTED: false
PLATFORM_NAME: Linux
BINARY_EXT: deb
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Linux/DEB
COMPRESSED_PKG_PATH: _CPack_Packages/Linux/TGZ
QT_OS_NAME: linux
QT_ARCH: gcc_64
arch: x86_64
- os: windows-2022
SELF_HOSTED: false
PLATFORM_NAME: Windows
BINARY_EXT: exe
COMPRESSED_EXT: zip
BINARY_PKG_PATH: _CPack_Packages/win64/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/win64/ZIP
QT_OS_NAME: windows
QT_ARCH: win64_msvc2019_64
arch: x86_64
- os: macos-13
SELF_HOSTED: false
PLATFORM_NAME: Darwin
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 13.0
SDKROOT: /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: clang_64
arch: x86_64
- os: macos-arm64
SELF_HOSTED: true
PLATFORM_NAME: Darwin
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 13.0
SDKROOT: /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: arm_64
arch: arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
if: ${{ !matrix.SELF_HOSTED }}
with:
python-version: '3.12.x'
- uses: ruby/setup-ruby@v1
if: ${{ !matrix.SELF_HOSTED }}
with:
ruby-version: 3.2.2
- name: Extract OSApp and OS SDK versions from CMakeLists.txt
id: parse_cmake_versions
shell: bash
run: |
# This both prints the variables and adds them to GITHUB_ENV
python ci/parse_cmake_versions.py
- name: Set OS-specific options and system dependencies (and QtIFW)
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
run: |
set -x
pwd
echo PLATFORM_NAME=${{ matrix.PLATFORM_NAME }} >> $GITHUB_ENV
echo BINARY_EXT=${{ matrix.BINARY_EXT }} >> $GITHUB_ENV
echo COMPRESSED_EXT=${{ matrix.COMPRESSED_EXT }} >> $GITHUB_ENV
if [ "$RUNNER_OS" == "Windows" ]; then
DIR_SEP="\\"
else
DIR_SEP="/"
fi
echo DIR_SEP=$DIR_SEP >> $GITHUB_ENV
if [ "${{ matrix.SELF_HOSTED }}" != "true" ]; then
CCACHE_DIR="${{ github.workspace }}${DIR_SEP}.ccache"
echo CCACHE_DIR=$CCACHE_DIR >> $GITHUB_ENV
fi
N=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)
echo "There are $N threads available"
echo "N=$N" >> $GITHUB_ENV
if [ "$RUNNER_OS" == "Linux" ]; then
echo "Install needed system dependencies for OPENGL (due to Qt) for Linux"
sudo apt update -qq
sudo apt install -y mesa-common-dev libglu1-mesa-dev patchelf ninja-build ccache libxkbcommon-x11-dev libgl1-mesa-dev chrpath libxcb-icccm4 libxcb-keysyms1 libxcb-xkb1 libxcb-randr0 libxcb-shape0 libxkbcommon-x11-0 libxcb-cursor0
gcc --version
ccache --set-config=cache_dir=$CCACHE_DIR
ccache --set-config=max_size=500M
ccache --set-config=compression=true
elif [ "$RUNNER_OS" == "Windows" ]; then
curl -L -O https://download.qt.io/official_releases/qt-installer-framework/4.6.1/QtInstallerFramework-windows-x64-4.6.1.exe
./QtInstallerFramework-windows-x64-4.6.1.exe --verbose --script ./ci/install_script_qtifw.qs
dir "C:/Qt/"
echo "C:/Qt/QtIFW-4.6.1/bin" >> $GITHUB_PATH
echo "Using chocolatey to install ninja"
choco install ninja
# using ccache fails to build .rc files on Windows
# ccache is installed under chocolatey but `choco uninstall ccache` fails
# setting CCACHE_DISABLE=1 did not work, just remove ccache
# echo "Remove ccache if it exists"
# rm -f "/c/ProgramData/Chocolatey/bin/ccache" || true
choco install ccache
ccache --set-config=cache_dir=$CCACHE_DIR
ccache --set-config=max_size=500M
ccache --set-config=compression=true
# C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
MSVC_DIR=$(vswhere -products '*' -requires Microsoft.Component.MSBuild -property installationPath -latest)
echo "Latest is: $MSVC_DIR"
echo "MSVC_DIR=$MSVC_DIR" >> $GITHUB_ENV
# add folder containing vcvarsall.bat
echo "$MSVC_DIR\VC\Auxiliary\Build" >> $GITHUB_PATH
elif [ "$RUNNER_OS" == "macOS" ]; then
# The MACOSX_DEPLOYMENT_TARGET environment variable sets the default value for the CMAKE_OSX_DEPLOYMENT_TARGET variable.
echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.MACOSX_DEPLOYMENT_TARGET }} >> $GITHUB_ENV
echo SDKROOT=${{ matrix.SDKROOT }} >> $GITHUB_ENV
echo CMAKE_MACOSX_DEPLOYMENT_TARGET='-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET' >> $GITHUB_ENV
if [ "${{ matrix.SELF_HOSTED }}" = "true" ]; then
echo "Using previously installed ninja and IFW"
echo "/Users/irvinemac/Qt/Tools/QtInstallerFramework/4.3/bin/" >> $GITHUB_PATH
else
echo "Setting Xcode version"
sudo xcode-select -s "/Applications/Xcode_15.2.app/Contents/Developer/"
echo "Using brew to install ninja"
brew install ninja md5sha1sum ccache
ccache --set-config=cache_dir=$CCACHE_DIR
ccache --set-config=max_size=500M
ccache --set-config=compression=true
ccache --set-config=compiler_check=content # darwin only
# The openssl@3 package installed on CI adds these files to the pkgconfig directory
# Remove them here so they aren't found instead of the version of OpenSSL built by Conan
rm /usr/local/lib/pkgconfig/libcrypto.pc
rm /usr/local/lib/pkgconfig/libssl.pc
rm /usr/local/lib/pkgconfig/openssl.pc
fi;
fi;
cmake --version
ccache --show-config || true
ccache --zero-stats || true
- name: "Configure for codesigning"
if: runner.os == 'macOS'
run: |
set -x
cd $RUNNER_TEMP
mkdir codesigning && cd codesigning
# ----- Create certificate files from secrets base64 -----
echo "${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_CERTIFICATE_P12_BASE64 }}" | base64 --decode > certificate_application.p12
echo "${{ secrets.MACOS_DEVELOPER_ID_INSTALLER_CERTIFICATE_P12_BASE64 }}" | base64 --decode > certificate_installer.p12
# ----- Configure Keychain -----
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
security create-keychain -p "${{ secrets.MACOS_KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH
# Unlock it for 6 hours
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "${{ secrets.MACOS_KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH
# ----- Import certificates on Keychain -----
security import certificate_application.p12 -P '${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_CERTIFICATE_P12_PASSWORD }}' -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import certificate_installer.p12 -P '${{ secrets.MACOS_DEVELOPER_ID_INSTALLER_CERTIFICATE_P12_PASSWORD }}' -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
security find-identity -vvvv $KEYCHAIN_PATH
# Add needed intermediary certificates
brew list aria2 || brew install aria2
aria2c https://www.apple.com/certificateauthority/AppleWWDRCAG2.cer
aria2c https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer
security import AppleWWDRCAG2.cer -k $KEYCHAIN_PATH
security import DeveloperIDG2CA.cer -k $KEYCHAIN_PATH
security find-identity -vvvv $KEYCHAIN_PATH
security find-identity -v -p codesigning
# Store AppConnect credentials
echo "${{ secrets.NOTARIZATION_API_KEY }}" > AppConnect_Developer_API_Key.p8
xcrun notarytool store-credentials OpenStudioApplication \
--key AppConnect_Developer_API_Key.p8 \
--key-id ${{ secrets.NOTARIZATION_API_TEAM_ID }} \
--issuer ${{ secrets.NOTARIZATION_API_ISSUER_ID }} \
--keychain $KEYCHAIN_PATH
cd .. && rm -Rf codesigning
# Download my patched QtIFW
mkdir QtIFW && cd QtIFW
aria2c https://github.com/jmarrec/QtIFW-fixup/releases/download/v5.0.0-dev-with-fixup/QtIFW-5.0.0-${{ matrix.arch }}.zip
xattr -r -d com.apple.quarantine ./QtIFW-5.0.0-${{ matrix.arch }}.zip
unzip QtIFW-5.0.0-${{ matrix.arch }}.zip
rm -Rf ./*.zip
chmod +x *
./installerbase --version
echo "$(pwd)" >> $GITHUB_PATH
- name: Install conan
shell: bash
run: |
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
set -x
begin_group "Install conan 2"
python --version
pip install 'conan>2'
conan --version
echo "::endgroup::"
begin_group "Default profile"
if [ "${{ matrix.SELF_HOSTED }}" == "true" ]; then
export CONAN_USER_HOME=$HOME${DIR_SEP}actions-runner${DIR_SEP}conan-cache
else
export CONAN_USER_HOME="${{ github.workspace }}${DIR_SEP}conan-cache"
fi;
echo CONAN_USER_HOME="$CONAN_USER_HOME" >> $GITHUB_ENV
export CONAN_HOME="$CONAN_USER_HOME${DIR_SEP}.conan2"
echo CONAN_HOME="$CONAN_HOME" >> $GITHUB_ENV
export CONAN_PROFILE_DEFAULT="$CONAN_HOME${DIR_SEP}profiles${DIR_SEP}default"
echo CONAN_PROFILE_DEFAULT="$CONAN_PROFILE_DEFAULT" >> $GITHUB_ENV
conan profile detect --force --name default
cat $CONAN_PROFILE_DEFAULT
# Mac has the FreeBSD flavor of sed and MUST take a backup suffix...
sed -i.bak 's/cppstd=.*$/cppstd=20/g' $CONAN_PROFILE_DEFAULT
sed -i.bak 's/build_type=.*$/build_type=${{ env.BUILD_TYPE }}/g' $CONAN_PROFILE_DEFAULT
# Windows only
sed -i.bak 's/compiler.runtime_type=.*$/compiler.runtime_type=${{ env.BUILD_TYPE }}/g' $CONAN_PROFILE_DEFAULT
rm -Rf $CONAN_PROFILE_DEFAULT.bak || true
conan profile show
echo "::endgroup::"
begin_group "Global.conf"
echo "core:non_interactive = True" >> $CONAN_HOME/global.conf
echo "core.download:parallel = {{os.cpu_count() - 2}}" >> $CONAN_HOME/global.conf
echo "core.sources:download_cache = $CONAN_USER_HOME/.conan-download-cache" >> $CONAN_HOME/global.conf
cat $CONAN_HOME/global.conf
echo "::endgroup::"
begin_group "Remotes"
conan remote add --force nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2
conan remote list
echo "::endgroup::"
begin_group "Debug hashFiles and co"
if [ "${{ matrix.SELF_HOSTED }}" == "false" ]; then
echo "runner.workspace=${{ runner.workspace }}"
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
echo "github.workspace=${{ github.workspace }}"
cat $CONAN_PROFILE_DEFAULT
echo format=${{ format('{0}/.conan/profiles/default', env.CONAN_USER_HOME) }}
echo hashFiles=${{ hashFiles(format('{0}/.conan/profiles/default', env.CONAN_USER_HOME)) }}
echo $CONAN_PROFILE_DEFAULT
echo hashFiles=${{ hashFiles(env.CONAN_PROFILE_DEFAULT) }}
echo hashFiles_rel=${{ hashFiles('./conan-cache/.conan/profiles/default') }}
echo hashFiles_conanInstall=${{ hashFiles('./ConanInstall.cmake') }}
fi
echo "::endgroup::"
# Note: I'm picking up the ccache before I do the conan cache, otherwise on windows when trying to hashFiles('**/CMakeLists.txt') it looks into the conan folder which fails
# To prevent problems, changing to multiple more specific glob patterns
- name: Setup CCache
uses: actions/cache@v4
id: cacheccache
if: ${{ !matrix.SELF_HOSTED }}
with:
path: |
${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.os }}-build=${{ env.BUILD_TYPE }}-conan-profile=${{ hashFiles(env.CONAN_PROFILE_DEFAULT) }}-ck=${{ secrets.CACHE_KEY }}-cmakelists=${{ hashFiles('CMakeLists.txt', 'src/*/CMakeLists.txt', '*/CMakeLists.txt') }}
restore-keys: |
ccache-${{ matrix.os }}-build=${{ env.BUILD_TYPE }}-conan-profile=${{ hashFiles(env.CONAN_PROFILE_DEFAULT) }}-ck=${{ secrets.CACHE_KEY }}-
- name: Did restoring the CCache-cache work? Yes
# If the SDK wasn't found in the cache
if: steps.cacheccache.outputs.cache-hit == 'true'
shell: bash
run: |
ccache --show-stats -vv || ccache --show-stats
ccache --zero-stats
- name: Setup Conan Cache
uses: actions/cache@v4
id: cacheconan
if: ${{ !matrix.SELF_HOSTED }}
with:
path: |
${{ env.CONAN_USER_HOME }}
key: conan-cache-${{ matrix.os }}-build=${{ env.BUILD_TYPE }}-conan-profile=${{ hashFiles(env.CONAN_PROFILE_DEFAULT) }}-conaninstall=${{ hashFiles('./conanfile.py') }}-ck=${{ secrets.CACHE_KEY }}
restore-keys: |
conan-cache-${{ matrix.os }}-build=${{ env.BUILD_TYPE }}-conan-profile=${{ hashFiles(env.CONAN_PROFILE_DEFAULT) }}-conaninstall=${{ hashFiles('./conanfile.py') }}-
conan-cache-${{ matrix.os }}-build=${{ env.BUILD_TYPE }}-conan-profile=${{ hashFiles(env.CONAN_PROFILE_DEFAULT) }}-
conan-cache-${{ matrix.os }}-build=${{ env.BUILD_TYPE }}-
- name: Did restoring the conan-cache work? Yes
# If the SDK wasn't found in the cache
if: steps.cacheconan.outputs.cache-hit == 'true'
working-directory: ${{ env.CONAN_USER_HOME }}
shell: bash
run: |
set -x
set +e
cat $CONAN_PROFILE_DEFAULT
ls $CONAN_HOME
ls $CONAN_USER_HOME/.conan-download-cache
cat $CONAN_HOME/global.conf
ls $CONAN_USER_HOME/short
conan config show core.download:download_cache
conan config show core.sources:download_cache
exit 0
# This includes the Qt install, the OpenStudio SDK tar.gz,
# TODO: problem is that caching the entire build dir is limited to 10 GB. The build folder takes 3-4 GB per runner, and we have 4 of them that try to cache
# Perhaps we should just cache the ccache. Anyways, for incremental builds triggered one after another, cache eviction hasn't happened yet and all of them do a cache hit
- name: Cache Qt and SDK
id: cachebuild
if: ${{ !matrix.SELF_HOSTED }}
uses: actions/cache@v3
with:
path: |
build/Qt-install
build/OpenStudio-${{ env.OS_SDK_VERSION }}
key: minimal-build-cache-${{ matrix.os }}-build=${{ env.BUILD_TYPE }}-qt=${{ env.QT_VERSION }}-conan-profile=${{ hashFiles(env.CONAN_PROFILE_DEFAULT)}}-ck=${{ secrets.CACHE_KEY }}
- name: Did restoring the build-cache work? Yes
# If it was found in the cache, list files, and Delete the packages already produced
if: steps.cachebuild.outputs.cache-hit == 'true'
shell: bash
run: |
set -x
ls build/ || true
cat build/CMakeCache.txt || true
/bin/rm build/OpenStudioApplication-*${{ env.PLATFORM_NAME }}* || true
ls build/ || true
# Delete the archived OS SDK if not the expected version
if [ -d "build/OpenStudio-$OS_SDK_VERSION" ]; then
cd build/OpenStudio-$OS_SDK_VERSION
ls
ls $OS_SDK_INSTALLER_NAME* || rm -Rf ./*
fi
- name: Install Qt
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
shell: bash
if: ${{ !matrix.SELF_HOSTED }}
run: |
set -x
cmake -E make_directory ./build
if [ "$RUNNER_OS" == "Windows" ]; then
# QT_INSTALL_DIR="$(pwd)/build/Qt-install/$QT_VERSION/msvc2019_64"
QT_INSTALL_DIR="$(cmd.exe //c cd)\build\Qt-install\${{ env.QT_VERSION }}\msvc2019_64"
elif [ "$RUNNER_OS" == "macOS" ]; then
QT_INSTALL_DIR="$(pwd)/build/Qt-install/$QT_VERSION/macos"
else
QT_INSTALL_DIR="$(pwd)/build/Qt-install/$QT_VERSION/${{ matrix.QT_ARCH }}"
fi
if [ -d "$QT_INSTALL_DIR" ]; then
echo "Qt $QT_VERSION already installed"
else
echo "Install aqtinstall, then install Qt $QT_VERSION for ${{ matrix.QT_OS_NAME }} ${{ matrix.QT_ARCH }}"
pip show setuptools
pip install setuptools --upgrade
pip3 install aqtinstall
aqt install-qt --outputdir ./build/Qt-install/ ${{ matrix.QT_OS_NAME }} desktop $QT_VERSION ${{ matrix.QT_ARCH }} -m qtwebchannel qtwebengine qtwebview qt5compat qtpositioning qtcharts
fi
echo "$QT_INSTALL_DIR/bin" >> $GITHUB_PATH
echo QT_INSTALL_DIR=$QT_INSTALL_DIR >> $GITHUB_ENV
#ls ./build/Qt-install/$QT_VERSION/
#ls $QT_INSTALL_DIR || true
#ls $QT_INSTALL_DIR/lib || true
#ls $QT_INSTALL_DIR/lib/cmake || true
find ./build/Qt-install -name "*.cmake"
#ls $QT_INSTALL_DIR/translations || true
#ls $QT_INSTALL_DIR/translations/qtwebengine_locales || true
find ./build/Qt-install . -name "*.qm"
find ./build/Qt-install . -name "*.pak"
- name: Find Qt (Self-Hosted)
shell: bash
if: ${{ matrix.SELF_HOSTED }}
run: |
set -x
cmake -E rm -rf ./build
cmake -E make_directory ./build
if [ "$RUNNER_OS" == "macOS" ]; then
QT_INSTALL_DIR="/Users/irvinemac/Qt/$QT_VERSION/macos/"
fi
echo "$QT_INSTALL_DIR/bin" >> $GITHUB_PATH
echo QT_INSTALL_DIR=$QT_INSTALL_DIR >> $GITHUB_ENV
#ls ./build/Qt-install/$QT_VERSION/
#ls $QT_INSTALL_DIR || true
#ls $QT_INSTALL_DIR/lib || true
#ls $QT_INSTALL_DIR/lib/cmake || true
find $QT_INSTALL_DIR -name "*.cmake"
#ls $QT_INSTALL_DIR/translations || true
#ls $QT_INSTALL_DIR/translations/qtwebengine_locales || true
find $QT_INSTALL_DIR . -name "*.qm"
find $QT_INSTALL_DIR . -name "*.pak"
- name: Configure CMake & build (Windows)
if: runner.os == 'Windows'
shell: cmd
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
# NOTE: If you re-enable 'Download the OpenStudio installer' step, then pass `openstudio_DIR=$openstudio_DIR cmake [etc]`
run: |
conan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release
call ./build/conanbuild.bat
cmake --preset conan-release -DQT_INSTALL_DIR:PATH=${{ env.QT_INSTALL_DIR }} ^
-DBUILD_DOCUMENTATION:BOOL=${{ env.BUILD_DOCUMENTATION }} ^
-DBUILD_PACKAGE:BOOL=${{ env.BUILD_PACKAGE }} ^
-DCPACK_BINARY_ZIP:BOOL=ON ^
-DANALYTICS_API_SECRET:STRING=${{ secrets.ANALYTICS_API_SECRET }} ^
-DANALYTICS_MEASUREMENT_ID:STRING=${{ secrets.ANALYTICS_MEASUREMENT_ID }}
cmake --build --preset conan-release --target package
# Delete conan build and source folders
conan cache clean --source --build --download --temp
ccache --show-stats -vv || ccache --show-stats || true
# Debug CPack:
# "C:\Program Files\CMake\bin\cpack.exe" --debug --verbose --config CPackConfig.cmake
- name: Configure CMake (Unix)
if: runner.os != 'Windows'
shell: bash
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
# NOTE: If you re-enable 'Download the OpenStudio installer' step, then pass `openstudio_DIR=$openstudio_DIR cmake [etc]`
run: |
set -x
if [ "$RUNNER_OS" == "macOS" ]; then
# Avoid "builtin __has_nothrow_assign is deprecated; use __is_nothrow_assignable instead" in boost/1.78 with recent clang
conan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release -c tools.build:cxxflags="['-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']"
else
conan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release
fi
if [ "$RUNNER_OS" == "macOS" ]; then
cmake --preset conan-release -DQT_INSTALL_DIR:PATH=${{ env.QT_INSTALL_DIR }} \
-DBUILD_DOCUMENTATION:BOOL=${{ env.BUILD_DOCUMENTATION }} \
-DBUILD_PACKAGE:BOOL=${{ env.BUILD_PACKAGE }} \
-DCPACK_BINARY_TGZ:BOOL=ON \
-DANALYTICS_API_SECRET:STRING=${{ secrets.ANALYTICS_API_SECRET }} \
-DANALYTICS_MEASUREMENT_ID:STRING=${{ secrets.ANALYTICS_MEASUREMENT_ID }} \
-DCPACK_CODESIGNING_DEVELOPPER_ID_APPLICATION:STRING="Developer ID Application: The Energy Coalition (UG9S5ZLM34)" \
-DCPACK_CODESIGNING_NOTARY_PROFILE_NAME:STRING=OpenStudioApplication \
-DCPACK_CODESIGNING_MACOS_IDENTIFIER:STRING=org.openstudiocoalition.OpenStudioApplication
else
cmake --preset conan-release -DQT_INSTALL_DIR:PATH=${{ env.QT_INSTALL_DIR }} \
-DBUILD_DOCUMENTATION:BOOL=${{ env.BUILD_DOCUMENTATION }} \
-DBUILD_PACKAGE:BOOL=${{ env.BUILD_PACKAGE }} \
-DCPACK_BINARY_TGZ:BOOL=ON \
-DANALYTICS_API_SECRET:STRING=${{ secrets.ANALYTICS_API_SECRET }} \
-DANALYTICS_MEASUREMENT_ID:STRING=${{ secrets.ANALYTICS_MEASUREMENT_ID }}
fi;
cmake --build --preset conan-release --target package
# Delete conan build and source folders
conan cache clean --source --build --download --temp
ccache --show-stats -vv || ccache --show-stats || true
- name: Test bed Sign inner portable executable files and exe package (Windows)
working-directory: ./build
if: runner.os == 'Windows'
shell: powershell
run: |
$installer_exe = Get-ChildItem -Filter "${{ matrix.BINARY_PKG_PATH }}/*.${{ env.BINARY_EXT }}" -File | Select-Object -First 1 | % { $_.FullName}
echo $installer_exe
echo "$installer_exe"
- name: Sign inner portable executable files and exe package (Windows)
working-directory: ./build
if: contains(github.ref, 'refs/tags') && (runner.os == 'Windows')
shell: powershell
run: |
# Install signpath
Install-Module -Name SignPath -Force
# Sign the OpenStudioApp.exe, put the signed version in place
Submit-SigningRequest `
-InputArtifactPath "Products/OpenStudioApp.exe" `
-CIUserToken "${{ secrets.SIGNPATH_CI_TOKEN }}" `
-OrganizationId "97f757f1-cd69-467b-b87b-db3eb5102a57" `
-ProjectSlug "OpenStudioApplication" `
-SigningPolicySlug "No_Approval_Release_GHA" `
-OutputArtifactPath "Products/OpenStudioApp.exe" `
-WaitForCompletion -Force
# Repackage
cpack
# Sign the .exe installer as well
$installer_exe = Get-ChildItem -Filter "${{ matrix.BINARY_PKG_PATH }}/*.${{ env.BINARY_EXT }}" -File | Select-Object -First 1 | % { $_.FullName}
Submit-SigningRequest `
-InputArtifactPath "$installer_exe" `
-CIUserToken "${{ secrets.SIGNPATH_CI_TOKEN }}" `
-OrganizationId "97f757f1-cd69-467b-b87b-db3eb5102a57" `
-ProjectSlug "OpenStudioApplication" `
-SigningPolicySlug "No_Approval_Release_GHA" `
-OutputArtifactPath "$installer_exe" `
-WaitForCompletion -Force
- name: Archive binary artifacts
uses: actions/upload-artifact@v4
# build/_CPack_Packages/win64/IFW/*.exe
# build/_CPack_Packages/Linux/DEB/*.deb
# build/_CPack_Packages/Darwin/IFW/*.dmg
with:
name: OpenStudioApplication-${{ env.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.os }}.${{ env.BINARY_EXT }}
path: build/${{ matrix.BINARY_PKG_PATH }}/*.${{ env.BINARY_EXT }}
- name: Archive TGZ or ZIP artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStudioApplication-${{ env.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.os }}.${{ env.COMPRESSED_EXT }}
path: build/${{ matrix.COMPRESSED_PKG_PATH }}/*.${{ env.COMPRESSED_EXT }}
- name: Full Test Package signing for IFW and TGZ
if: runner.os == 'macOS'
working-directory: ./build
shell: bash
run: |
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
begin_group "Full Check signature of _CPack_Packages for both IFW and TGZ"
python ../developer/python/verify_signature.py --verbose --only-generator IFW .
python ../developer/python/verify_signature.py --otool --otool-out-file otool_infos_cpack_tgz.json --verbose --only-generator TGZ .
echo "::endgroup::"
- name: Upload otool info as artifact
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: otool_infos_cpack_${{ matrix.os }}_${{ matrix.arch }}
path: build/otool*json
if-no-files-found: error
- name: Test
working-directory: ./build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
automationmodetool
export XVFBCMD=""
elif [ "$RUNNER_OS" == "Windows" ]; then
export XVFBCMD=""
else
export XVFBCMD="xvfb-run"
fi
$XVFBCMD ctest -j -T test --output-on-failure --no-compress-output -C $BUILD_TYPE || true
- name: Archive test results?
uses: actions/upload-artifact@v4
with:
name: OpenStudioApplication-${{ env.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.os }}-Test.xml
path: build/Testing/**/*.xml
- name: Benchmark
working-directory: ./build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
automationmodetool
export XVFBCMD=""
elif [ "$RUNNER_OS" == "Windows" ]; then
export XVFBCMD=""
else
export XVFBCMD="xvfb-run"
fi
$XVFBCMD Products/SpacesSurfaces_Benchmark --benchmark_out_format=csv --benchmark_out='bench_results_SpacesSurfaces.csv' || true
- name: Archive benchmark results?
uses: actions/upload-artifact@v4
with:
name: OpenStudioApplication-${{ env.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.os }}-bench_results.csv
path: build/bench_results_*.csv
- name: Upload Binary installer to release
if: contains(github.ref, 'refs/tags')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/${{ matrix.BINARY_PKG_PATH }}/*.${{ env.BINARY_EXT }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload TGZ or ZIP to release
if: contains(github.ref, 'refs/tags')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/${{ matrix.COMPRESSED_PKG_PATH }}/*.${{ env.COMPRESSED_EXT }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Delete binary packages
working-directory: ./build/
shell: bash
run: |
ls OpenStudioApplication-*
/bin/rm OpenStudioApplication-*${{ env.COMPRESSED_EXT }} || true
/bin/rm OpenStudioApplication-*${{ env.BINARY_EXT }} || true
ls OpenStudioApplication-* || true
test_package_macos:
name: Test Built Package on macOS
needs: build
runs-on: ${{ matrix.os }}
strategy:
# fail-fast: Default is true, switch to false to allow one platform to fail and still run others
fail-fast: false
matrix:
os: [macos-13, macos-14]
include:
- os: macos-13
binary_os: macos-13
SELF_HOSTED: false
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
arch: x86_64
# This is the GHA hosted one
- os: macos-14
binary_os: macos-arm64
SELF_HOSTED: false
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
arch: arm64
steps:
- uses: actions/checkout@v4 # Still need code checked out to get testing scripts
with:
path: checkout
#- name: Gather Test Package from Artifacts
# uses: actions/download-artifact@v4
# with:
# name: OpenStudioApplication-${{ needs.build.outputs.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.binary_os }}.${{ matrix.COMPRESSED_EXT }}
# path: package
- name: Gather Dmg Package from Artifacts
uses: actions/download-artifact@v4
with:
name: OpenStudioApplication-${{ needs.build.outputs.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.binary_os }}.${{ matrix.BINARY_EXT }}
path: dmg
- name: Test Dmg Install and Package signing
working-directory: ./dmg
shell: bash
run: |
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
set -x
dmg=$(ls OpenStudioApplication-*.dmg)
begin_group "Checking Signature of .dmg"
spctl --assess --type open --context context:primary-signature -vvvv $dmg
echo "::endgroup::"
begin_group "Mounting Dmg, and checking signature of installer app"
mkdir temp_mount
hdiutil attach -mountpoint ./temp_mount/ $dmg
filename="${dmg%.*}"
spctl --assess --type open --context context:primary-signature -vvvv ./temp_mount/$filename.app
echo "::endgroup::"
begin_group "Installing"
sudo ./temp_mount/$filename.app/Contents/MacOS/$filename --accept-licenses --default-answer --confirm-command --root $(pwd)/test_install install
echo "::endgroup::"
begin_group "Quick Check signature of inner executables and binaries"
codesign -dvvv ./test_install/lib/libopenstudiolib.dylib
codesign -dvvv ./test_install/lib/libpythonengine.so
codesign -dvvv ./test_install/lib/librubyengine.so
codesign -dvvv ./test_install/EnergyPlus/energyplus
codesign -dvvv ./test_install/EnergyPlus/libenergyplusapi.dylib
codesign -dvvv ./test_install/EnergyPlus/libpython*.dylib
codesign -dvvv ./test_install/EnergyPlus/ExpandObjects
echo "::endgroup::"
begin_group "Full Check signature of installed DMG for all executables and resolve otool libraries"
python ../checkout/developer/python/verify_signature.py --otool --otool-out-file otool_info_dmg.json --verbose --install test_install
echo "::endgroup::"
begin_group "Running a simulation with python"
./test_install/EnergyPlus/energyplus --help
cur_v=$(python -c "import sys; sys.path.insert(0, './test_install/EnergyPlus'); from pyenergyplus.func import EnergyPlusVersion; v = EnergyPlusVersion(); print(f'{v.ep_version_major}.{v.ep_version_minor}.{v.ep_version_patch}')")
aria2c https://raw.githubusercontent.com/NREL/EnergyPlus/v${cur_v}/testfiles/PythonPluginCustomSchedule.py
aria2c https://raw.githubusercontent.com/NREL/EnergyPlus/v${cur_v}/testfiles/PythonPluginCustomSchedule.idf
aria2c https://raw.githubusercontent.com/NREL/EnergyPlus/v${cur_v}/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw
./test_install/EnergyPlus/energyplus -w USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw -d out PythonPluginCustomSchedule.idf
echo "::endgroup::"
hdiutil detach ./temp_mount/
- name: Upload otool info as artifact
uses: actions/upload-artifact@v4
with:
name: otool_info_dmg_${{ matrix.os }}_${{ matrix.arch }}
path: dmg/otool*json
if-no-files-found: error