-
Notifications
You must be signed in to change notification settings - Fork 230
1733 lines (1518 loc) · 68.4 KB
/
Copy pathfull-build.yml
File metadata and controls
1733 lines (1518 loc) · 68.4 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
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
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Full Build
on:
push:
branches:
- develop
- master
- os-4.0-dev
tags:
- "v*"
schedule:
# Run nightly at 8 PM ET (midnight UTC during EST, 1 AM UTC during EDT)
# Using 1 AM UTC to cover EDT (daylight saving time)
- cron: '0 1 * * *'
pull_request:
branches:
- develop
- master
- os-4.0-dev
types: [ opened, reopened, synchronize ]
workflow_dispatch:
inputs:
publish_to_s3:
description: "Force S3 publishing even when not on develop"
required: false
default: "false"
skip_docker_trigger:
description: "Skip downstream docker workflow trigger"
required: false
default: "false"
jobs:
description: "Comma-separated list of jobs to run (e.g. 'linux-build,windows-build'). Leave empty to run all."
required: false
default: ""
workflow_call:
inputs:
publish_to_s3:
type: string
required: false
default: "false"
skip_docker_trigger:
type: string
required: false
default: "false"
jobs:
type: string
required: false
default: ""
concurrency:
group: full-build-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
actions: read
checks: write
pull-requests: write
packages: write
id-token: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_TYPE: Release
OPENSTUDIO_BUILD: build
OPENSTUDIO_SOURCE: OpenStudio
PYTHON_REQUIRED_VERSION: "3.12.2"
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
AWS_S3_BUCKET: openstudio-ci-builds
TEST_DASHBOARD_RELATIVE: Testing/dashboard/test-dashboard.md
CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: "true"
CCACHE_COMPRESSLEVEL: "3"
CCACHE_MAXSIZE: "10G"
CCACHE_DEPEND: "true"
CCACHE_NOHASHDIR: "true"
SCCACHE_GHA_ENABLED: "false"
SCCACHE_DIR: "${{ github.workspace }}\\.sccache"
SCCACHE_CACHE_SIZE: "10G"
ENABLE_PCH: ON
jobs:
linux-build:
name: Build ${{ matrix.pretty }}
if: |
(!inputs.jobs || contains(inputs.jobs, 'linux-build')) &&
(github.event_name == 'push' || github.event_name == 'schedule' ||
(github.event_name == 'pull_request' && (github.base_ref == 'develop' || github.base_ref == 'master')))
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.container_image }}
options: ${{ matrix.container_options }} --volume /mnt:/mnt
strategy:
fail-fast: false
matrix:
include:
- platform: centos-9-x64
pretty: CentOS 9 (AlmaLinux) x64
os: ubuntu-22.04
container_image: nrel/openstudio-cmake-tools:almalinux9-main
container_options: "--privileged -u root -e LANG=en_US.UTF-8"
test_suffix: CentOS-9
pip_package: false
docker_trigger: false
upload_globs: |
*.rpm
*OpenStudio*x86_64.tar.gz
cpack_generators: "RPM;TGZ"
max_jobs: 4
exclude_regex: "BCLFixture.RemoteBCLMetaSearchTest"
- platform: ubuntu-2204-x64
pretty: Ubuntu 22.04 x64
os: ubuntu-22.04
container_image: nrel/openstudio-cmake-tools:jammy-main
container_options: "--privileged -u root -e LANG=en_US.UTF-8"
test_suffix: Ubuntu-2204
pip_package: true
docker_trigger: true
upload_globs: |
*.deb
*OpenStudio*x86_64.tar.gz
cpack_generators: "DEB;TGZ"
max_jobs: 3
exclude_regex: "ModelFixture.PythonPluginInstance_NotPYFile"
- platform: ubuntu-2404-x64
pretty: Ubuntu 24.04 x64
os: ubuntu-24.04
container_image: nrel/openstudio-cmake-tools:noble-main
container_options: "--privileged -u root -e LANG=en_US.UTF-8"
test_suffix: Ubuntu-2404
pip_package: false
docker_trigger: false
upload_globs: |
*.deb
*OpenStudio*x86_64.tar.gz
cpack_generators: "DEB;TGZ"
max_jobs: 4
exclude_regex: ""
- platform: ubuntu-2204-arm64
pretty: Ubuntu 22.04 ARM64
os: ubuntu-22.04-arm
container_image: nrel/openstudio-cmake-tools:jammy-main
container_options: "--privileged -u root -e LANG=en_US.UTF-8"
test_suffix: Ubuntu-2204-ARM64
pip_package: false
docker_trigger: false
upload_globs: |
*.deb
*OpenStudio*arm64.tar.gz
cpack_generators: "DEB;TGZ"
max_jobs: 3
# SqlFileFixture.AnnualTotalCosts needed until E+ itself disables ffp-contract on arm64 GCC
exclude_regex: "SqlFileFixture.AnnualTotalCosts|OpenStudioCLI.*test_measure_manager"
- platform: ubuntu-2404-arm64
pretty: Ubuntu 24.04 ARM64
os: ubuntu-24.04-arm
container_image: nrel/openstudio-cmake-tools:noble-main
container_options: "--privileged -u root -e LANG=en_US.UTF-8"
test_suffix: Ubuntu-2404-ARM64
pip_package: false
docker_trigger: false
upload_globs: |
*.deb
*OpenStudio*arm64.tar.gz
cpack_generators: "DEB;TGZ"
max_jobs: 4
# SqlFileFixture.AnnualTotalCosts needed until E+ itself disables ffp-contract on arm64 GCC
exclude_regex: "SqlFileFixture.AnnualTotalCosts|OpenStudioCLI.*test_measure_manager"
defaults:
run:
shell: bash
env:
MAX_BUILD_THREADS: ${{ matrix.max_jobs }}
permissions:
# Needed permission to upload the release asset
contents: write
steps:
- name: Enable Swap and Verify space
run: |
echo "Enabling Swap..."
# Create and enable 8GB swap file to prevent OOM kills
dd if=/dev/zero of=/mnt/swapfile_extra bs=1M count=8192 status=progress
chmod 600 /mnt/swapfile_extra
mkswap /mnt/swapfile_extra
swapon /mnt/swapfile_extra
echo
echo "Memory and swap:"
# Check if free exists before running it, or ignore failure
if command -v free >/dev/null 2>&1; then
free -h
else
echo "free command not available"
fi
echo
swapon --show || true
echo
echo "Available storage:"
df -h || true
echo
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Restore ccache cache
uses: actions/cache@v4
with:
path: ~/.ccache
key: ccache-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }}
restore-keys: |
ccache-${{ matrix.os }}-${{ matrix.platform }}-
- name: Restore Conan cache
uses: actions/cache@v4
with:
path: ~/.conan2
key: conan-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }}
restore-keys: |
conan-${{ matrix.os }}-${{ matrix.platform }}-
- name: Prepare workspace
run: |
# Git safe directory
if command -v git >/dev/null 2>&1; then
git config --global --add safe.directory '*'
fi
# Use /mnt for build and caches to avoid running out of space on root partition
prepare_dir() {
local target=$1
local dest=$2
mkdir -p "$dest"
if [ -d "$target" ] && [ ! -L "$target" ]; then
echo "Moving existing $target to $dest"
cp -a "$target/." "$dest/"
rm -rf "$target"
fi
mkdir -p "$(dirname "$target")"
ln -sfn "$dest" "$target"
}
prepare_dir "$HOME/.ccache" "/mnt/.ccache"
prepare_dir "$HOME/.conan2" "/mnt/.conan2"
if command -v ccache >/dev/null 2>&1; then
ccache -M ${{ env.CCACHE_MAXSIZE }} || true
echo "Configured ccache:"; ccache -s | sed -n '1,10p'
fi
- name: Fix CMake Path (CentOS)
if: matrix.platform == 'centos-9-x64'
run: |
if [ -d /usr/local/cmake/bin ]; then
echo "Adding /usr/local/cmake/bin to PATH"
echo "/usr/local/cmake/bin" >> $GITHUB_PATH
fi
- name: Cache External Dependencies
uses: actions/cache@v4
with:
path: |
${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.tar.gz
${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.zip
${{ env.OPENSTUDIO_BUILD }}/radiance*.tar.gz
${{ env.OPENSTUDIO_BUILD }}/radiance*.zip
${{ env.OPENSTUDIO_BUILD }}/openstudio*gems*.tar.gz
key: external-deps-${{ matrix.os }}-${{ hashFiles('conan.lock') }}
restore-keys: |
external-deps-${{ matrix.os }}-
- name: Restore Generated Embedded Files
uses: actions/cache@v4
with:
path: |
${{ env.OPENSTUDIO_BUILD }}/src/*/embedded_files
${{ env.OPENSTUDIO_BUILD }}/ruby/engine/embedded_files
key: embedded-files-${{ matrix.os }}-${{ hashFiles('resources/**', 'ruby/engine/**', 'src/airflow/**', 'src/energyplus/**', 'src/gbxml/**', 'src/isomodel/**', 'src/model/**', 'src/radiance/**', 'src/sdd/**', 'src/utilities/**') }}
restore-keys: |
embedded-files-${{ matrix.os }}-
- name: Configure Conan remotes
run: |
conan remote remove conancenter || true
conan remote add conancenter https://center2.conan.io
conan remote remove nrel-v2 || true
conan remote add nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2
if [ ! -f "$HOME/.conan2/profiles/default" ]; then
conan profile detect
fi
- name: Install CA Certificates
if: startsWith(matrix.platform, 'ubuntu')
run: |
apt-get update || true
apt-get install -y ca-certificates gnupg wget
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
apt-get update
- name: Conan install
run: |
conan install . \
--output-folder="${{ env.OPENSTUDIO_BUILD }}" \
--build=missing \
-c tools.cmake.cmaketoolchain:generator=Ninja \
-s compiler.cppstd=20 \
-s build_type=${{ env.BUILD_TYPE }}
- name: Locate Ruby
run: |
ruby_path=$(command -v ruby)
echo "SYSTEM_RUBY_PATH=$ruby_path" >> $GITHUB_ENV
- name: Locate Python
run: |
python_path=$(command -v python3)
echo "SYSTEM_PYTHON_PATH=$python_path" >> $GITHUB_ENV
- name: Configure with CMake
run: |
# Use absolute path for ccache to avoid resolution issues in containers with symlinked build dirs
CCACHE_ARGS=()
if command -v ccache >/dev/null 2>&1; then
CCACHE_EXE=$(command -v ccache)
CCACHE_ARGS=("-DCMAKE_C_COMPILER_LAUNCHER=$CCACHE_EXE" "-DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_EXE")
fi
cmake --preset conan-release \
"${CCACHE_ARGS[@]}" \
-DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} \
-DBUILD_TESTING:BOOL=ON \
-DCPACK_GENERATOR:STRING="${{ matrix.cpack_generators }}" \
-DBUILD_PYTHON_BINDINGS:BOOL=ON \
-DBUILD_PYTHON_PIP_PACKAGE:BOOL=${{ matrix.pip_package }} \
-DPython_EXECUTABLE:FILEPATH="$SYSTEM_PYTHON_PATH" \
-DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} \
-DSYSTEM_RUBY_EXECUTABLE="$SYSTEM_RUBY_PATH" \
-DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \
-DCMAKE_JOB_POOL_LINK:STRING=console
- name: Build with Ninja
working-directory: ${{ env.OPENSTUDIO_BUILD }}
run: |
. ./conanbuild.sh
export NINJA_STATUS="[%f/%t | %es elapsed | %o objs/sec]"
# Start resource monitor (records RSS samples for later summary)
echo "timestamp PID RSS_KB COMM" > mem_samples.log
( while true; do
sleep 60;
stamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
if command -v ps >/dev/null 2>&1; then ps -eo pid,rsz,comm --sort=-rsz | head -n 5 | awk -v s="$stamp" '{print s" "$1" "$2" "$3}' >> mem_samples.log; fi;
done ) &
HB_PID=$!
cmake --build . --parallel ${{ matrix.max_jobs }} 2>&1 | tee build.log
BUILD_EXIT=${PIPESTATUS[0]}
kill $HB_PID || true
command -v ninja >/dev/null 2>&1 && ninja -d stats || true
exit $BUILD_EXIT
- name: Run CTest suite
id: ctest
continue-on-error: true
working-directory: ${{ env.OPENSTUDIO_BUILD }}
run: |
overall_exit_code=0
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
export CTEST_OUTPUT_ON_FAILURE=1
exclude_pattern="${{ matrix.exclude_regex }}"
. ./conanbuild.sh
# Conflicting tests that must run sequentially
resource_locked_tests=(
ModelFixture.ScheduleFile
ModelFixture.ScheduleFileAltCtor
ModelFixture.PythonPluginInstance
ModelFixture.PythonPluginInstance_NotPYFile
ModelFixture.PythonPluginInstance_ClassNameValidation
ModelFixture.ChillerElectricASHRAE205_GettersSetters
ModelFixture.ChillerElectricASHRAE205_Loops
ModelFixture.ChillerElectricASHRAE205_NotCBORFile
ModelFixture.ChillerElectricASHRAE205_Clone
)
resource_locked_pattern=$(IFS='|'; echo "${resource_locked_tests[*]}")
ctest_command=(ctest -C ${{ env.BUILD_TYPE }} -T test --no-compress-output)
seq_exclude_args=()
if [ -n "$exclude_pattern" ]; then
seq_exclude_args=(-E "^($exclude_pattern)$")
final_exclude="$exclude_pattern|$resource_locked_pattern"
else
final_exclude="$resource_locked_pattern"
fi
begin_group "Running sequential tests..."
echo "Running: ${ctest_command[@]} ${seq_exclude_args[@]} -R '^($resource_locked_pattern)$' -j 1"
"${ctest_command[@]}" "${seq_exclude_args[@]}" -R "^($resource_locked_pattern)$" -j 1 || overall_exit_code=$?
echo "::endgroup::"
ctest_command+=(-E "^($final_exclude)$")
begin_group "Running all other tests in parallel..."
echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }}"
"${ctest_command[@]}" -j ${{ matrix.max_jobs }} || overall_exit_code=$?
echo "::endgroup::"
if [ $overall_exit_code -ne 0 ]; then
begin_group "Rerunning failing tests..."
echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure"
"${ctest_command[@]}" --rerun-failed --output-on-failure && overall_exit_code=0 || overall_exit_code=$?
echo "::endgroup::"
fi
echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT
- name: Wait for network stability
if: always()
run: sleep 5
- name: Upload build diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: build-diag-${{ matrix.platform }}-${{ github.sha }}
path: |
${{ env.OPENSTUDIO_BUILD }}/build.log
${{ env.OPENSTUDIO_BUILD }}/.ninja_log
${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake
if-no-files-found: warn
- name: Copy Testing tree with suffix
if: always()
working-directory: ${{ env.OPENSTUDIO_BUILD }}
run: |
if [ -d "Testing" ]; then
cp -r Testing "Testing-${{ matrix.test_suffix }}"
fi
- name: Generate test summary
if: always()
working-directory: ${{ env.OPENSTUDIO_BUILD }}
run: |
# Generate a simple markdown summary from CTest results
mkdir -p "$(dirname '${{ env.TEST_DASHBOARD_RELATIVE }}')"
echo "# OpenStudio Test Results - ${{ matrix.test_suffix }}" > "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo "" >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo "**Build:** \`${{ github.sha }}\`" >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo "**Branch:** \`${{ github.ref_name }}\`" >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo "**Platform:** ${{ matrix.pretty }}" >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo "**Date:** $(date -u)" >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo "" >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
if [ -f Testing/Temporary/LastTest.log ]; then
echo "## Test Log (Last 50 lines)" >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo '```' >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
tail -50 Testing/Temporary/LastTest.log >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
echo '```' >> "${{ env.TEST_DASHBOARD_RELATIVE }}"
fi
continue-on-error: true
- name: Upload Testing artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: Testing-${{ matrix.platform }}-${{ github.sha }}
path: |
${{ env.OPENSTUDIO_BUILD }}/Testing-${{ matrix.test_suffix }}/
${{ env.OPENSTUDIO_BUILD }}/${{ env.TEST_DASHBOARD_RELATIVE }}
- name: Create packages
if: ${{ success() && !cancelled() }}
working-directory: ${{ env.OPENSTUDIO_BUILD }}
run: |
. ./conanbuild.sh
cpack -C ${{ env.BUILD_TYPE }}
- name: Cleanup intermediate files
if: always()
working-directory: ${{ env.OPENSTUDIO_BUILD }}
run: |
find . -name "*.o" -type f -delete || true
df -h .
- name: Fail job on test failures
if: ${{ steps.ctest.outputs.exit_code != '0' }}
run: |
echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}"
exit 1
- name: Upload DEB installer
if: contains(matrix.cpack_generators, 'DEB')
uses: actions/upload-artifact@v4
with:
name: OS-Installers-${{ matrix.platform }}-DEB-${{ github.sha }}
path: ${{ env.OPENSTUDIO_BUILD }}/*.deb
if-no-files-found: ignore
- name: Upload RPM installer
if: contains(matrix.cpack_generators, 'RPM')
uses: actions/upload-artifact@v4
with:
name: OS-Installers-${{ matrix.platform }}-RPM-${{ github.sha }}
path: ${{ env.OPENSTUDIO_BUILD }}/*.rpm
if-no-files-found: ignore
- name: Upload TGZ installer
uses: actions/upload-artifact@v4
with:
name: OS-Installers-${{ matrix.platform }}-TGZ-${{ github.sha }}
path: ${{ env.OPENSTUDIO_BUILD }}/OpenStudio-*.tar.gz
if-no-files-found: ignore
- name: Upload WHEEL installer
if: matrix.pip_package
uses: actions/upload-artifact@v4
with:
name: OS-Installers-${{ matrix.platform }}-WHEEL-${{ github.sha }}
path: ${{ env.OPENSTUDIO_BUILD }}/*.whl
if-no-files-found: ignore
linux-publish:
name: Publish Linux Artifacts
needs: [linux-build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == 'true' || github.event.inputs.publish_to_s3 == 'true'
steps:
- name: Download all installers
uses: actions/download-artifact@v4
with:
pattern: OS-Installers-*
merge-multiple: true
path: installers
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION || 'us-west-2' }}
- name: Publish to S3
working-directory: installers
env:
S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}', github.ref_name) || format('{0}', github.ref_name) }}
run: |
echo "Uploading artifacts to s3://${AWS_S3_BUCKET}/${S3_PREFIX}"
for file in *; do
[ -e "$file" ] || continue
[ -f "$file" ] || continue
filename=$(basename "$file")
key="${S3_PREFIX}/${filename}"
aws s3 cp "$file" "s3://${AWS_S3_BUCKET}/${key}" --acl public-read
if command -v md5sum >/dev/null 2>&1; then md5sum "$file"; else md5 "$file"; fi
done
- name: Trigger Docker Build
if: inputs.skip_docker_trigger != 'true' && github.event.inputs.skip_docker_trigger != 'true'
working-directory: installers
env:
GH_TOKEN: ${{ secrets.DOCKER_OPENSTUDIO_PAT }}
BRANCH_NAME: ${{ github.ref_name }}
S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}', github.ref_name) || format('{0}', github.ref_name) }}
run: |
# Find the 22.04 deb file locally
DEB_FILE=$(find . -name "*22.04*.deb" | head -n 1)
if [ -z "$DEB_FILE" ]; then
echo "::error::Could not find Ubuntu 22.04 deb file in installers directory"
ls -la
exit 1
fi
FILENAME=$(basename "$DEB_FILE")
echo "Found file: $FILENAME"
# Construct S3 URL
# Replace + with %2B
ENCODED_FILENAME=${FILENAME//+/%2B}
BINARY_URL="https://${AWS_S3_BUCKET}.s3.amazonaws.com/${S3_PREFIX}/${ENCODED_FILENAME}"
echo "Binary URL: $BINARY_URL"
# Parse version from filename
# Expected format: OpenStudio-<Version>-<Platform>.deb
if [[ "$FILENAME" =~ OpenStudio-(.+)-Ubuntu-22\.04.*\.deb ]]; then
OS_VERSION_FULL=${BASH_REMATCH[1]}
elif [[ "$FILENAME" =~ OpenStudio-(.+)-Linux.*\.deb ]]; then
OS_VERSION_FULL=${BASH_REMATCH[1]}
else
echo "::error::Could not parse version from filename: $FILENAME"
exit 1
fi
echo "Full Version: $OS_VERSION_FULL"
# Logic from Jenkins:
# Split by +
IFS='+' read -r VER_PART SHA_PART <<< "$OS_VERSION_FULL"
if [[ "$VER_PART" == *"-"* ]]; then
# 3.3.0-rc1 -> Ver: 3.3.0, Ext: rc1
IFS='-' read -r OS_VERSION OS_VERSION_EXT <<< "$VER_PART"
else
# 3.3.0+sha -> Ver: 3.3.0, Ext: sha
OS_VERSION="$VER_PART"
OS_VERSION_EXT="$SHA_PART"
fi
echo "OS Version: $OS_VERSION"
echo "OS Version Ext: $OS_VERSION_EXT"
# Docker Tag Logic
if [[ "$BRANCH_NAME" == "develop" ]]; then
DOCKER_IMAGE_TAG="develop"
else
DOCKER_IMAGE_TAG="${OS_VERSION}-${OS_VERSION_EXT}"
fi
echo "Docker Image Tag: $DOCKER_IMAGE_TAG"
# Trigger Workflow
echo "Triggering manual_update_develop workflow in NatLabRockies/docker-openstudio..."
gh workflow run 'manual_update_develop' \
--repo NatLabRockies/docker-openstudio \
--ref develop \
-f docker_image_tag="$DOCKER_IMAGE_TAG" \
-f os_installer_link="$BINARY_URL" \
-f os_version="$OS_VERSION" \
-f os_version_ext="$OS_VERSION_EXT"
macos-build:
name: Build Packages for ${{ matrix.pretty }}
if: |
(!inputs.jobs || contains(inputs.jobs, 'macos-build')) &&
(github.event_name == 'push' || github.event_name == 'schedule' ||
(github.event_name == 'pull_request' && (github.base_ref == 'develop' || github.base_ref == 'master')))
runs-on: ${{ matrix.os }}
timeout-minutes: 720
continue-on-error: ${{ matrix.allow_failure }}
strategy:
fail-fast: false
matrix:
macos_dev_target: ["12.1", "13.0"]
include:
- macos_dev_target: "12.1"
platform: macos-x64
pretty: "macOS x64"
os: macos-15-intel
allow_failure: false
test_suffix: macOS-x64
arch: x86_64
python-arch: x64
dmg_glob: "*.dmg"
tar_glob: "*OpenStudio*x86_64.tar.gz"
exclude_regex: ""
max_jobs: 3
- macos_dev_target: "13.0"
platform: macos-arm64
pretty: "macOS ARM64"
os: macos-15
allow_failure: false
test_suffix: macOS-arm64
arch: arm64
python-arch: arm64
dmg_glob: "*.dmg"
tar_glob: "*OpenStudio*arm64.tar.gz"
exclude_regex: ""
max_jobs: 3
env:
MAX_BUILD_THREADS: ${{ matrix.max_jobs }}
permissions:
# Needed permission to upload the release asset
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
path: ${{ env.OPENSTUDIO_SOURCE }}
fetch-depth: 1
- name: Verify space
shell: bash
run: |
echo "Memory and swap:"
if command -v vm_stat >/dev/null 2>&1; then
vm_stat
fi
echo
sysctl vm.swapusage || true
echo
echo "Available storage:"
df -h . || true
echo
- name: Git safe directory
working-directory: ${{ env.OPENSTUDIO_SOURCE }}
run: git config --global --add safe.directory '*'
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ccache-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }}
max-size: ${{ env.CCACHE_MAXSIZE }}
- name: Restore Conan cache
uses: actions/cache@v4
with:
path: ~/.conan2
key: conan-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }}
restore-keys: |
conan-${{ matrix.os }}-${{ matrix.platform }}-
- name: Remove python ${{ env.PYTHON_REQUIRED_VERSION }} from the toolcache
run: |
ls $RUNNER_TOOL_CACHE/Python || true
rm -Rf "$RUNNER_TOOL_CACHE/Python/${{ env.PYTHON_REQUIRED_VERSION }}"
rm -Rf "$RUNNER_TOOL_CACHE/Python/${{ env.PYTHON_REQUIRED_VERSION }}*/"
- name: Set up Python ${{ env.PYTHON_REQUIRED_VERSION }}
id: setup-python
uses: jmarrec/setup-python@v5.4.0
with:
python-version: ${{ env.PYTHON_REQUIRED_VERSION }}
# check-latest: true # Force pick up the python I built instead of the (potential) toolcache one. I could also do `rm -Rf $RUNNER_TOOL_CACHE/Python/3.12.2` before this action
- name: Install Python dependencies
working-directory: ${{ env.OPENSTUDIO_SOURCE }}
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install -r python/requirements.txt
pip install conan aqtinstall
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.2'
bundler-cache: true
- name: Set up Qt IFW
run: |
cd $RUNNER_TEMP
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 System dependencies
shell: bash
run: |
# The MACOSX_DEPLOYMENT_TARGET environment variable sets the default value for the CMAKE_OSX_DEPLOYMENT_TARGET variable.
# We use cmake commands to build some subprojects, so setting it globally
echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_dev_target }} >> $GITHUB_ENV
brew install ninja
- name: Create Build Directory
run: cmake -E make_directory ${{ env.OPENSTUDIO_BUILD }}
- name: Cache External Dependencies
uses: actions/cache@v4
with:
path: |
${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.tar.gz
${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.zip
${{ env.OPENSTUDIO_BUILD }}/radiance*.tar.gz
${{ env.OPENSTUDIO_BUILD }}/radiance*.zip
${{ env.OPENSTUDIO_BUILD }}/openstudio*gems*.tar.gz
key: external-deps-${{ matrix.os }}-${{ hashFiles('conan.lock') }}
restore-keys: |
external-deps-${{ matrix.os }}-
- name: Restore Generated Embedded Files
uses: actions/cache@v4
with:
path: |
${{ env.OPENSTUDIO_BUILD }}/src/*/embedded_files
${{ env.OPENSTUDIO_BUILD }}/ruby/engine/embedded_files
key: embedded-files-${{ matrix.os }}-${{ hashFiles('resources/**', 'ruby/engine/**', 'src/airflow/**', 'src/energyplus/**', 'src/gbxml/**', 'src/isomodel/**', 'src/radiance/**', 'src/sdd/**', 'src/model/**', 'src/utilities/**') }}
restore-keys: |
embedded-files-${{ matrix.os }}-
- name: Configure Conan remotes
run: |
conan remote remove nrel-v2 || true
conan remote add --index 0 nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2
conan remote remove conancenter || true
conan remote add conancenter https://center2.conan.io
if [ ! -f "$HOME/.conan2/profiles/default" ]; then
conan profile detect
fi
conan config home
- name: Conan install
working-directory: ${{ env.OPENSTUDIO_SOURCE }}
run: |
CMAKE_POLICY_VERSION_MINIMUM=3.5 conan install . \
--output-folder=../${{ env.OPENSTUDIO_BUILD }} \
--build=missing \
-c tools.cmake.cmaketoolchain:generator=Ninja \
-s compiler.cppstd=20 \
-s build_type=${{ env.BUILD_TYPE }} \
-s os.version=${{ matrix.macos_dev_target }} \
-o readline/*:with_library=termcap
- name: Locate Ruby
run: |
ruby_path=$(command -v ruby)
echo "SYSTEM_RUBY_PATH=$ruby_path" >> $GITHUB_ENV
- name: Locate Python
run: |
python_path=$(command -v python3)
echo "SYSTEM_PYTHON_PATH=$python_path" >> $GITHUB_ENV
- name: Install Documentation Dependencies (Mac)
run: |
brew install --cask basictex
echo "/Library/TeX/texbin" >> $GITHUB_PATH
- name: Configure with CMake
working-directory: ${{ env.OPENSTUDIO_BUILD }}
env:
APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }}
run: |
set -e
chmod +x ./conanbuild.sh
. ./conanbuild.sh
# Use absolute path for ccache to avoid resolution issues in containers with symlinked build dirs
CCACHE_ARGS=()
if command -v ccache >/dev/null 2>&1; then
CCACHE_EXE=$(command -v ccache)
CCACHE_ARGS=("-DCMAKE_C_COMPILER_LAUNCHER=$CCACHE_EXE" "-DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_EXE")
fi
# Configure signing identity
SIGNING_ARGS=()
if [ -n "$APPLE_DEV_ID" ]; then
echo "Configuring for signed build"
SIGNING_ARGS=("-DCPACK_IFW_PACKAGE_SIGNING_IDENTITY=$APPLE_DEV_ID")
else
echo "Configuring for ad-hoc signed build (skipping CPack signing identity)"
SIGNING_ARGS=()
fi
cmake -G Ninja \
"${CCACHE_ARGS[@]}" \
"${SIGNING_ARGS[@]}" \
-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \
-DCMAKE_CXX_FLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -Wno-enum-constexpr-conversion" \
-DENABLE_COVERAGE:BOOL=OFF \
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${{ matrix.macos_dev_target }} \
-DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} \
-DBUILD_TESTING:BOOL=ON \
-DCPACK_BINARY_TGZ:BOOL=ON \
-DCPACK_BINARY_IFW:BOOL=ON \
-DBUILD_PYTHON_BINDINGS:BOOL=ON \
-DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF \
-DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} \
-DPython_ROOT_DIR:PATH="$(dirname $(dirname $SYSTEM_PYTHON_PATH))" \
-DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \
-DCMAKE_JOB_POOL_LINK:STRING=console \
../${{ env.OPENSTUDIO_SOURCE }}
- name: Build with Ninja
working-directory: ${{ env.OPENSTUDIO_BUILD }}
run: |
. ./conanbuild.sh
export NINJA_STATUS="[%f/%t | %es elapsed | %o objs/sec]"
while true; do
sleep 300
echo "[heartbeat] $(date -u +"%H:%M:%S")"
if command -v top >/dev/null 2>&1; then top -l 1 -s 0 | grep PhysMem || true; fi
df -h . | tail -1 | awk '{print "[disk] used=" $3 "/" $2 " (" $5 ")"}'
if command -v ps >/dev/null 2>&1; then ps -eo pid,pmem,rss,comm | sort -rn -k2 | head -n 5; fi
done &
heartbeat_pid=$!
cmake --build . --parallel ${MAX_BUILD_THREADS} 2>&1 | tee build.log
build_exit=${PIPESTATUS[0]}
kill $heartbeat_pid || true
command -v ninja >/dev/null 2>&1 && ninja -d stats || true
if [ -f build.log ]; then tail -n 40 build.log; fi
exit $build_exit
- name: Wait for network stability
if: always()
run: sleep 5
- name: Upload build diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: build-diag-${{ matrix.platform }}-${{ github.sha }}
path: |
${{ env.OPENSTUDIO_BUILD }}/build.log
${{ env.OPENSTUDIO_BUILD }}/.ninja_log
${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake
if-no-files-found: warn
- name: Run CTest suite
id: mac_ctest
working-directory: ${{ env.OPENSTUDIO_BUILD }}
shell: bash
continue-on-error: true
run: |
gem install bundler -v 2.4.10 --conservative --no-document
overall_exit_code=0
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
export CTEST_OUTPUT_ON_FAILURE=1
exclude_pattern="${{ matrix.exclude_regex }}"
# Conflicting tests that must run sequentially
resource_locked_tests=(
ModelFixture.ScheduleFile
ModelFixture.ScheduleFileAltCtor
ModelFixture.PythonPluginInstance
ModelFixture.PythonPluginInstance_NotPYFile
ModelFixture.PythonPluginInstance_ClassNameValidation
ModelFixture.ChillerElectricASHRAE205_GettersSetters
ModelFixture.ChillerElectricASHRAE205_Loops
ModelFixture.ChillerElectricASHRAE205_NotCBORFile
ModelFixture.ChillerElectricASHRAE205_Clone
)
resource_locked_pattern=$(IFS='|'; echo "${resource_locked_tests[*]}")
ctest_command=(ctest -C ${{ env.BUILD_TYPE }} -T test --no-compress-output)
seq_exclude_args=()
if [ -n "$exclude_pattern" ]; then
seq_exclude_args=(-E "^($exclude_pattern)$")
final_exclude="$exclude_pattern|$resource_locked_pattern"
else
final_exclude="$resource_locked_pattern"
fi
begin_group "Running sequential tests..."
echo "Running: ${ctest_command[@]} ${seq_exclude_args[@]} -R '^($resource_locked_pattern)$' -j 1"
"${ctest_command[@]}" "${seq_exclude_args[@]}" -R "^($resource_locked_pattern)$" -j 1 || overall_exit_code=$?
echo "::endgroup::"
ctest_command+=(-E "^($final_exclude)$")
begin_group "Running all other tests in parallel..."
echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }}"
"${ctest_command[@]}" -j ${{ matrix.max_jobs }} || overall_exit_code=$?
echo "::endgroup::"
if [ $overall_exit_code -ne 0 ]; then
begin_group "Rerunning failing tests..."
echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure"
"${ctest_command[@]}" --rerun-failed --output-on-failure && overall_exit_code=0 || overall_exit_code=$?
echo "::endgroup::"
fi
echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT
- name: Setup Keychain
if: success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || inputs.publish_to_s3 == 'true' || github.event.inputs.publish_to_s3 == 'true' )
env:
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
run: |
if [ -n "$APPLE_CERT_DATA" ] && [ -n "$APPLE_CERT_PASSWORD" ]; then
# Create temporary keychain
KEYCHAIN_PATH="$RUNNER_TEMP/build.keychain"
KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Import certificate
CERT_PATH="$RUNNER_TEMP/certificate.p12"
echo "$APPLE_CERT_DATA" | base64 --decode > "$CERT_PATH"
security import "$CERT_PATH" -k "$KEYCHAIN_PATH" -P "$APPLE_CERT_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> $GITHUB_ENV
fi
- name: Create packages
if: ${{ success() && !cancelled() }}
working-directory: ${{ env.OPENSTUDIO_BUILD }}
env:
COPYFILE_DISABLE: 1
run: |
. ./conanbuild.sh