-
Notifications
You must be signed in to change notification settings - Fork 25
760 lines (681 loc) · 33 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
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 ]
env:
BUILD_TYPE: Release
BUILD_DOCUMENTATION: OFF
BUILD_TESTING: ON
BUILD_BENCHMARK: ON
BUILD_PACKAGE: ON
CPACK_BINARY_NSIS: OFF
CPACK_BINARY_RPM: OFF
CPACK_BINARY_STGZ: OFF
CPACK_BINARY_TBZ2: OFF
CPACK_BINARY_TGZ: ON
CPACK_BINARY_TXZ: OFF
CPACK_BINARY_TZ: OFF
CPACK_SOURCE_RPM: OFF
CPACK_SOURCE_TBZ2: OFF
CPACK_SOURCE_TGZ: OFF
CPACK_SOURCE_TXZ: OFF
CPACK_SOURCE_TZ: OFF
CPACK_SOURCE_ZIP: OFF
QT_VERSION: 6.3.0
# CPACK_BINARY_DEB: OS-SPECIFIC
# CPACK_BINARY_IFW: OS-SPECIFIC
jobs:
build:
# Note: as of 2021-01-29, this only works for push, not for pull request
# if: "!(contains(github.event.head_commit.message, 'skip') && contains(github.event.head_commit.message, 'ci'))"
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow_failure }}
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-20.04, ubuntu-22.04, windows-2022, macos-12, macos-arm64]
include:
- os: ubuntu-20.04
allow_failure: true
SELF_HOSTED: false
PLATFORM_NAME: Linux
CPACK_BINARY_DEB: ON
CPACK_BINARY_IFW: OFF
CPACK_BINARY_TGZ: ON
CPACK_BINARY_ZIP: OFF
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
- os: ubuntu-22.04
allow_failure: true
SELF_HOSTED: false
PLATFORM_NAME: Linux
CPACK_BINARY_DEB: ON
CPACK_BINARY_IFW: OFF
CPACK_BINARY_TGZ: ON
CPACK_BINARY_ZIP: OFF
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
- os: windows-2022
allow_failure: false
SELF_HOSTED: false
PLATFORM_NAME: Windows
CPACK_BINARY_DEB: OFF
CPACK_BINARY_IFW: ON
CPACK_BINARY_TGZ: OFF
CPACK_BINARY_ZIP: ON
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
- os: macos-12
allow_failure: false
SELF_HOSTED: false
PLATFORM_NAME: Darwin
CPACK_BINARY_DEB: OFF
CPACK_BINARY_IFW: ON
CPACK_BINARY_TGZ: OFF
CPACK_BINARY_ZIP: OFF
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 10.15
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: clang_64
- os: macos-arm64
allow_failure: false
SELF_HOSTED: true
PLATFORM_NAME: Darwin
CPACK_BINARY_DEB: OFF
CPACK_BINARY_IFW: ON
CPACK_BINARY_TGZ: ON
CPACK_BINARY_ZIP: OFF
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 12.1
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: arm_64
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
if: ${{!matrix.SELF_HOSTED}}
with:
python-version: '3.8.x'
- uses: ruby/setup-ruby@v1
if: ${{!matrix.SELF_HOSTED}}
with:
ruby-version: 2.7
- name: Extract OSApp version from CMakeLists.txt
shell: python
run: |
import re
with open('CMakeLists.txt', 'r') as f:
content = f.read()
m = re.search('project\(OpenStudioApplication VERSION (\d+\.\d+\.\d+)\)', content)
version='X.Y.Z'
if m:
version = m.groups()[0]
with open('version.txt', 'w') as f:
f.write(version)
- name: Extract OS SDK version from FindOpenStudioSDK.cmake
shell: python
run: |
import re
import os
import urllib.parse as ul
with open('FindOpenStudioSDK.cmake', 'r') as f:
content = f.read()
no_comments_lines = []
for line in content.splitlines():
l = line.strip().split('#')[0]
if l:
no_comments_lines.append(l)
content = "\n".join(no_comments_lines)
m_major = re.search(r'set\(OPENSTUDIO_VERSION_MAJOR (\d+)\)', content)
m_minor = re.search(r'set\(OPENSTUDIO_VERSION_MINOR (\d+)\)', content)
m_patch = re.search(r'set\(OPENSTUDIO_VERSION_PATCH (\d+)\)', content)
m_sha = re.search(r'set\(OPENSTUDIO_VERSION_SHA "(.*?)"\)', content)
sdk_version = ''
if m_major:
OS_SDK_VERSION_MAJOR = m_major.groups()[0]
sdk_version += OS_SDK_VERSION_MAJOR
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_VERSION_MAJOR={OS_SDK_VERSION_MAJOR}")
print(f"\n{OS_SDK_VERSION_MAJOR=}")
else:
print("Unable to find OPENSTUDIO_VERSION_MAJOR")
sdk_version += 'X'
sdk_version += '.'
if m_minor:
OS_SDK_VERSION_MINOR = m_minor.groups()[0]
sdk_version += OS_SDK_VERSION_MINOR
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_VERSION_MINOR={OS_SDK_VERSION_MINOR}")
print(f"\n{OS_SDK_VERSION_MINOR=}")
else:
print("Unable to find OPENSTUDIO_VERSION_MINOR")
sdk_version += 'Y'
sdk_version += '.'
if m_patch:
OS_SDK_VERSION_PATCH = m_patch.groups()[0]
sdk_version += OS_SDK_VERSION_PATCH
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_VERSION_PATCH={OS_SDK_VERSION_PATCH}")
print(f"\n{OS_SDK_VERSION_PATCH=}")
else:
print("Unable to find OPENSTUDIO_VERSION_PATCH")
sdk_version += 'Z'
if m_sha:
OS_SDK_VERSION_SHA = m_sha.groups()[0]
# NOT ADDING IT to sdk_version
# sdk_version += OS_SDK_VERSION_SHA
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_VERSION_SHA={OS_SDK_VERSION_SHA}")
print(f"{OS_SDK_VERSION_SHA=}")
else:
print("Unable to find OPENSTUDIO_VERSION_SHA")
OS_SDK_VERSION = sdk_version
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_VERSION={OS_SDK_VERSION}")
print(f"{OS_SDK_VERSION=}")
with open('sdk_version.txt', 'a') as f:
f.write(sdk_version)
m_baselink = re.search(r'set\(OPENSTUDIO_BASELINK_RELEASE "(http.*?)"', content)
if m_baselink:
OS_SDK_BASELINK = m_baselink.groups()[0].replace('${OPENSTUDIO_VERSION}', sdk_version)
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_BASELINK={OS_SDK_BASELINK}")
print(f"Found baselink '{OS_SDK_BASELINK=}'")
else:
print("Unable to find OPENSTUDIO_BASELINK_RELEASE")
OS_SDK_BASELINK = f"https://github.com/NREL/OpenStudio/releases/download/v{sdk_version}{OS_SDK_VERSION_SHA.split('+')[0]}"
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_BASELINK={OS_SDK_BASELINK}")
print(f"Defaulted baselink '{OS_SDK_BASELINK=}'")
links = re.findall(r'"(https?:\/\/openstudio-ci-builds.*?)"', content)
links = [link.replace('${OPENSTUDIO_VERSION}', sdk_version) for link in links]
if len(links) > 0:
OS_SDK_ALTERNATE_LINK_1 = links[0]
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_ALTERNATE_LINK_1={OS_SDK_ALTERNATE_LINK_1}")
print(f"Alternate link '{OS_SDK_ALTERNATE_LINK_1=}'")
OS_SDK_INSTALLER_NAME = ul.quote_plus(f"OpenStudio-{sdk_version}{OS_SDK_VERSION_SHA}-Linux.deb")
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f"\nOS_SDK_INSTALLER_NAME={OS_SDK_INSTALLER_NAME}")
print(f"{OS_SDK_INSTALLER_NAME=}")
- 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: |
OS_APP_VERSION=$(cat version.txt)
echo OS_APP_VERSION=$OS_APP_VERSION >> $GITHUB_ENV
echo PLATFORM_NAME=${{ matrix.PLATFORM_NAME }} >> $GITHUB_ENV
echo CPACK_BINARY_DEB=${{ matrix.CPACK_BINARY_DEB }} >> $GITHUB_ENV
echo CPACK_BINARY_IFW=${{ matrix.CPACK_BINARY_IFW }} >> $GITHUB_ENV
echo CPACK_BINARY_ZIP=${{ matrix.CPACK_BINARY_ZIP }} >> $GITHUB_ENV
echo CPACK_BINARY_TGZ=${{ matrix.CPACK_BINARY_TGZ }} >> $GITHUB_ENV
echo BINARY_EXT=${{ matrix.BINARY_EXT }} >> $GITHUB_ENV
echo COMPRESSED_EXT=${{ matrix.COMPRESSED_EXT }} >> $GITHUB_ENV
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
sudo apt install -y mesa-common-dev libglu1-mesa-dev patchelf ninja-build libxkbcommon-x11-dev libgl1-mesa-dev chrpath
# Weirdly enough, ninja makes ubuntu unresponsive...
echo CMAKE_GENERATOR='Ninja' >> $GITHUB_ENV
gcc --version
elif [ "$RUNNER_OS" == "Windows" ]; then
curl -L -O https://download.qt.io/official_releases/qt-installer-framework/4.3.0/QtInstallerFramework-windows-x86-4.3.0.exe
./QtInstallerFramework-windows-x86-4.3.0.exe --verbose --script ./ci/install_script_qtifw.qs
dir "C:/Qt/"
echo "C:/Qt/QtIFW-4.3.0/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
# 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
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
# The MACOSX_DEPLOYMENT_TARGET environment variable sets the default value for the CMAKE_OSX_DEPLOYMENT_TARGET variable.
# 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 "Using brew to install ninja"
brew install ninja
echo CMAKE_GENERATOR='Ninja' >> $GITHUB_ENV
brew install md5sha1sum
# 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
echo "Installing IFW"
curl -L -O https://download.qt.io/official_releases/qt-installer-framework/4.3.0/QtInstallerFramework-macOS-x64-4.3.0.dmg
hdiutil attach -mountpoint ./qtfiw_installer QtInstallerFramework-macOS-x64-4.3.0.dmg
echo "ls ./qtfiw_installer"
ls ./qtfiw_installer
echo "ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/"
ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/
echo "ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/"
ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/
echo "ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/MacOS"
ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/MacOS
echo "ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/Resources"
ls ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/Resources
sudo ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/MacOS/QtInstallerFramework-macOS-x64-4.3.0 --verbose --script ./ci/install_script_qtifw.qs
ls ~
ls ~/Qt/ || true
ls ~/Qt/QtIFW-4.3.0 || true
echo "~/Qt/QtIFW-4.3.0/bin/" >> $GITHUB_PATH
fi;
fi;
CONAN_INSTALL_MD5=$(md5sum ConanInstall.cmake | awk '{print $1}')
echo CONAN_INSTALL_MD5=$CONAN_INSTALL_MD5 >> $GITHUB_ENV
cmake --version
- name: Cache entire build directory
id: cachebuild
if: ${{ !matrix.SELF_HOSTED }}
uses: actions/cache@v3
with:
path: build/
key: ${{ matrix.os }}-build-cache-v1-${{ secrets.CACHE_KEY }}
- name: Did restoring the build-cache work? No
# If the build cache wasn't found in the cache
if: steps.cachebuild.outputs.cache-hit != 'true'
run: |
echo "Build cache not found"
- 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: |
ls build/ || true
cat build/CMakeCache.txt || true
/bin/rm build/OpenStudioApplication-*${{ env.PLATFORM_NAME }}* || true
ls build/ || true
- name: Cache OpenStudio tar.gz
id: cacheossdk
# To avoid downloading the SDK all the time, we try to cache it.
# The path matches both what FindOpenStudioSDK.cmake does and what the 'Download the OpenStudio installer' used to do
# If the build cache wasn't found in the cache (otherwise it will have the SDK subfolder already so this is pointless)"
if: ${{!matrix.SELF_HOSTED && steps.cachebuild.outputs.cache-hit != 'true'}}
uses: actions/cache@v3
with:
path: OpenStudio-${{ env.OS_SDK_VERSION }}
key: OpenStudio-SDK-${{ matrix.os }}-${{ env.OS_SDK_VERSION }}-${{ secrets.CACHE_KEY }}
- name: Did restoring the build-cache or OpenStudioSDK cache work? Yes
# If it wasn't found in the cache
if: ${{steps.cachebuild.outputs.cache-hit == 'true' || steps.cacheossdk.outputs.cache-hit == true}}
continue-on-error: true
run: |
ls build/ || true
ls build/OpenStudio-${{ env.OS_SDK_VERSION }} || true
ls build/Qt-install/ || true
# NOTE JM 2020-09-01: we're going to rely on FindOpenStudioSDK.cmake for now, but it's not impossible we'll need this in the future
# This step in conjuction with the step 'Create Build Environment and locate openstudio', and a small modification in 'Configure CMake' step
#
# - name: Download the OpenStudio installer
# # If the SDK wasn't found in the cache
# if: steps.cacheossdk.outputs.cache-hit != 'true'
# # Use a bash shell so we can use the same syntax for environment variable
# # access regardless of the host operating system
# # Note: wget not available on windows, even in bash, so use curl
# shell: bash
# run: |
# curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/NREL/OpenStudio/releases/tags/v$OS_SDK_VERSION > os_tag.json
# echo "PLATFORM_NAME=${{ env.PLATFORM_NAME }}"
# cat os_tag.json
# tar_gz_link=$(cat os_tag.json | jq -r '.assets | .[] | select(.name | contains("${{ env.PLATFORM_NAME }}")) | select(.name | contains("tar.gz")) | .browser_download_url')
# if [ -z "$tar_gz_link" ]; then
# echo "Could not locate the OpenStudio tar.gz for OS_SDK_VERSION=$OS_SDK_VERSION and PLATFORM_NAME=$PLATFORM_NAME"
# exit 1;
# fi;
# tar_gz_name=$(basename -- $tar_gz_link)
# tar_gz_name=$(python -c "import sys, urllib.parse as ul; print(ul.unquote_plus(\"$tar_gz_name\"))")
# echo "Downloading $tar_gz_link"
# echo "Normally, tar_gz_name=$tar_gz_name"
# curl -L --output "$tar_gz_name" "$tar_gz_link"
# ls
# ls -la $tar_gz_name
# echo "Extract this into the OpenStudio-$OS_SDK_VERSION directory, omitting the first directory level in the tar.gz"
# echo "This isn't working, so use cmake to tar, then rename"
# echo "tar xfz $tar_gz_name --strip-components 1 -C OpenStudio-$OS_SDK_VERSION"
# echo "cmake -E make_directory OpenStudio-$OS_SDK_VERSION"
# folder_name=${tar_gz_name%.tar.gz}
# echo "folder_name=$folder_name"
# cmake -E tar xfz "$tar_gz_name"
# cmake -E rename "$folder_name" "OpenStudio-$OS_SDK_VERSION"
- name: Install conan
run: |
python --version
pip install conan==1.59.0
conan --version
echo "Enabling conan revisions and setting parallel_download"
conan config set general.revisions_enabled=True
conan config set general.parallel_download=8
# DLM: skip caching conan, causing too many problems
#- name: Cache conan cache?
# # To avoid downloading the SDK all the time, we try to cache it
# id: cacheconan
# uses: actions/cache@v3
# with:
# path: |
# ~/.conan
# key: ${{ matrix.os }}-conan-cache-${{ env.CONAN_INSTALL_MD5 }}-${{ secrets.CACHE_KEY }}
- name: Did restoring the conan-cache work? No
# If the SDK wasn't found in the cache
#if: steps.cacheconan.outputs.cache-hit != 'true'
run: |
echo "Conan cache not found"
echo "Create the conan data directory"
conan user
#- name: Did restoring the conan-cache work? Yes
# # If the SDK wasn't found in the cache
# if: steps.cacheconan.outputs.cache-hit == 'true'
# run: |
# ls ~/.conan/
# ls ~/.conan/data/
- 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
rm -rf $QT_INSTALL_DIR
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 }}"
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
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 make_directory ./build
if [ "$RUNNER_OS" == "macOS" ]; then
QT_INSTALL_DIR="/Users/irvinemac/Qt/6.3.0/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: Cache Qt dep cache?
## To avoid downloading the Qt dependency all the time, we try to cache it
#id: cacheqt
#uses: actions/cache@v3
#with:
#path: build/qt_5_11_*.tar.gz
#key: ${{ matrix.os }}-qt-5-11-cache
#- name: Did restoring the qt cache work?
## If the SDK wasn't found in the cache
#if: steps.cacheqt.outputs.cache-hit != 'true'
#run: |
#echo "qt tar.gz was not found"
#- name: Cache other dependencies
## Should probably cache the CMake-downloaded Qt at least
#shell: bash
#run: |
#echo "Not implemented yet"
#echo "The more I think about it, the more I think we should cache the entire build/ directory to speed up builds"
#echo "We can use a manual counter in the key so we can effectively wipe the build directory when we want to"
- name: Configure CMake & build (Windows)
if: runner.os == 'Windows'
shell: cmd
working-directory: ./build
# 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: |
echo "Using vcvarsall to initialize the development environment"
call vcvarsall.bat x64
dir
cmake -G Ninja -DQT_INSTALL_DIR:PATH=${{ env.QT_INSTALL_DIR }} -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} ^
-DBUILD_DOCUMENTATION:BOOL=${{ env.BUILD_DOCUMENTATION }} -DBUILD_TESTING:BOOL=${{ env.BUILD_TESTING }} -DBUILD_BENCHMARK:BOOL=${{ env.BUILD_BENCHMARK}} ^
-DBUILD_PACKAGE:BOOL=${{ env.BUILD_PACKAGE }} -DCPACK_BINARY_DEB:BOOL=${{ env.CPACK_BINARY_DEB }} -DCPACK_BINARY_IFW:BOOL=${{ env.CPACK_BINARY_IFW }} ^
-DCPACK_BINARY_NSIS:BOOL=${{ env.CPACK_BINARY_NSIS }} -DCPACK_BINARY_RPM:BOOL=${{ env.CPACK_BINARY_RPM }} -DCPACK_BINARY_STGZ:BOOL=${{ env.CPACK_BINARY_STGZ }} ^
-DCPACK_BINARY_TBZ2:BOOL=${{ env.CPACK_BINARY_TBZ2 }} -DCPACK_BINARY_TGZ:BOOL=${{ env.CPACK_BINARY_TGZ }} -DCPACK_BINARY_ZIP:BOOL=${{ env.CPACK_BINARY_ZIP }} ^
-DCPACK_BINARY_TXZ:BOOL=${{ env.CPACK_BINARY_TXZ }} -DCPACK_BINARY_TZ:BOOL=${{ env.CPACK_BINARY_TZ }} -DCPACK_SOURCE_RPM:BOOL=${{ env.CPACK_SOURCE_RPM }} ^
-DCPACK_SOURCE_TBZ2:BOOL=${{ env.CPACK_SOURCE_TBZ2 }} -DCPACK_SOURCE_TGZ:BOOL=${{ env.CPACK_SOURCE_TGZ }} -DCPACK_SOURCE_TXZ:BOOL=${{ env.CPACK_SOURCE_TXZ }} ^
-DCPACK_SOURCE_TZ:BOOL=${{ env.CPACK_SOURCE_TZ }} -DCPACK_SOURCE_ZIP:BOOL=${{ env.CPACK_SOURCE_ZIP }} ^
-DANALYTICS_API_SECRET:STRING=${{secrets.ANALYTICS_API_SECRET }} -DANALYTICS_MEASUREMENT_ID:STRING=${{secrets.ANALYTICS_MEASUREMENT_ID }} ^
../
ninja
ninja package
# Debug CPack:
# "C:\Program Files\CMake\bin\cpack.exe" --debug --verbose --config CPackConfig.cmake
- name: Configure CMake (Unix)
if: runner.os != 'Windows'
shell: bash
working-directory: ./build
# 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
cmake -DQT_INSTALL_DIR:PATH=$QT_INSTALL_DIR -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DBUILD_DOCUMENTATION:BOOL=$DBUILD_DOCUMENTATION -DBUILD_TESTING:BOOL=$BUILD_TESTING -DBUILD_BENCHMARK:BOOL=$BUILD_BENCHMARK \
-DBUILD_PACKAGE:BOOL=$BUILD_PACKAGE -DCPACK_BINARY_DEB:BOOL=$CPACK_BINARY_DEB -DCPACK_BINARY_IFW:BOOL=$CPACK_BINARY_IFW \
-DCPACK_BINARY_NSIS:BOOL=$CPACK_BINARY_NSIS -DCPACK_BINARY_RPM:BOOL=$CPACK_BINARY_RPM -DCPACK_BINARY_STGZ:BOOL=$CPACK_BINARY_STGZ \
-DCPACK_BINARY_TBZ2:BOOL=$CPACK_BINARY_TBZ2 -DCPACK_BINARY_TGZ:BOOL=$CPACK_BINARY_TGZ -DCPACK_BINARY_ZIP:BOOL=$CPACK_BINARY_ZIP \
-DCPACK_BINARY_TXZ:BOOL=$CPACK_BINARY_TXZ -DCPACK_BINARY_TZ:BOOL=$CPACK_BINARY_TZ -DCPACK_SOURCE_RPM:BOOL=$CPACK_SOURCE_RPM \
-DCPACK_SOURCE_TBZ2:BOOL=$CPACK_SOURCE_TBZ2 -DCPACK_SOURCE_TGZ:BOOL=$CPACK_SOURCE_TGZ -DCPACK_SOURCE_TXZ:BOOL=$CPACK_SOURCE_TXZ \
-DCPACK_SOURCE_TZ:BOOL=$CPACK_SOURCE_TZ -DCPACK_SOURCE_ZIP:BOOL=$CPACK_SOURCE_ZIP \
-DANALYTICS_API_SECRET:STRING=${{secrets.ANALYTICS_API_SECRET }} -DANALYTICS_MEASUREMENT_ID:STRING=${{secrets.ANALYTICS_MEASUREMENT_ID }} \
../
# Note: JM 2020-07-22 This is an example of how to get a config log for a failed conan dependency build (no binary available)
# This WILL be handy some day, so leave it here
#- name: upload config.log for failed gdbm build
#if: ${{ failure() }}
#shell: bash
#run: |
#configlog=$(find ~/.conan/data/gdbm/1.18.1/_/_/build -name config.log)
#cat $configlog
#- name: upload config.log for failed gdbm build
#if: ${{ failure() }}
#uses: actions/upload-artifact@v3
#with:
#name: ${{ matrix.os }}-gdbm_config.log
#path: ~/.conan/data/gdbm/1.18.1/_/_/build/**/source_subfolder/config.log
- name: Build (Unix)
working-directory: ./build
if: runner.os != 'Windows'
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
set -x
echo "Building with $N threads"
cmake --build . --target package -j $N --config $BUILD_TYPE
- name: Test bed Sign inner portable executable files and exe package (Windows 2022)
working-directory: ./build
if: (matrix.os == 'windows-2022')
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 2022)
working-directory: ./build
# if: (runner.os == 'Windows')
if: contains(github.ref, 'refs/tags') && (matrix.os == 'windows-2022')
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@v3
# 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 }}
# path: build/_CPack_Packages/*/*/*.${{ env.BINARY_EXT }}
- name: Archive TGZ or ZIP artifacts
uses: actions/upload-artifact@v3
with:
name: OpenStudioApplication-${{ env.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.os }}.${{ env.COMPRESSED_EXT }}
path: build/${{ matrix.COMPRESSED_PKG_PATH }}/*.${{ env.COMPRESSED_EXT }}
- 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: |
Xvfb :99 &
export DISPLAY=:99
ctest -j -T test --output-on-failure --no-compress-output -C $BUILD_TYPE || true
- name: Archive test results?
uses: actions/upload-artifact@v3
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: |
Xvfb :99 &
export DISPLAY=:99
Products/SpacesSurfaces_Benchmark --benchmark_out_format=csv --benchmark_out='bench_results_SpacesSurfaces.csv' || true
- name: Archive benchmark results?
uses: actions/upload-artifact@v3
with:
name: OpenStudioApplication-${{ env.OS_APP_VERSION }}.${{ github.sha }}-${{ matrix.os }}-bench_results.csv
path: build/bench_results_*.csv
#- name: Create a release if triggered by a tag
#id: create_release_tag
#if: contains(github.ref, 'refs/tags')
#uses: actions/[email protected]
#env:
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#with:
#tag_name: ${{ github.ref }}
#release_name: Release ${{ github.ref }}
#body: |
#Release Notes pending
#draft: false
#prerelease: true
#- name: Release Asset Glob
#if: contains(github.ref, 'refs/tags')
#uses: shogo82148/actions-upload-release-asset@v1
#env:
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#with:
#upload_url: ${{ steps.create_release_tag.outputs.upload_url }}
#asset_path: ./OpenStudioApplication-*
- 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