Skip to content

Latest OS-HPXML

Latest OS-HPXML #3836

Workflow file for this run

name: ci
on:
push:
branches: [ main, develop ]
pull_request:
types: [ synchronize, opened ]
workflow_dispatch:
jobs:
format-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Format Files
shell: bash
run: |
sed -i -e 's/[[:space:]]*$//' resources/options_lookup.tsv # Remove whitespace
(sed -u 1q ; sort -k1 -k2) < resources/options_lookup.tsv > sorted_options_lookup.tsv
mv sorted_options_lookup.tsv resources/options_lookup.tsv # Sort on first two columns
- name: Upload formatted options_lookup
uses: actions/upload-artifact@v3
with:
path: resources/options_lookup.tsv
name: options_lookup
unit-tests:
runs-on: ubuntu-latest
needs: [format-files]
container:
image: docker://nrel/openstudio:3.6.1
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Install gems
run: |
rm -f Gemfile.lock && bundle install
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
with:
path: resources
name: options_lookup
- name: Run integrity checks for all projects
run: |
bundle exec rake unit_tests:project_integrity_checks
- name: Run all integrity check unit tests
run: |
bundle exec rake unit_tests:integrity_check_tests
- name: Run all measure tests
run: |
bundle exec rake unit_tests:measure_tests
- name: Upload feature samples
uses: actions/upload-artifact@v3
with:
path: resources/buildstock.csv
name: feature_samples
- name: Store code coverage
uses: actions/upload-artifact@v3
with:
path: coverage
name: coverage
analysis-tests:
runs-on: ubuntu-latest
needs: [format-files]
container:
image: docker://nrel/openstudio:3.6.1
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Install gems
run: |
rm -f Gemfile.lock && bundle install
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
with:
path: resources
name: options_lookup
- name: Run run_analysis.rb
run: |
bundle exec rake workflow:analysis_tests
- name: Upload run_analysis.rb results
uses: actions/upload-artifact@v3
with:
path: |
project_national/results-Baseline.csv
project_testing/results-Baseline.csv
project_national/results-AllUpgrades.csv
project_testing/results-AllUpgrades.csv
name: run_analysis_results_csvs
integration-tests:
runs-on: ubuntu-latest
needs: [format-files]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Download and Install OpenStudio
run: |
wget -q https://github.com/NREL/OpenStudio/releases/download/v3.6.1/OpenStudio-3.6.1+bb9481519e-Ubuntu-20.04-x86_64.deb
sudo apt install -y ./OpenStudio-3.6.1+bb9481519e-Ubuntu-20.04-x86_64.deb
openstudio openstudio_version
which openstudio
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
with:
path: resources
name: options_lookup
- name: Run buildstockbatch
run: |
pip install git+https://github.com/NREL/buildstockbatch.git@v2023.06.0
buildstock_local project_national/national_baseline.yml
buildstock_local project_testing/testing_baseline.yml
buildstock_local project_national/national_upgrades.yml
buildstock_local project_testing/testing_upgrades.yml
- name: Unzip results
run: |
gunzip -v project_national/national_baseline/results_csvs/*.csv.gz
gunzip -v project_testing/testing_baseline/results_csvs/*.csv.gz
gunzip -v project_national/national_upgrades/results_csvs/*.csv.gz
gunzip -v project_testing/testing_upgrades/results_csvs/*.csv.gz
tar -xvf project_national/national_baseline/simulation_output/*.tar.gz -C project_national/national_baseline/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw'
tar -xvf project_testing/testing_baseline/simulation_output/*.tar.gz -C project_testing/testing_baseline/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw' --wildcards '*in.osm' --wildcards '*in.idf'
tar -xvf project_national/national_upgrades/simulation_output/*.tar.gz -C project_national/national_upgrades/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw'
tar -xvf project_testing/testing_upgrades/simulation_output/*.tar.gz -C project_testing/testing_upgrades/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw' --wildcards '*in.osm' --wildcards '*in.idf'
- name: Process results
run: |
pip install plotly
python test/process_bsb_analysis.py
- name: Run tests
run: |
sudo gem install minitest-reporters
sudo gem install simplecov
sudo gem install simplecov-html
ruby test/test_bsb_analysis.rb
- name: Upload integration results
uses: actions/upload-artifact@v3
with:
path: |
baseline
upgrades
name: feature_results
- name: Upload buildstockbatch results
uses: actions/upload-artifact@v3
with:
path: |
project_national/national_baseline/results_csvs/results_up00.csv
project_testing/testing_baseline/results_csvs/results_up00.csv
project_national/national_upgrades/results_csvs/results_up16.csv
project_testing/testing_upgrades/results_csvs/results_up16.csv
name: buildstockbatch_results_csvs
compare-tools:
runs-on: ubuntu-latest
needs: [analysis-tests, integration-tests]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Download buildstockbatch results
uses: actions/download-artifact@v3
with:
path: buildstockbatch
name: buildstockbatch_results_csvs
- name: Download run_analysis results
uses: actions/download-artifact@v3
with:
path: run_analysis
name: run_analysis_results_csvs
- name: Run tests
run: |
sudo gem install minitest-reporters
sudo gem install simplecov
sudo gem install simplecov-html
ruby test/test_analysis_tools.rb
compare-results:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: [integration-tests]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Upload base results
uses: actions/upload-artifact@v3
with:
path: test/base_results
name: base_results
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download base results
uses: actions/download-artifact@v3
with:
path: base_results
name: base_results
- name: Download feature samples
uses: actions/download-artifact@v3
with:
path: samples
name: feature_samples
- name: Download feature results
uses: actions/download-artifact@v3
with:
path: results
name: feature_results
- name: Compare samples and results
run: |
pip install numpy
pip install pandas
pip install plotly
pip install kaleido
mkdir test/base_results/comparisons
mkdir test/base_results/comparisons/baseline
mkdir test/base_results/comparisons/baseline/annual
python test/compare.py -a samples -b base_results/baseline/annual -f samples -e test/base_results/comparisons/baseline/annual
python test/compare.py -a results -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
python test/compare.py -a results -af sum -ac build_existing_model.geometry_building_type_recs -x results_output_building_type_sum.csv -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
python test/compare.py -a visualize -dc build_existing_model.geometry_building_type_recs -x results_output_building_type.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
# python test/compare.py -a visualize -dc build_existing_model.geometry_foundation_type -x results_output_foundation_type.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
# python test/compare.py -a visualize -dc build_existing_model.census_region -x results_output_cr.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
# python test/compare.py -a visualize -dc build_existing_model.geometry_building_type_recs -ac build_existing_model.census_region -af sum -x results_output_cr_sum.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
mkdir test/base_results/comparisons/baseline/timeseries
python test/compare.py -a timeseries -b base_results/baseline/timeseries -f results/baseline/timeseries -e test/base_results/comparisons/baseline/timeseries
mkdir test/base_results/comparisons/upgrades
mkdir test/base_results/comparisons/upgrades/annual
python test/compare.py -a results -b base_results/upgrades/annual -f results/upgrades/annual -e test/base_results/comparisons/upgrades/annual
python test/compare.py -a visualize -x results_output.html -b base_results/upgrades/annual -f results/upgrades/annual -e test/base_results/comparisons/upgrades/annual
mkdir test/base_results/comparisons/upgrades/timeseries
python test/compare.py -a timeseries -b base_results/upgrades/timeseries -f results/upgrades/timeseries -e test/base_results/comparisons/upgrades/timeseries
- name: Upload comparisons
uses: actions/upload-artifact@v3
with:
path: test/base_results/comparisons
name: comparisons
update-results:
runs-on: ubuntu-latest
needs: [integration-tests]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Install software
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt update
sudo -E apt-get install -y wget unzip python3-sphinx-rtd-theme
- name: Download feature samples
uses: actions/download-artifact@v3
with:
path: samples
name: feature_samples
- name: Download feature results
uses: actions/download-artifact@v3
with:
path: results
name: feature_results
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
with:
path: resources
name: options_lookup
- name: Commit latest results
shell: bash
run: |
branch_name="${{ github.head_ref }}"
git pull origin $branch_name
cp -r samples/buildstock*.csv test/base_results/baseline/annual
cp -r results/baseline/annual/results*.csv test/base_results/baseline/annual
cp -r results/baseline/timeseries/*.csv test/base_results/baseline/timeseries
cp -r results/upgrades/annual/results*.csv test/base_results/upgrades/annual
cp -r results/upgrades/timeseries/*.csv test/base_results/upgrades/timeseries
git add test/base_results
git add docs
git add resources/options_lookup.tsv
git status
if [[ $(git diff --cached --exit-code) ]]; then
git config --global user.email "github-action@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -m "Latest results."
echo "Pushing to branch: $branch_name"
git push -u origin $branch_name
fi
- name: Build documentation
run: |
ruby docs/read_the_docs/source/workflow_inputs/create_characteristics_rst.rb
ruby docs/read_the_docs/source/workflow_outputs/csv_tables.rb
cd docs/read_the_docs
make html SPHINXOPTS="-W --keep-going -n"
- name: Save Docs
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs/read_the_docs/_build/html/