Skip to content

Commit

Permalink
Merge pull request #259 from openstudiocoalition/develop
Browse files Browse the repository at this point in the history
1.1.0 Release
  • Loading branch information
jmarrec authored Oct 24, 2020
2 parents 8930482 + e95d68c commit b2e7010
Show file tree
Hide file tree
Showing 618 changed files with 1,606,800 additions and 1,313,041 deletions.
223 changes: 186 additions & 37 deletions .github/workflows/app_build.yml

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions .github/workflows/check_osm_versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check OSM Versions

on:
pull_request:
branches: [ master ]

jobs:
osm-versions:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-ruby@v1
with:
ruby-version: 2.5

- name: Verify that OSMs have been updated
shell: bash
run: |
ruby ./developer/ruby/CheckOSMVersions.rb
- name: Suggest correcting steps
if: ${{ failure() }}
shell: bash
run: |
echo "There is a workflow called export_standards_data that you should run first (it's a manual workflow_dispatch workflow)"
echo "or run it locally via 'cd developper/ruby && openstudio export_openstudio_standards_libraries.rb'"
echo ""
echo "Then you should use 'openstudio developper/ruby/UpdateOSMVersions.rb' to version translate the rest of the OSM files."
11 changes: 10 additions & 1 deletion .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ jobs:
shell: bash
run: |
sudo snap install cppcheck
cppcheck --suppress=missingInclude --enable=all --inline-suppr --inconclusive --template='[{file}:{line}]:({severity}),[{id}],{message}' --force -q -j $(nproc) -i ./src/qtwinmigrate ./src 2>&1 | tee cppcheck.txt
cppcheck \
--suppress=noExplicitConstructor \
--suppress=useStlAlgorithm \
--inline-suppr \
--inconclusive \
--enable=all \
--template='[{file}:{line}]:({severity}),[{id}],{message}' \
--force -q -j $(nproc) \
-i ./src/qtwinmigrate \
./src 2>&1 | tee cppcheck.txt
- name: Parse and colorize cppcheck
shell: bash
Expand Down
219 changes: 219 additions & 0 deletions .github/workflows/export_standards_data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
name: Export OpenStudio Standards Data

on:
workflow_dispatch:
inputs:
os_installer_link:
description: 'The Link where to download the LINUX OpenStudio SDK Installer (.DEB), otherwise defaults to the one specified in FindOpenStudioSDK.cmake'
required: false
branch_name:
description: 'The branch name to use and where to commit the test results. If ommited, check out develop, and commit results to a branch named like the installer SHA'
required: false

jobs:
export-os-standards:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.8.x'

