From 070a6cafec655f3cd6930665c9a582e08433ea32 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Wed, 29 May 2024 12:57:03 -0600 Subject: [PATCH 1/5] Squashed 'hpxml-measures/' changes from 43696a529f..9b7b04d981 9b7b04d981 Fix msgpack on Windows. 675e5809d8 Merge pull request #1737 from NREL/v180 git-subtree-dir: hpxml-measures git-subtree-split: 9b7b04d9815d3108d4b8660a5731edb28eb1d15f --- HPXMLtoOpenStudio/measure.xml | 8 ++++---- HPXMLtoOpenStudio/resources/hvac_sizing.rb | 2 +- HPXMLtoOpenStudio/resources/output.rb | 2 +- ReportSimulationOutput/measure.rb | 2 +- ReportSimulationOutput/measure.xml | 6 +++--- ReportUtilityBills/measure.rb | 2 +- ReportUtilityBills/measure.xml | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index d2e153625..e7aac3bcd 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - 99f39280-a6e5-47aa-a0c8-9aefa26ea26c - 2024-05-29T02:38:03Z + 19f754cf-2165-45e2-9387-46f301d3d453 + 2024-05-29T18:54:28Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -387,7 +387,7 @@ hvac_sizing.rb rb resource - E9C68804 + 258360CD lighting.rb @@ -429,7 +429,7 @@ output.rb rb resource - 4E4BE5F9 + CF115DD1 psychrometrics.rb diff --git a/HPXMLtoOpenStudio/resources/hvac_sizing.rb b/HPXMLtoOpenStudio/resources/hvac_sizing.rb index 159487455..fcc2c3acd 100644 --- a/HPXMLtoOpenStudio/resources/hvac_sizing.rb +++ b/HPXMLtoOpenStudio/resources/hvac_sizing.rb @@ -4110,7 +4110,7 @@ def self.floors(obj) File.open(output_file_path, 'w') { |json| json.write(JSON.pretty_generate(h)) } elsif output_format == 'msgpack' require 'msgpack' - File.open(output_file_path, 'w') { |json| h.to_msgpack(json) } + File.open(output_file_path, 'wb') { |json| h.to_msgpack(json) } end end end diff --git a/HPXMLtoOpenStudio/resources/output.rb b/HPXMLtoOpenStudio/resources/output.rb index 9010ae6ae..cde28e52d 100644 --- a/HPXMLtoOpenStudio/resources/output.rb +++ b/HPXMLtoOpenStudio/resources/output.rb @@ -342,7 +342,7 @@ def self.write_results_out_to_file(results_out, output_format, output_file_path, require 'json' File.open(output_file_path, mode) { |json| json.write(JSON.pretty_generate(h)) } elsif output_format == 'msgpack' - File.open(output_file_path, mode) { |json| h.to_msgpack(json) } + File.open(output_file_path, "#{mode}b") { |json| h.to_msgpack(json) } end end end diff --git a/ReportSimulationOutput/measure.rb b/ReportSimulationOutput/measure.rb index 608e8508b..e997eb657 100644 --- a/ReportSimulationOutput/measure.rb +++ b/ReportSimulationOutput/measure.rb @@ -1832,7 +1832,7 @@ def report_timeseries_output_results(runner, outputs, timeseries_output_path, ar require 'json' File.open(timeseries_output_path, 'w') { |json| json.write(JSON.pretty_generate(h)) } elsif args[:output_format] == 'msgpack' - File.open(timeseries_output_path, 'w') { |json| h.to_msgpack(json) } + File.open(timeseries_output_path, 'wb') { |json| h.to_msgpack(json) } end end runner.registerInfo("Wrote timeseries output results to #{timeseries_output_path}.") diff --git a/ReportSimulationOutput/measure.xml b/ReportSimulationOutput/measure.xml index 1153c1c3a..6e687184b 100644 --- a/ReportSimulationOutput/measure.xml +++ b/ReportSimulationOutput/measure.xml @@ -3,8 +3,8 @@ 3.1 report_simulation_output df9d170c-c21a-4130-866d-0d46b06073fd - ec111528-5b18-43ad-ae95-0a41f5aaec05 - 2024-05-24T00:08:38Z + e9577eb7-04dc-4d34-b4b2-81b86c0bdd15 + 2024-05-29T18:54:30Z 9BF1E6AC ReportSimulationOutput HPXML Simulation Output Report @@ -1929,7 +1929,7 @@ measure.rb rb script - BA579923 + D25984FD test_report_sim_output.rb diff --git a/ReportUtilityBills/measure.rb b/ReportUtilityBills/measure.rb index 16a5ea6f7..e0a66ae2b 100644 --- a/ReportUtilityBills/measure.rb +++ b/ReportUtilityBills/measure.rb @@ -448,7 +448,7 @@ def report_monthly_output_results(runner, args, timestamps, monthly_data, monthl require 'json' File.open(monthly_output_path, 'w') { |json| json.write(JSON.pretty_generate(h)) } elsif args[:output_format] == 'msgpack' - File.open(monthly_output_path, 'w') { |json| h.to_msgpack(json) } + File.open(monthly_output_path, 'wb') { |json| h.to_msgpack(json) } end end runner.registerInfo("Wrote monthly bills output to #{monthly_output_path}.") diff --git a/ReportUtilityBills/measure.xml b/ReportUtilityBills/measure.xml index d442f94a6..3218a9e35 100644 --- a/ReportUtilityBills/measure.xml +++ b/ReportUtilityBills/measure.xml @@ -3,8 +3,8 @@ 3.1 report_utility_bills ca88a425-e59a-4bc4-af51-c7e7d1e960fe - 71567c67-85c0-4d09-8220-85cc8a1897d6 - 2024-05-27T15:54:13Z + 2d6b4393-2fe5-429a-a130-da41a8cb36f0 + 2024-05-29T18:54:32Z 15BF4E57 ReportUtilityBills Utility Bills Report @@ -180,7 +180,7 @@ measure.rb rb script - 4E7FF5BB + 99961E51 detailed_rates/Sample Flat Rate Min Annual Charge.json From 57d9b7da4670e2163eae8b15da253ab8c345b523 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Wed, 29 May 2024 13:48:33 -0600 Subject: [PATCH 2/5] Another try. --- .github/workflows/config.yml | 512 ++++++++++++++++---------------- workflow/energy_rating_index.rb | 2 +- 2 files changed, 257 insertions(+), 257 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 546dcda93..bca5e71b3 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -8,148 +8,148 @@ on: workflow_dispatch: jobs: - run-ruleset-tests: - runs-on: ubuntu-latest - container: - image: docker://nrel/openstudio:3.8.0 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Install software - run: | - rm -f Gemfile.lock && bundle install - export DEBIAN_FRONTEND=noninteractive - sudo apt update - sudo -E apt-get install -y wget unzip python3-sphinx-rtd-theme - - - name: Check HPXMLs - shell: bash - run: | - echo "Regenerating HPXML files..." - openstudio tasks.rb update_measures - echo "Checking for HPXML differences..." - git config --global --add safe.directory $(realpath .) - git diff --exit-code --ignore-cr-at-eol workflow/*.xml - - - name: Run ruleset tests - run: | - bundle exec rake test_rulesets - - - name: Store code coverage - uses: actions/upload-artifact@v4 - with: - path: coverage - name: coverage - - - name: Build documentation - run: | - cd docs - make html SPHINXOPTS="-W --keep-going -n" - - - name: Check documentation - run: | - echo "Checking for misaligned documentation footnotes..." - for RST_FILE in docs/source/*.rst; do NUM_REFS=$(grep -F -o "[#]_" $RST_FILE | wc -l); NUM_FOOTNOTES=$(grep -F -o ".. [#]" $RST_FILE | wc -l); if [ $NUM_REFS != $NUM_FOOTNOTES ]; then echo "ERROR: Number of footnote references doesn't match number of footnotes in $RST_FILE." && exit 1; fi done - - - name: Save Docs - uses: actions/upload-artifact@v4 - with: - name: documentation - path: docs/_build/html/ - - run-sample-files1-tests: - runs-on: ubuntu-latest - container: - image: docker://nrel/openstudio:3.8.0 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Install software - run: | - rm -f Gemfile.lock && bundle install - - - name: Run Sample Files 1 tests - run: | - bundle exec rake test_sample_files1 - - - name: Store results - uses: actions/upload-artifact@v4 - with: - path: workflow/tests/test_results - name: test_results_sample_files1 - - run-sample-files2-tests: - runs-on: ubuntu-latest - container: - image: docker://nrel/openstudio:3.8.0 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Install software - run: | - rm -f Gemfile.lock && bundle install - - - name: Run Sample Files 2 tests - run: | - bundle exec rake test_sample_files2 - - - name: Store results - uses: actions/upload-artifact@v4 - with: - path: workflow/tests/test_results - name: test_results_sample_files2 - - run-real-home-tests: - runs-on: ubuntu-latest - container: - image: docker://nrel/openstudio:3.8.0 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Install software - run: | - rm -f Gemfile.lock && bundle install - - - name: Run Real Home tests - run: | - bundle exec rake test_real_homes - - - name: Store results - uses: actions/upload-artifact@v4 - with: - path: workflow/tests/test_results - name: test_results_real_homes - - run-other-tests: - runs-on: ubuntu-latest - container: - image: docker://nrel/openstudio:3.8.0 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Install software - run: | - rm -f Gemfile.lock && bundle install - - - name: Run Other tests - run: | - bundle exec rake test_other - - - name: Store results - uses: actions/upload-artifact@v4 - with: - path: workflow/tests/test_results - name: test_results_other + # run-ruleset-tests: + # runs-on: ubuntu-latest + # container: + # image: docker://nrel/openstudio:3.8.0 + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.head_ref }} + + # - name: Install software + # run: | + # rm -f Gemfile.lock && bundle install + # export DEBIAN_FRONTEND=noninteractive + # sudo apt update + # sudo -E apt-get install -y wget unzip python3-sphinx-rtd-theme + + # - name: Check HPXMLs + # shell: bash + # run: | + # echo "Regenerating HPXML files..." + # openstudio tasks.rb update_measures + # echo "Checking for HPXML differences..." + # git config --global --add safe.directory $(realpath .) + # git diff --exit-code --ignore-cr-at-eol workflow/*.xml + + # - name: Run ruleset tests + # run: | + # bundle exec rake test_rulesets + + # - name: Store code coverage + # uses: actions/upload-artifact@v4 + # with: + # path: coverage + # name: coverage + + # - name: Build documentation + # run: | + # cd docs + # make html SPHINXOPTS="-W --keep-going -n" + + # - name: Check documentation + # run: | + # echo "Checking for misaligned documentation footnotes..." + # for RST_FILE in docs/source/*.rst; do NUM_REFS=$(grep -F -o "[#]_" $RST_FILE | wc -l); NUM_FOOTNOTES=$(grep -F -o ".. [#]" $RST_FILE | wc -l); if [ $NUM_REFS != $NUM_FOOTNOTES ]; then echo "ERROR: Number of footnote references doesn't match number of footnotes in $RST_FILE." && exit 1; fi done + + # - name: Save Docs + # uses: actions/upload-artifact@v4 + # with: + # name: documentation + # path: docs/_build/html/ + + # run-sample-files1-tests: + # runs-on: ubuntu-latest + # container: + # image: docker://nrel/openstudio:3.8.0 + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.head_ref }} + + # - name: Install software + # run: | + # rm -f Gemfile.lock && bundle install + + # - name: Run Sample Files 1 tests + # run: | + # bundle exec rake test_sample_files1 + + # - name: Store results + # uses: actions/upload-artifact@v4 + # with: + # path: workflow/tests/test_results + # name: test_results_sample_files1 + + # run-sample-files2-tests: + # runs-on: ubuntu-latest + # container: + # image: docker://nrel/openstudio:3.8.0 + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.head_ref }} + + # - name: Install software + # run: | + # rm -f Gemfile.lock && bundle install + + # - name: Run Sample Files 2 tests + # run: | + # bundle exec rake test_sample_files2 + + # - name: Store results + # uses: actions/upload-artifact@v4 + # with: + # path: workflow/tests/test_results + # name: test_results_sample_files2 + + # run-real-home-tests: + # runs-on: ubuntu-latest + # container: + # image: docker://nrel/openstudio:3.8.0 + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.head_ref }} + + # - name: Install software + # run: | + # rm -f Gemfile.lock && bundle install + + # - name: Run Real Home tests + # run: | + # bundle exec rake test_real_homes + + # - name: Store results + # uses: actions/upload-artifact@v4 + # with: + # path: workflow/tests/test_results + # name: test_results_real_homes + + # run-other-tests: + # runs-on: ubuntu-latest + # container: + # image: docker://nrel/openstudio:3.8.0 + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.head_ref }} + + # - name: Install software + # run: | + # rm -f Gemfile.lock && bundle install + + # - name: Run Other tests + # run: | + # bundle exec rake test_other + + # - name: Store results + # uses: actions/upload-artifact@v4 + # with: + # path: workflow/tests/test_results + # name: test_results_other run-windows-tests: runs-on: windows-latest @@ -166,119 +166,119 @@ jobs: tar -xzf Windows.tar.gz & .\OpenStudio-${env:OS_VERSION}+${env:OS_SHA}-Windows\bin\openstudio.exe workflow\energy_rating_index.rb -x workflow\sample_files\base.xml --daily ALL --add-component-loads --diagnostic-output - merge-results: - runs-on: ubuntu-latest - needs: [run-sample-files1-tests, run-sample-files2-tests, run-real-home-tests, run-other-tests] - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Download all results - uses: actions/download-artifact@v4 - with: - path: test_results - pattern: test_results_* - merge-multiple: true - - - name: Delete artifacts - uses: geekyeggo/delete-artifact@v5 - with: - name: test_results_* - - - name: Merge results - run: | - mkdir workflow/tests/test_results - cp -r test_results/*.csv workflow/tests/test_results - cd workflow/tests - pip install pandas - python ../../hpxml-measures/workflow/tests/merge.py test_results/sample_files1.csv test_results/sample_files2.csv test_results/sample_files.csv - rm test_results/sample_files1.csv - rm test_results/sample_files2.csv - - - name: Store results - uses: actions/upload-artifact@v4 - with: - path: workflow/tests/test_results - name: test_results - - compare-results: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - needs: merge-results - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.base.sha }} - - - name: Store base results - uses: actions/upload-artifact@v4 - with: - path: workflow/tests/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 results - uses: actions/download-artifact@v4 - with: - path: test_results - name: test_results - - - name: Compare results - run: | - cp -r base_results/*.csv workflow/tests/base_results - mkdir workflow/tests/test_results - cp -r test_results/*.csv workflow/tests/test_results + # merge-results: + # runs-on: ubuntu-latest + # needs: [run-sample-files1-tests, run-sample-files2-tests, run-real-home-tests, run-other-tests] + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.head_ref }} + + # - name: Download all results + # uses: actions/download-artifact@v4 + # with: + # path: test_results + # pattern: test_results_* + # merge-multiple: true + + # - name: Delete artifacts + # uses: geekyeggo/delete-artifact@v5 + # with: + # name: test_results_* + + # - name: Merge results + # run: | + # mkdir workflow/tests/test_results + # cp -r test_results/*.csv workflow/tests/test_results + # cd workflow/tests + # pip install pandas + # python ../../hpxml-measures/workflow/tests/merge.py test_results/sample_files1.csv test_results/sample_files2.csv test_results/sample_files.csv + # rm test_results/sample_files1.csv + # rm test_results/sample_files2.csv + + # - name: Store results + # uses: actions/upload-artifact@v4 + # with: + # path: workflow/tests/test_results + # name: test_results + + # compare-results: + # if: github.event_name == 'pull_request' + # runs-on: ubuntu-latest + # needs: merge-results + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.event.pull_request.base.sha }} + + # - name: Store base results + # uses: actions/upload-artifact@v4 + # with: + # path: workflow/tests/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 results + # uses: actions/download-artifact@v4 + # with: + # path: test_results + # name: test_results + + # - name: Compare results + # run: | + # cp -r base_results/*.csv workflow/tests/base_results + # mkdir workflow/tests/test_results + # cp -r test_results/*.csv workflow/tests/test_results - pip install numpy - pip install pandas - pip install plotly - pip install kaleido + # pip install numpy + # pip install pandas + # pip install plotly + # pip install kaleido - python hpxml-measures/workflow/tests/compare.py -a results - python hpxml-measures/workflow/tests/compare.py -a visualize - - - name: Store comparisons - uses: actions/upload-artifact@v4 - with: - path: workflow/tests/comparisons - name: comparisons - - update-results: - runs-on: ubuntu-latest - needs: merge-results - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Download feature results - uses: actions/download-artifact@v4 - with: - path: test_results - name: test_results - - - name: Commit latest results - shell: bash - run: | - branch_name="${{ github.head_ref }}" - git pull origin $branch_name - cp -r test_results/*.csv workflow/tests/base_results - git add workflow/tests/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 + # python hpxml-measures/workflow/tests/compare.py -a results + # python hpxml-measures/workflow/tests/compare.py -a visualize + + # - name: Store comparisons + # uses: actions/upload-artifact@v4 + # with: + # path: workflow/tests/comparisons + # name: comparisons + + # update-results: + # runs-on: ubuntu-latest + # needs: merge-results + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.head_ref }} + + # - name: Download feature results + # uses: actions/download-artifact@v4 + # with: + # path: test_results + # name: test_results + + # - name: Commit latest results + # shell: bash + # run: | + # branch_name="${{ github.head_ref }}" + # git pull origin $branch_name + # cp -r test_results/*.csv workflow/tests/base_results + # git add workflow/tests/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 diff --git a/workflow/energy_rating_index.rb b/workflow/energy_rating_index.rb index f4adc73d3..235214a6a 100644 --- a/workflow/energy_rating_index.rb +++ b/workflow/energy_rating_index.rb @@ -179,7 +179,7 @@ def run_design_spawn(design, options) command += "\"#{options[:add_comp_loads]}\" " command += "\"#{options[:output_format]}\" " command += "\"#{options[:diagnostic_output]}\" " - pid = Process.spawn(command) + pid = Process.spawn(command, STDERR=>STDOUT) return design.design_dir, pid end From 58ce2fab33413990c9d5fcb94a7a4dda1cf24e72 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Wed, 29 May 2024 14:00:50 -0600 Subject: [PATCH 3/5] Another try. --- .github/workflows/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index bca5e71b3..c7a4d1713 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -282,3 +282,4 @@ jobs: # echo "Pushing to branch: $branch_name" # git push -u origin $branch_name # fi + From 8a7adc6e5ca714746c7f9465c04e081e3000054a Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Wed, 29 May 2024 15:28:12 -0600 Subject: [PATCH 4/5] Another try. --- .github/workflows/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index c7a4d1713..bca5e71b3 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -282,4 +282,3 @@ jobs: # echo "Pushing to branch: $branch_name" # git push -u origin $branch_name # fi - From a0570df40d9371c2eb7b6b5bbf124581fd2c7602 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Wed, 29 May 2024 17:13:21 -0600 Subject: [PATCH 5/5] Cleanup. --- .github/workflows/config.yml | 512 ++++++++++++++++---------------- workflow/energy_rating_index.rb | 2 +- 2 files changed, 257 insertions(+), 257 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index bca5e71b3..546dcda93 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -8,148 +8,148 @@ on: workflow_dispatch: jobs: - # run-ruleset-tests: - # runs-on: ubuntu-latest - # container: - # image: docker://nrel/openstudio:3.8.0 - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.head_ref }} - - # - name: Install software - # run: | - # rm -f Gemfile.lock && bundle install - # export DEBIAN_FRONTEND=noninteractive - # sudo apt update - # sudo -E apt-get install -y wget unzip python3-sphinx-rtd-theme - - # - name: Check HPXMLs - # shell: bash - # run: | - # echo "Regenerating HPXML files..." - # openstudio tasks.rb update_measures - # echo "Checking for HPXML differences..." - # git config --global --add safe.directory $(realpath .) - # git diff --exit-code --ignore-cr-at-eol workflow/*.xml - - # - name: Run ruleset tests - # run: | - # bundle exec rake test_rulesets - - # - name: Store code coverage - # uses: actions/upload-artifact@v4 - # with: - # path: coverage - # name: coverage - - # - name: Build documentation - # run: | - # cd docs - # make html SPHINXOPTS="-W --keep-going -n" - - # - name: Check documentation - # run: | - # echo "Checking for misaligned documentation footnotes..." - # for RST_FILE in docs/source/*.rst; do NUM_REFS=$(grep -F -o "[#]_" $RST_FILE | wc -l); NUM_FOOTNOTES=$(grep -F -o ".. [#]" $RST_FILE | wc -l); if [ $NUM_REFS != $NUM_FOOTNOTES ]; then echo "ERROR: Number of footnote references doesn't match number of footnotes in $RST_FILE." && exit 1; fi done - - # - name: Save Docs - # uses: actions/upload-artifact@v4 - # with: - # name: documentation - # path: docs/_build/html/ - - # run-sample-files1-tests: - # runs-on: ubuntu-latest - # container: - # image: docker://nrel/openstudio:3.8.0 - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.head_ref }} - - # - name: Install software - # run: | - # rm -f Gemfile.lock && bundle install - - # - name: Run Sample Files 1 tests - # run: | - # bundle exec rake test_sample_files1 - - # - name: Store results - # uses: actions/upload-artifact@v4 - # with: - # path: workflow/tests/test_results - # name: test_results_sample_files1 - - # run-sample-files2-tests: - # runs-on: ubuntu-latest - # container: - # image: docker://nrel/openstudio:3.8.0 - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.head_ref }} - - # - name: Install software - # run: | - # rm -f Gemfile.lock && bundle install - - # - name: Run Sample Files 2 tests - # run: | - # bundle exec rake test_sample_files2 - - # - name: Store results - # uses: actions/upload-artifact@v4 - # with: - # path: workflow/tests/test_results - # name: test_results_sample_files2 - - # run-real-home-tests: - # runs-on: ubuntu-latest - # container: - # image: docker://nrel/openstudio:3.8.0 - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.head_ref }} - - # - name: Install software - # run: | - # rm -f Gemfile.lock && bundle install - - # - name: Run Real Home tests - # run: | - # bundle exec rake test_real_homes - - # - name: Store results - # uses: actions/upload-artifact@v4 - # with: - # path: workflow/tests/test_results - # name: test_results_real_homes - - # run-other-tests: - # runs-on: ubuntu-latest - # container: - # image: docker://nrel/openstudio:3.8.0 - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.head_ref }} - - # - name: Install software - # run: | - # rm -f Gemfile.lock && bundle install - - # - name: Run Other tests - # run: | - # bundle exec rake test_other - - # - name: Store results - # uses: actions/upload-artifact@v4 - # with: - # path: workflow/tests/test_results - # name: test_results_other + run-ruleset-tests: + runs-on: ubuntu-latest + container: + image: docker://nrel/openstudio:3.8.0 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Install software + run: | + rm -f Gemfile.lock && bundle install + export DEBIAN_FRONTEND=noninteractive + sudo apt update + sudo -E apt-get install -y wget unzip python3-sphinx-rtd-theme + + - name: Check HPXMLs + shell: bash + run: | + echo "Regenerating HPXML files..." + openstudio tasks.rb update_measures + echo "Checking for HPXML differences..." + git config --global --add safe.directory $(realpath .) + git diff --exit-code --ignore-cr-at-eol workflow/*.xml + + - name: Run ruleset tests + run: | + bundle exec rake test_rulesets + + - name: Store code coverage + uses: actions/upload-artifact@v4 + with: + path: coverage + name: coverage + + - name: Build documentation + run: | + cd docs + make html SPHINXOPTS="-W --keep-going -n" + + - name: Check documentation + run: | + echo "Checking for misaligned documentation footnotes..." + for RST_FILE in docs/source/*.rst; do NUM_REFS=$(grep -F -o "[#]_" $RST_FILE | wc -l); NUM_FOOTNOTES=$(grep -F -o ".. [#]" $RST_FILE | wc -l); if [ $NUM_REFS != $NUM_FOOTNOTES ]; then echo "ERROR: Number of footnote references doesn't match number of footnotes in $RST_FILE." && exit 1; fi done + + - name: Save Docs + uses: actions/upload-artifact@v4 + with: + name: documentation + path: docs/_build/html/ + + run-sample-files1-tests: + runs-on: ubuntu-latest + container: + image: docker://nrel/openstudio:3.8.0 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Install software + run: | + rm -f Gemfile.lock && bundle install + + - name: Run Sample Files 1 tests + run: | + bundle exec rake test_sample_files1 + + - name: Store results + uses: actions/upload-artifact@v4 + with: + path: workflow/tests/test_results + name: test_results_sample_files1 + + run-sample-files2-tests: + runs-on: ubuntu-latest + container: + image: docker://nrel/openstudio:3.8.0 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Install software + run: | + rm -f Gemfile.lock && bundle install + + - name: Run Sample Files 2 tests + run: | + bundle exec rake test_sample_files2 + + - name: Store results + uses: actions/upload-artifact@v4 + with: + path: workflow/tests/test_results + name: test_results_sample_files2 + + run-real-home-tests: + runs-on: ubuntu-latest + container: + image: docker://nrel/openstudio:3.8.0 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Install software + run: | + rm -f Gemfile.lock && bundle install + + - name: Run Real Home tests + run: | + bundle exec rake test_real_homes + + - name: Store results + uses: actions/upload-artifact@v4 + with: + path: workflow/tests/test_results + name: test_results_real_homes + + run-other-tests: + runs-on: ubuntu-latest + container: + image: docker://nrel/openstudio:3.8.0 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Install software + run: | + rm -f Gemfile.lock && bundle install + + - name: Run Other tests + run: | + bundle exec rake test_other + + - name: Store results + uses: actions/upload-artifact@v4 + with: + path: workflow/tests/test_results + name: test_results_other run-windows-tests: runs-on: windows-latest @@ -166,119 +166,119 @@ jobs: tar -xzf Windows.tar.gz & .\OpenStudio-${env:OS_VERSION}+${env:OS_SHA}-Windows\bin\openstudio.exe workflow\energy_rating_index.rb -x workflow\sample_files\base.xml --daily ALL --add-component-loads --diagnostic-output - # merge-results: - # runs-on: ubuntu-latest - # needs: [run-sample-files1-tests, run-sample-files2-tests, run-real-home-tests, run-other-tests] - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.head_ref }} - - # - name: Download all results - # uses: actions/download-artifact@v4 - # with: - # path: test_results - # pattern: test_results_* - # merge-multiple: true - - # - name: Delete artifacts - # uses: geekyeggo/delete-artifact@v5 - # with: - # name: test_results_* - - # - name: Merge results - # run: | - # mkdir workflow/tests/test_results - # cp -r test_results/*.csv workflow/tests/test_results - # cd workflow/tests - # pip install pandas - # python ../../hpxml-measures/workflow/tests/merge.py test_results/sample_files1.csv test_results/sample_files2.csv test_results/sample_files.csv - # rm test_results/sample_files1.csv - # rm test_results/sample_files2.csv - - # - name: Store results - # uses: actions/upload-artifact@v4 - # with: - # path: workflow/tests/test_results - # name: test_results - - # compare-results: - # if: github.event_name == 'pull_request' - # runs-on: ubuntu-latest - # needs: merge-results - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.event.pull_request.base.sha }} - - # - name: Store base results - # uses: actions/upload-artifact@v4 - # with: - # path: workflow/tests/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 results - # uses: actions/download-artifact@v4 - # with: - # path: test_results - # name: test_results - - # - name: Compare results - # run: | - # cp -r base_results/*.csv workflow/tests/base_results - # mkdir workflow/tests/test_results - # cp -r test_results/*.csv workflow/tests/test_results + merge-results: + runs-on: ubuntu-latest + needs: [run-sample-files1-tests, run-sample-files2-tests, run-real-home-tests, run-other-tests] + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Download all results + uses: actions/download-artifact@v4 + with: + path: test_results + pattern: test_results_* + merge-multiple: true + + - name: Delete artifacts + uses: geekyeggo/delete-artifact@v5 + with: + name: test_results_* + + - name: Merge results + run: | + mkdir workflow/tests/test_results + cp -r test_results/*.csv workflow/tests/test_results + cd workflow/tests + pip install pandas + python ../../hpxml-measures/workflow/tests/merge.py test_results/sample_files1.csv test_results/sample_files2.csv test_results/sample_files.csv + rm test_results/sample_files1.csv + rm test_results/sample_files2.csv + + - name: Store results + uses: actions/upload-artifact@v4 + with: + path: workflow/tests/test_results + name: test_results + + compare-results: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + needs: merge-results + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.sha }} + + - name: Store base results + uses: actions/upload-artifact@v4 + with: + path: workflow/tests/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 results + uses: actions/download-artifact@v4 + with: + path: test_results + name: test_results + + - name: Compare results + run: | + cp -r base_results/*.csv workflow/tests/base_results + mkdir workflow/tests/test_results + cp -r test_results/*.csv workflow/tests/test_results - # pip install numpy - # pip install pandas - # pip install plotly - # pip install kaleido + pip install numpy + pip install pandas + pip install plotly + pip install kaleido - # python hpxml-measures/workflow/tests/compare.py -a results - # python hpxml-measures/workflow/tests/compare.py -a visualize - - # - name: Store comparisons - # uses: actions/upload-artifact@v4 - # with: - # path: workflow/tests/comparisons - # name: comparisons - - # update-results: - # runs-on: ubuntu-latest - # needs: merge-results - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ github.head_ref }} - - # - name: Download feature results - # uses: actions/download-artifact@v4 - # with: - # path: test_results - # name: test_results - - # - name: Commit latest results - # shell: bash - # run: | - # branch_name="${{ github.head_ref }}" - # git pull origin $branch_name - # cp -r test_results/*.csv workflow/tests/base_results - # git add workflow/tests/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 + python hpxml-measures/workflow/tests/compare.py -a results + python hpxml-measures/workflow/tests/compare.py -a visualize + + - name: Store comparisons + uses: actions/upload-artifact@v4 + with: + path: workflow/tests/comparisons + name: comparisons + + update-results: + runs-on: ubuntu-latest + needs: merge-results + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Download feature results + uses: actions/download-artifact@v4 + with: + path: test_results + name: test_results + + - name: Commit latest results + shell: bash + run: | + branch_name="${{ github.head_ref }}" + git pull origin $branch_name + cp -r test_results/*.csv workflow/tests/base_results + git add workflow/tests/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 diff --git a/workflow/energy_rating_index.rb b/workflow/energy_rating_index.rb index 235214a6a..f4adc73d3 100644 --- a/workflow/energy_rating_index.rb +++ b/workflow/energy_rating_index.rb @@ -179,7 +179,7 @@ def run_design_spawn(design, options) command += "\"#{options[:add_comp_loads]}\" " command += "\"#{options[:output_format]}\" " command += "\"#{options[:diagnostic_output]}\" " - pid = Process.spawn(command, STDERR=>STDOUT) + pid = Process.spawn(command) return design.design_dir, pid end