Merge pull request #765 from openstudiocoalition/763_debian_bookworm #1417
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-20.04, ubuntu-22.04, ubuntu-24.04, windows-2022, macos-13, macos-arm64] | |
include: | |
- os: ubuntu-20.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-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: 11.0 | |
SDKROOT: /Applications/Xcode_15.0.1.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: 12.1 | |
SDKROOT: /Applications/Xcode_15.0.1.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.8.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.0.1.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 [ "${{ matrix.SELF_HOSTED }}" == "true" ]; then | |
# TODO: temp... this is unfortunate but the OS SDK arm64 rc2 package has a different sha when extracted... | |
# OpenStudio-3.8.0-rc2+af997f4fef-Darwin-x86_64.tar.gz on github, but when extracted it's OpenStudio-3.8.0-rc2+06d9d975e1-Darwin-arm64 | |
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 }} || true | |
ls $(pwd)/build/OpenStudio-3.8.0 || true | |
OS_DIR=$(find "$(pwd)/build/OpenStudio-3.8.0" -name openstudioConfig.cmake) | |
OS_DIR=$(dirname $OS_DIR) | |
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 }} -Dopenstudio_DIR:PATH=$OS_DIR | |
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 |