Skip to content

Commit a3d3011

Browse files
author
Yujie Xu
committed
Merge remote-tracking branch 'origin/develop' into fixVRFOUfanCycling
2 parents 4c2b787 + 52fee4b commit a3d3011

File tree

164 files changed

+8582
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+8582
-186
lines changed

.github/workflows/mac_release.yml

Lines changed: 224 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ on:
44
push:
55
tags:
66
- '*'
7+
workflow_dispatch:
78

89
env:
910
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1011
BUILD_TYPE: Release
1112
FC: gfortran-13
1213
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
1314
Python_REQUIRED_VERSION: 3.12.2
15+
BUILD_DOCS: true # Installing MacTex takes like 15min, so you can speed things up by disabling it
1416

1517
jobs:
1618
build_installer_artifact:
@@ -39,6 +41,61 @@ jobs:
3941
steps:
4042
- uses: actions/checkout@v4
4143

44+
# - name: Setup QtIFW 4.x
45+
# uses: jmarrec/setup-qtifw@v1
46+
# with:
47+
# qtifw-version: '4.6.1'
48+
49+
- name: "Configure for codesigning"
50+
run: |
51+
set -x
52+
cd $RUNNER_TEMP
53+
mkdir codesigning && cd codesigning
54+
# ----- Create certificate files from secrets base64 -----
55+
echo "${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_CERTIFICATE_P12_BASE64 }}" | base64 --decode > certificate_application.p12
56+
echo "${{ secrets.MACOS_DEVELOPER_ID_INSTALLER_CERTIFICATE_P12_BASE64 }}" | base64 --decode > certificate_installer.p12
57+
58+
# ----- Configure Keychain -----
59+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
60+
security create-keychain -p "${{ secrets.MACOS_KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH
61+
# Unlock it for 6 hours
62+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
63+
security unlock-keychain -p "${{ secrets.MACOS_KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH
64+
65+
# ----- Import certificates on Keychain -----
66+
security import certificate_application.p12 -P '${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_CERTIFICATE_P12_PASSWORD }}' -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
67+
security import certificate_installer.p12 -P '${{ secrets.MACOS_DEVELOPER_ID_INSTALLER_CERTIFICATE_P12_PASSWORD }}' -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
68+
security list-keychain -d user -s $KEYCHAIN_PATH
69+
security find-identity -vvvv $KEYCHAIN_PATH
70+
71+
# Add needed intermediary certificates
72+
aria2c https://www.apple.com/certificateauthority/AppleWWDRCAG2.cer
73+
aria2c https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer
74+
security import AppleWWDRCAG2.cer -k $KEYCHAIN_PATH
75+
security import DeveloperIDG2CA.cer -k $KEYCHAIN_PATH
76+
security find-identity -vvvv $KEYCHAIN_PATH
77+
security find-identity -v -p codesigning
78+
79+
# Store AppConnect credentials
80+
echo "${{ secrets.NOTARIZATION_API_KEY }}" > AppConnect_Developer_API_Key.p8
81+
xcrun notarytool store-credentials EnergyPlus \
82+
--key AppConnect_Developer_API_Key.p8 \
83+
--key-id ${{ secrets.NOTARIZATION_API_TEAM_ID }} \
84+
--issuer ${{ secrets.NOTARIZATION_API_ISSUER_ID }} \
85+
--keychain $KEYCHAIN_PATH
86+
87+
cd .. && rm -Rf codesigning
88+
89+
# Download my patched QtIFW
90+
mkdir QtIFW && cd QtIFW
91+
aria2c https://github.com/jmarrec/QtIFW-fixup/releases/download/v5.0.0-dev-with-fixup/QtIFW-5.0.0-${{ matrix.arch }}.zip
92+
xattr -r -d com.apple.quarantine ./QtIFW-5.0.0-${{ matrix.arch }}.zip
93+
unzip QtIFW-5.0.0-${{ matrix.arch }}.zip
94+
rm -Rf ./*.zip
95+
chmod +x *
96+
./installerbase --version
97+
echo "$(pwd)" >> $GITHUB_PATH
98+
4299
- name: Remove python ${{ env.Python_REQUIRED_VERSION }} from the toolcache
43100
run: |
44101
ls $RUNNER_TOOL_CACHE/Python || true
@@ -52,11 +109,6 @@ jobs:
52109
python-version: ${{ env.Python_REQUIRED_VERSION }}
53110
# 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
54111

55-
- name: Setup QtIFW 4.x
56-
uses: jmarrec/setup-qtifw@v1
57-
with:
58-
qtifw-version: '4.6.1'
59-
60112
- name: Install Python dependencies
61113
run: |
62114
python -m pip install --upgrade pip
@@ -66,16 +118,22 @@ jobs:
66118
shell: bash
67119
run: |
68120
set -x
69-
echo "Using brew to install mactex and adding it to PATH"
70121
brew update
71-
brew install --cask mactex-no-gui
72-
echo "/Library/TeX/texbin" >> $GITHUB_PATH
122+
if [[ "$BUILD_DOCS" != "false" ]]; then
123+
echo "Using brew to install mactex and adding it to PATH"
124+
brew install --cask mactex-no-gui
125+
echo "/Library/TeX/texbin" >> $GITHUB_PATH
126+
echo "DOCUMENTATION_BUILD=BuildWithAll" >> $GITHUB_ENV
127+
else
128+
echo "DOCUMENTATION_BUILD=DoNotBuild" >> $GITHUB_ENV
129+
fi
73130
# The MACOSX_DEPLOYMENT_TARGET environment variable sets the default value for the CMAKE_OSX_DEPLOYMENT_TARGET variable.
74131
# We use cmake commands to build some subprojects, so setting it globally
75132
echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_dev_target }} >> $GITHUB_ENV
76133
echo "Installing gcc@13 for gfortran support of -static-libquadmath"
77134
brew list gcc@13 || brew install gcc@13
78135
which gfortran-13 || echo "FC=$(brew --prefix gcc@13)/bin/gfortran-13" >> $GITHUB_ENV
136+
brew install ninja
79137
80138
- name: Create Build Directory
81139
run: cmake -E make_directory ./build/
@@ -86,43 +144,99 @@ jobs:
86144
working-directory: ./build
87145
shell: bash
88146
run: |
89-
cmake -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
147+
cmake -G Ninja -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
90148
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${{ matrix.macos_dev_target }} \
91149
-DLINK_WITH_PYTHON:BOOL=ON -DPython_REQUIRED_VERSION:STRING=${{ steps.setup-python.outputs.python-version }} \
92150
-DPython_ROOT_DIR:PATH=$RUNNER_TOOL_CACHE/Python/${{ steps.setup-python.outputs.python-version }}/${{ matrix.python-arch }}/ \
93151
-DBUILD_FORTRAN:BOOL=ON -DBUILD_PACKAGE:BOOL=ON \
94-
-DDOCUMENTATION_BUILD:STRING="BuildWithAll" -DTEX_INTERACTION:STRING="batchmode" \
152+
-DDOCUMENTATION_BUILD:STRING=$DOCUMENTATION_BUILD -DTEX_INTERACTION:STRING="batchmode" \
95153
-DENABLE_OPENMP:BOOL=OFF -DUSE_OpenMP:BOOL=OFF \
154+
-DCPACK_CODESIGNING_DEVELOPPER_ID_APPLICATION:STRING="Developer ID Application: National Renewable Energy Laboratory (K7JYVQJL7R)" \
155+
-DCPACK_CODESIGNING_NOTARY_PROFILE_NAME:STRING=EnergyPlus \
96156
../
97157
98158
- name: Build Package
99159
working-directory: ./build
100160
shell: bash
101-
run: cmake --build . --target package -j 3
102-
103-
- name: otool the exes and libs
104-
shell: bash
105-
working-directory: ./build
106161
run: |
107-
set -x
108-
cd _CPack_Packages/Darwin/TGZ/EnergyPlus*/
109-
otool -L ExpandObjects || true
110-
otool -L ConvertInputFormat || true
111-
otool -L energyplus || true
112-
otool -L libenergyplusapi.dylib || true
113-
otool -L PreProcess/IDFVersionUpdater/Transition-V23-1-0-to-V23-2-0 || true
114-
otool -L PostProcess/ReadVarsESO || true
115-
otool -L PostProcess/HVAC-Diagram || true
162+
ninja package
116163
117164
- name: Upload Tarball as artifact for testing
118165
uses: actions/upload-artifact@v4
119166
with:
120-
name: energyplus-${{ matrix.os }}
167+
name: energyplus-${{ matrix.os }}.tar.gz
121168
path: build/EnergyPlus-*-${{ matrix.arch }}.tar.gz
122169
if-no-files-found: error
123170
retention-days: 7
124171
overwrite: false
125172

