Skip to content

TOU calculation

TOU calculation #3781

Workflow file for this run

name: ci
on:
push:
branches: [ main, develop ]
pull_request:
types: [ synchronize, opened ]
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-latest
container:
image: docker://nrel/openstudio:3.4.0
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Install gems and software
run: |
rm -f Gemfile.lock && bundle install
sudo apt update
sudo apt-get install -y wget unzip libxml2-utils python3-lxml python3-pip
sudo pip3 install sphinx sphinx-rtd-theme
- 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@v2
with:
path: resources/buildstock.csv
name: samples
- name: Build documentation
run: |
cd docs/read_the_docs
make html SPHINXOPTS="-W --keep-going -n"
- name: Save Docs
uses: actions/upload-artifact@v2
with:
name: documentation
path: docs/read_the_docs/_build/html/
analysis-tests:
runs-on: ubuntu-latest
container:
image: docker://nrel/openstudio:3.4.0
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Install gems
run: |
rm -f Gemfile.lock && bundle install
- name: Run run_analysis.rb
run: |
bundle exec rake workflow:analysis_tests
- name: Upload run_analysis.rb results
uses: actions/upload-artifact@v2
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
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Run buildstockbatch
run: |
pip install git+https://github.com/NREL/buildstockbatch.git@develop
buildstock_docker project_national/national_baseline.yml
buildstock_docker project_testing/testing_baseline.yml
buildstock_docker project_national/national_upgrades.yml
buildstock_docker 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
tar -xvf project_testing/testing_baseline/simulation_output/*.tar.gz -C project_testing/testing_baseline/simulation_output
tar -xvf project_national/national_upgrades/simulation_output/*.tar.gz -C project_national/national_upgrades/simulation_output
tar -xvf project_testing/testing_upgrades/simulation_output/*.tar.gz -C project_testing/testing_upgrades/simulation_output
- name: Run tests
run: |
ruby test/test_bsb_analysis.rb
- name: Process results
run: |
pip install pandas
python test/util.py
- name: Upload integration results
uses: actions/upload-artifact@v2
with:
path: |
baseline
upgrades
name: results
- name: Upload buildstockbatch results
uses: actions/upload-artifact@v2
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_up14.csv
project_testing/testing_upgrades/results_csvs/results_up14.csv
name: buildstockbatch
compare-tools:
runs-on: ubuntu-latest
needs: [unit-tests, analysis-tests, integration-tests]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Download buildstockbatch results
uses: actions/download-artifact@v2
with:
path: buildstockbatch
name: buildstockbatch
- name: Download run_analysis results
uses: actions/download-artifact@v2
with:
path: run_analysis
name: run_analysis
- name: Run tests
run: |
ruby test/test_tools.rb
compare-results:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: [unit-tests, analysis-tests, integration-tests]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Upload base results
uses: actions/upload-artifact@v2
with:
path: test/base_results
name: base_results
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download base results
uses: actions/download-artifact@v2
with:
path: base_results
name: base_results
- name: Download feature samples
uses: actions/download-artifact@v2
with:
path: samples
name: samples
- name: Download feature results
uses: actions/download-artifact@v2
with:
path: results
name: 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@v2
with:
path: test/base_results/comparisons
name: comparisons
update-results:
runs-on: ubuntu-latest
needs: [unit-tests, analysis-tests, integration-tests]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Download feature samples
uses: actions/download-artifact@v2
with:
path: samples
name: samples
- name: Download feature results
uses: actions/download-artifact@v2
with:
path: results
name: results
- 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/results*.csv test/base_results/baseline/timeseries
cp -r results/upgrades/annual/results*.csv test/base_results/upgrades/annual
cp -r results/upgrades/timeseries/results*.csv test/base_results/upgrades/timeseries
git add test/base_results
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