- 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}{sdk_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: Download and install OS SDK installer
shell: bash
run: |
Color_Off='\033[0m' # No Color
Red='\033[0;31m'
Yellow='\033[0;33m'
echo "User-supplied arguments:"
echo "Installer link: ${{ github.event.inputs.os_installer_link }}"
echo "Branch Name: ${{ github.event.inputs.branch_name }}"
echo ""
installer_link="${{ github.event.inputs.os_installer_link }}"
if [ -z "$installer_link" ]; then
installer_link="$OS_SDK_BASELINK/$OS_SDK_INSTALLER_NAME"
echo -e "${Yellow}Trying with Baselink: $installer_link${Color_Off}"
if ! wget -q "$installer_link"; then
installer_link="$OS_SDK_ALTERNATE_LINK_1/$OS_SDK_INSTALLER_NAME"
echo -e "${Yellow}Not found at baselink. Trying with alternate link: $installer_link${Color_Off}"
if ! wget -q "$installer_link"; then
echo -e "${Yellow}Cannot find the OS SDK installer. Defaulting to latest release (pre-release included)${Color_Off}"
installer_link=$(curl -s https://api.github.com/repos/NREL/OpenStudio/releases | jq -r '. [0] | .assets | .[] | select(.name | contains("Linux")) | select(.name | contains("deb")) | .browser_download_url')
if [ -z "$installer_link" ]; then
echo -e "${Red}Could not locate the latest OpenStudio deb from the release page.${Color_Off}"
exit 1
fi
echo -e "${Yellow}Trying with latest release: $installer_link${Color_Off}"
if ! wget -q "$installer_link"; then
echo -e "${Red}Not found at $installer_link${Color_Off}"
echo -e "${Red}I've exhausted all options here. Sorry${Color_Off}"
exit 1
fi
fi
fi
else
if ! wget -q "$installer_link"; then
echo "Could not locate the DEB installer at supplied $installer_link"
exit 1
fi
fi
sudo apt update
sudo apt install -y ./OpenStudio*.deb
os_version=$(openstudio openstudio_version)
echo "os_version=$os_version" >> $GITHUB_ENV
- name: Checkout the branch
shell: bash
run: |
branch_name="${{ github.event.inputs.branch_name }}"
if [ -z "$branch_name" ]; then
branch_name=$(openstudio -e "puts OpenStudio::openStudioVersionBuildSHA")
echo "Branch name not supplied, defaulting to '$branch_name'"
else
git fetch
fi;
echo "branch_name=$branch_name" >> $GITHUB_ENV
git checkout $branch_name || git checkout -b $branch_name
- name: Export openstudio-standards libraries
shell: bash
working-directory: ./developer/ruby/
run: |
set -x
N=$(nproc) openstudio export_openstudio_standards_libraries.rb
- name: Upload libraries and logs
if: ${{ always() }}
shell: bash
run: |
Color_Off='\033[0m' # No Color
Red='\033[0;31m'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git config --global user.name 'github-actions[bot]'
mv developer/ruby/pkg/libraries/*.osm src/openstudio_app/Resources/
git add src/openstudio_app/Resources/
if [[ $(git diff --cached --exit-code) ]]; then
git commit -m "Add OSMs results from exporting openstudio-standards libraries with $os_version (${{ github.event.inputs.os_installer_link }})"
git push -u origin $branch_name
else
echo -e "${Red}No OSMs generated...${Color_Off}"
fi
git add -f ./developer/ruby/pkg/libraries/*
if [[ $(git diff --cached --exit-code) ]]; then
git commit -m "Add logs for review (DISCARD ME)"
git push -u origin $branch_name
else
echo "${Red}No logs to commit, that's very strange...${Color_Off}"
fi
85 changes: 85 additions & 0 deletions .github/workflows/release_notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Create release notes changelog
on:
release:
types: [created]

jobs:
release-notes:
name: Create changelog
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-ruby@v1
with:
ruby-version: 2.5

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Create changelog using GitHubIssueStats.rb
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gem install github_api
pip install requests
ruby ./developer/ruby/GitHubIssueStats.rb > changelog.txt
- name: Upload changelog to release body
shell: python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
import json
import os
import requests
OWNER_REPO = "${{ github.repository }}" # 'openstudiocoalition/OpenStudioApplication'
GITHUB_REF = os.environ['GITHUB_REF'] # v1.1.0-rc1
GITHUB_TOKEN = os.environ['GITHUB_TOKEN'] # Secret oauth token (40 chars)
HEADERS = {
"Content-Type": 'application/json',
"Accept": 'application/vnd.github.antiope-preview+json',
"Authorization": "Bearer {}".format(GITHUB_TOKEN),
"User-Agent": 'github-actions-changelog'
}
# Just to be safe
TAG_NAME = GITHUB_REF.replace('refs/tags/', '')
print(f"{OWNER_REPO=}, {GITHUB_REF=}, {TAG_NAME=}")
def get_release_by_tag_name(owner_repo, tag_name):
query_url = f"https://api.github.com/repos/{owner_repo}/releases/tags/{tag_name}"
r = requests.get(query_url, headers=HEADERS)
if r.status_code != requests.codes.ok:
http_error_msg = ("{} Error: {} for url: "
"{}.\n{}".format(r.status_code, r.reason, r.url, json.dumps(r.json(), indent=4, sort_keys=True)))
raise requests.exceptions.HTTPError(http_error_msg, response=r)
return r.json()
data = get_release_by_tag_name(owner_repo=OWNER_REPO, tag_name=TAG_NAME)
release_id = data['id']
with open('changelog.txt', 'r') as f:
changelog = f.read()
new_body = data['body'] + "\n\n## Changelog\n\n" + changelog
patch_data = {
"body": new_body,
}
patch_url = f"https://api.github.com/repos/{OWNER_REPO}/releases/{release_id}"
r = requests.patch(patch_url, data=json.dumps(patch_data), headers=HEADERS)
if r.status_code != requests.codes.ok:
r.raise_for_status()
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ core-build/
super-build/
debug/
release/
relwithdebinfo/
profile/
/super-build-shared/
/super-build-static/

Expand Down
Loading

0 comments on commit b2e7010

Please sign in to comment.