173+
- name: Upload DMG as artifact for testing
174+
uses: actions/upload-artifact@v4
175+
with:
176+
name: energyplus-${{ matrix.os }}.dmg
177+
path: build/EnergyPlus-*-${{ matrix.arch }}.dmg
178+
if-no-files-found: error
179+
retention-days: 7
180+
overwrite: false
181+
182+
- name: Quick Test Package Signing and otool exes and libs
183+
shell: bash
184+
working-directory: ./build
185+
run: |
186+
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
187+
188+
subheader() { echo -e "\033[95m---- $1\033[0m"; }
189+
190+
exes=(
191+
"energyplus" "libenergyplusapi.dylib"
192+
"ExpandObjects" "ConvertInputFormat"
193+
"PreProcess/IDFVersionUpdater/Transition-V23-1-0-to-V23-2-0"
194+
"PostProcess/ReadVarsESO" "PostProcess/HVAC-Diagram"
195+
)
196+
197+
TGZ_DIR=$(find _CPack_Packages/Darwin/TGZ -name "EnergyPlus*" -type d -maxdepth 1)
198+
echo "TGZ_DIR=$TGZ_DIR" >> $GITHUB_ENV
199+
echo "Checking TGZ dir at $TGZ_DIR"
200+
201+
for rel_exe in "${exes[@]}"; do
202+
exe="$TGZ_DIR/$rel_exe"
203+
begin_group "Checking $exe"
204+
subheader "otool"
205+
otool -L "${exe}" || true
206+
subheader "codesign"
207+
siginfo=$(codesign --display -vv "${exe}" 2>&1)
208+
if [[ $siginfo == *"K7JYVQJL7R"* ]]; then
209+
echo -e "\033[92mSIGNATURE OK\033[0m"
210+
echo "$siginfo" | grep Authority
211+
else
212+
echo -e "\033[91mSignature not ok for ${exe}\033[0m"
213+
echo "::error::title=Signature not ok for ${exe}::$siginfo"
214+
fi
215+
echo "::endgroup::"
216+
done
217+
218+
- name: Full Test Package signing and otool for IFW and TGZ
219+
working-directory: ./build
220+
shell: bash
221+
run: |
222+
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
223+
224+
begin_group "Full Check signature of _CPack_Packages for both IFW and TGZ and resolve otool libraries"
225+
python ../scripts/dev/verify_signature.py --verbose --otool --otool-out-file otool_infos_cpack.json .
226+
echo "::endgroup::"
227+
228+
begin_group "Running a simulation with python"
229+
./$TGZ_DIR/energyplus --help
230+
./$TGZ_DIR/energyplus -w ./$TGZ_DIR/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw -d out ./$TGZ_DIR/ExampleFiles/PythonPluginCustomSchedule.idf
231+
echo "::endgroup::"
232+
233+
- name: Upload otool info as artifact
234+
uses: actions/upload-artifact@v4
235+
with:
236+
name: otool_infos_cpack_${{ matrix.os }}_${{ matrix.arch }}
237+
path: build/otool*json
238+
if-no-files-found: error
239+
126240
- name: Upload Tarball to release
127241
uses: svenstaro/upload-release-action@v2
128242
with:
@@ -153,39 +267,96 @@ jobs:
153267
include:
154268
- macos_dev_target: 12.1
155269
os: macos-12
270+
arch: x86_64
156271
python-arch: x64
157272
test_key: mac12
158273
- macos_dev_target: 13.0
159274
os: macos-14
275+
arch: arm64
160276
python-arch: arm64
161277
test_key: mac13-arm64
162278

