Add new pool heater technology (Electric Heat Pump) #5020
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: ci | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
types: [ synchronize, opened ] | |
workflow_dispatch: | |
env: | |
OPENSTUDIO_VER: 3.9.0 | |
OPENSTUDIO_SHA: c77fbb9569 | |
OPENSTUDIO_PLATFORM: Ubuntu-22.04-x86_64 | |
OPENSTUDIO_EXT: deb | |
OPENSTUDIO_URL: https://github.com/NREL/OpenStudio/releases/download/v3.9.0 | |
jobs: | |
format-files: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
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@v4 | |
with: | |
path: resources/options_lookup.tsv | |
name: options_lookup | |
unit-tests: | |
runs-on: ubuntu-22.04 | |
needs: [format-files] | |
container: | |
image: docker://nrel/openstudio:3.9.0 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Install gems | |
run: | | |
rm -f Gemfile.lock && bundle install | |
- name: Download formatted options_lookup | |
uses: actions/download-artifact@v4 | |
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@v4 | |
with: | |
path: resources/buildstock.csv | |
name: feature_samples | |
- name: Store code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
path: coverage | |
name: coverage | |
analysis-tests: | |
runs-on: ubuntu-22.04 | |
needs: [unit-tests] | |
container: | |
image: docker://nrel/openstudio:3.9.0 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Install gems | |
run: | | |
rm -f Gemfile.lock && bundle install | |
- name: Install python | |
shell: bash | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
sudo apt update | |
sudo -E apt-get install -y python3-pip | |
- name: Install python dependencies | |
run : | | |
python3 -m pip install --progress-bar off --upgrade pip | |
pip3 install --progress-bar off pandas pyyaml | |
- name: Download formatted options_lookup | |
uses: actions/download-artifact@v4 | |
with: | |
path: resources | |
name: options_lookup | |
- name: Generate precomputed buildstocks | |
run: | | |
python3 test/update_yml_precomputed_files.py | |
- name: Run run_analysis.rb | |
run: | | |
bundle exec rake workflow:analysis_tests | |
- name: Upload precomputed buildstocks | |
uses: actions/upload-artifact@v4 | |
with: | |
path: test/tests_yml_files/yml_precomputed*/buildstock*.csv | |
name: precomputed_buildstocks | |
- name: Upload run_analysis.rb results | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
project_national/results-Baseline.csv | |
project_testing/results-Baseline.csv | |
project_national/results-PackageUpgrade.csv | |
project_testing/results-PackageUpgrade.csv | |
name: run_analysis_results_csvs | |
integration-tests: | |
runs-on: ubuntu-22.04 | |
needs: [unit-tests] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Download and Install OpenStudio | |
run: | | |
export OS_DEBFILE="OpenStudio-$OPENSTUDIO_VER+$OPENSTUDIO_SHA-$OPENSTUDIO_PLATFORM.$OPENSTUDIO_EXT" | |
wget -q $OPENSTUDIO_URL/$OS_DEBFILE | |
sudo apt install -y ./$OS_DEBFILE | |
openstudio openstudio_version | |
which openstudio | |
- name: Download formatted options_lookup | |
uses: actions/download-artifact@v4 | |
with: | |
path: resources | |
name: options_lookup | |
- name: Run buildstockbatch | |
run: | | |
pip install git+https://github.com/NREL/buildstockbatch.git@develop | |
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: Upload integration results | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
baseline | |
upgrades | |
name: feature_results | |
- name: Upload buildstockbatch results | |
uses: actions/upload-artifact@v4 | |
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_up17.csv | |
project_testing/testing_upgrades/results_csvs/results_up17.csv | |
name: buildstockbatch_results_csvs | |
- name: Run tests | |
run: | | |
sudo gem install minitest-reporters | |
sudo gem install simplecov | |
sudo gem install simplecov-html | |
ruby test/test_bsb_analysis.rb | |
compare-tools: | |
runs-on: ubuntu-22.04 | |
needs: [analysis-tests, integration-tests] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Download buildstockbatch results | |
uses: actions/download-artifact@v4 | |
with: | |
path: buildstockbatch | |
name: buildstockbatch_results_csvs | |
- name: Download run_analysis results | |
uses: actions/download-artifact@v4 | |
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-22.04 | |
needs: [integration-tests] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
- name: Upload base results | |
uses: actions/upload-artifact@v4 | |
with: | |
path: test/base_results | |
name: base_results | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Download base results | |
uses: actions/download-artifact@v4 | |
with: | |
path: base_results | |
name: base_results | |
- name: Download feature samples | |
uses: actions/download-artifact@v4 | |
with: | |
path: samples | |
name: feature_samples | |
- name: Download feature results | |
uses: actions/download-artifact@v4 | |
with: | |
path: results | |
name: feature_results | |
- name: Compare samples and results | |
run: | | |
pip install numpy | |
pip install pandas | |
pip install plotly | |
pip install kaleido | |
# baseline annual | |
mkdir -p 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 # base_samples.csv, feature_samples.csv | |
python test/compare.py -a results -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual # results_characteristics.csv, results_output.csv | |
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 # results_output_building_type_sum.csv | |
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 # *.html | |
# baseline timeseries | |
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 # cvrmse_nmbe_*.csv | |
# upgrades annual | |
mkdir -p 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 # results_output.csv | |
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 # *.html | |
# upgrades timeseries | |
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 # cvrmse_nmbe_*.csv | |
- name: Upload comparisons | |
uses: actions/upload-artifact@v4 | |
with: | |
path: test/base_results/comparisons | |
name: comparisons | |
update-results: | |
runs-on: ubuntu-22.04 | |
needs: [analysis-tests, integration-tests] | |
steps: | |
- uses: actions/checkout@v4 | |
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@v4 | |
with: | |
path: samples | |
name: feature_samples | |
- name: Download feature results | |
uses: actions/download-artifact@v4 | |
with: | |
path: results | |
name: feature_results | |
- name: Download formatted options_lookup | |
uses: actions/download-artifact@v4 | |
with: | |
path: resources | |
name: options_lookup | |
- name: Download precomputed buildstocks | |
uses: actions/download-artifact@v4 | |
with: | |
path: test/tests_yml_files | |
name: precomputed_buildstocks | |
- name: Build documentation | |
run: | | |
sudo gem install oga | |
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 | |
pip install changelog | |
make html SPHINXOPTS="-W --keep-going -n" | |
- name: Save Docs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation | |
path: docs/read_the_docs/_build/html/ | |
- 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 add test/tests_yml_files | |
git status | |
if [[ $(git diff --cached --exit-code) ]]; then | |
git config --global user.email "[email protected]" | |
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 |