Merge pull request #639 from openstudiocoalition/638-make_argument_li… #1033
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 ] | |
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 |