163279
steps:
164-
- uses: actions/checkout@v4 # Still need E+ checked out to get testing scripts
165-
with:
166-
path: checkout
167-
168-
- name: Set up Python ${{ env.Python_REQUIRED_VERSION }}
169-
uses: actions/setup-python@v5
170-
id: setup-python
171-
with:
172-
python-version: ${{ env.Python_REQUIRED_VERSION }}
173-
architecture: ${{ matrix.python-arch }}
174-
175-
- name: Gather Test Package from Artifacts
176-
uses: actions/download-artifact@v4
177-
with:
178-
name: energyplus-${{ matrix.os }}
179-
path: package
180-
181-
- name: Check Contents
182-
shell: bash
183-
run: ls
184-
185-
- name: Check Package contents
186-
shell: bash
187-
working-directory: package
188-
run: ls
189-
190-
- name: Run Package Tests
191-
run: python checkout/scripts/package_tests/runner.py --verbose ${{ matrix.test_key }} package/
280+
- uses: actions/checkout@v4 # Still need E+ checked out to get testing scripts
281+
with:
282+
path: checkout
283+
284+
- name: Set up Python ${{ env.Python_REQUIRED_VERSION }}
285+
uses: actions/setup-python@v5
286+
id: setup-python
287+
with:
288+
python-version: ${{ env.Python_REQUIRED_VERSION }}
289+
architecture: ${{ matrix.python-arch }}
290+
291+
- name: Gather Test Package from Artifacts
292+
uses: actions/download-artifact@v4
293+
with:
294+
name: energyplus-${{ matrix.os }}.tar.gz
295+
path: package
296+
297+
- name: Check Contents
298+
shell: bash
299+
run: ls
300+
301+
- name: Check Package contents
302+
shell: bash
303+
working-directory: package
304+
run: ls
305+
306+
- name: Run Package Tests
307+
run: python checkout/scripts/package_tests/runner.py --verbose ${{ matrix.test_key }} package/
308+
309+
- name: Gather Dmg Package from Artifacts
310+
uses: actions/download-artifact@v4
311+
with:
312+
name: energyplus-${{ matrix.os }}.dmg
313+
path: dmg
314+
315+
- name: Test Dmg Install and Package signing
316+
working-directory: ./dmg
317+
shell: bash
318+
run: |
319+
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
320+
321+
set -x
322+
323+
dmg=$(ls EnergyPlus-*.dmg)
324+
begin_group "Checking Signature of .dmg"
325+
spctl --assess --type open --context context:primary-signature -vvvv $dmg
326+
echo "::endgroup::"
327+
328+
begin_group "Mounting Dmg, and checking signature of installer app"
329+
mkdir temp_mount
330+
hdiutil attach -mountpoint ./temp_mount/ $dmg
331+
filename="${dmg%.*}"
332+
spctl --assess --type open --context context:primary-signature -vvvv ./temp_mount/$filename.app
333+
echo "::endgroup::"
334+
335+
begin_group "Installing"
336+
sudo ./temp_mount/$filename.app/Contents/MacOS/$filename --accept-licenses --default-answer --confirm-command --root $(pwd)/test_install install
337+
hdiutil detach ./temp_mount/
338+
echo "::endgroup::"
339+
340+
begin_group "Quick Check signature of inner executables and binaries"
341+
codesign -dvvv ./test_install/energyplus
342+
codesign -dvvv ./test_install/libenergyplusapi.dylib
343+
codesign -dvvv ./test_install/libpython*.dylib
344+
codesign -dvvv ./test_install/ConvertInputFormat
345+
codesign -dvvv ./test_install/PostProcess/ReadVarsESO
346+
echo "::endgroup::"
347+
348+
begin_group "Full Check signature of installed DMG for all executables and resolve otool libraries"
349+
python ../checkout/scripts/dev/verify_signature.py --otool --otool-out-file otool_info_dmg.json --verbose --install test_install
350+
echo "::endgroup::"
351+
352+
begin_group "Running a simulation with python"
353+
./test_install/energyplus --help
354+
./test_install/energyplus -w ./test_install/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw -d out ./test_install/ExampleFiles/PythonPluginCustomSchedule.idf
355+
echo "::endgroup::"
356+
357+
- name: Upload otool info as artifact
358+
uses: actions/upload-artifact@v4
359+
with:
360+
name: otool_info_dmg_${{ matrix.os }}_${{ matrix.arch }}
361+
path: dmg/otool*json
362+
if-no-files-found: error

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ endif()
1313

1414
cmake_policy(SET CMP0048 NEW) # handling project_version_* variables
1515

16+
cmake_policy(SET CMP0087 NEW) # install(CODE) and install(SCRIPT) support generator expressions.
17+
1618
project(EnergyPlus)
1719

1820
# Raise an error if attempting to compile on macOS older than 10.15 - it does not work

0 commit comments

Comments
 (0)