diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml new file mode 100644 index 0000000..aa8b5b6 --- /dev/null +++ b/.github/workflows/nightly_build.yml @@ -0,0 +1,41 @@ +name: nightly_build + +on: + # push: + schedule: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule + # 5 am UTC (11pm MDT the day before) every weekday night in MDT + - cron: '22 5 * * 2-6' + +# Cancels an existing job (of the same workflow) if it is still running +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow +# concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: true + +env: + # This env var should enforce develop branch of all dependencies + FAVOR_LOCAL_GEMS: true + GEM_DEVELOPER_KEY: ${{ secrets.GEM_DEVELOPER_KEY }} + +jobs: + weeknight-tests: + # Pinned to `ubuntu-20.04`. When ubuntu-latest adopts 22.04 it would break for us since 22 only supports Ruby 3.1 + # https://github.com/ruby/setup-ruby#supported-platforms + runs-on: ubuntu-20.04 + container: + image: docker://nrel/openstudio:3.4.0 + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Update gems + run: | + bundle update + - name: Run Rspec + run: bundle exec rspec + # coveralls action docs: https://github.com/marketplace/actions/coveralls-github-action + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: "./coverage/lcov/urbanopt-reporting-gem.lcov" diff --git a/CHANGELOG.md b/CHANGELOG.md index fd422d7..71ceed6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,18 @@ # URBANopt Reporting Gem +## Version 0.6.2 +Date Range: 06/28/22 - 08/17/22 + +- Fixed [#118]( https://github.com/urbanopt/urbanopt-reporting-gem/pull/118 ), set up actions with coveralls +- Fixed [#119]( https://github.com/urbanopt/urbanopt-reporting-gem/pull/119 ), emissions bug fix + ## Version 0.6.1 -Date Range: 05/10-22 - 06/27/22: +Date Range: 05/10-22 - 06/27/22 - Fixed [#114]( https://github.com/urbanopt/urbanopt-reporting-gem/pull/114 ), added natural gas, propane and fuel oil emissions reporting ## Version 0.6.0 -Date Range: 11/22/21 - 05/09/22: +Date Range: 11/22/21 - 05/09/22 - Fixed [#95]( https://github.com/urbanopt/urbanopt-reporting-gem/pull/95 ), adding additional PV fields to UO output reports - Fixed [#98]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/98 ), add RNM results fields to schema diff --git a/README.md b/README.md index 351827b..d2b0a92 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # URBANopt Reporting Gem +[![Coverage Status](https://coveralls.io/repos/github/urbanopt/urbanopt-reporting-gem/badge.svg?branch=develop)](https://coveralls.io/github/urbanopt/urbanopt-reporting-gem?branch=develop) + The URBANopt Reporting Gem defines the URABNopt reports (Scenario and Feature reports). It also includes the default reporting measure which query results from the energyplus sql database and reports it in the Feature reports. @@ -27,9 +29,9 @@ Or install it yourself as: Check out the repository and then execute: $ bundle install - $ bundle update + $ bundle update $ bundle exec rake - + ## Releasing * Update CHANGELOG.md diff --git a/lib/urbanopt/reporting/default_reports/reporting_period.rb b/lib/urbanopt/reporting/default_reports/reporting_period.rb index 4ac6ad4..7b8e49d 100644 --- a/lib/urbanopt/reporting/default_reports/reporting_period.rb +++ b/lib/urbanopt/reporting/default_reports/reporting_period.rb @@ -222,7 +222,7 @@ def to_hash result[:comfort_result] = comfort_result_hash if @comfort_result emissions_hash = @emissions if @emissions - #emissions_hash.delete_if { |k, v| v.nil? } + emissions_hash.delete_if { |k, v| v.nil? } result[:emissions] = emissions_hash if @emissions # validates +reporting_period+ properties against schema for reporting period. diff --git a/lib/urbanopt/reporting/version.rb b/lib/urbanopt/reporting/version.rb index 21f704b..1ef475e 100644 --- a/lib/urbanopt/reporting/version.rb +++ b/lib/urbanopt/reporting/version.rb @@ -40,6 +40,6 @@ module URBANopt module Reporting - VERSION = '0.6.1'.freeze + VERSION = '0.6.2'.freeze end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e93f202..8d119f3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -38,6 +38,16 @@ # OF THE POSSIBILITY OF SUCH DAMAGE. # ********************************************************************************* +require 'simplecov' +require 'simplecov-lcov' + +SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true +SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter +# Don't consider the spec folder for test coverage reporting (inside the do/end loop) +SimpleCov.start do + add_filter '/spec/' +end + require 'bundler/setup' require 'urbanopt/reporting' diff --git a/urbanopt-reporting-gem.gemspec b/urbanopt-reporting-gem.gemspec index 029c4e1..357be7f 100644 --- a/urbanopt-reporting-gem.gemspec +++ b/urbanopt-reporting-gem.gemspec @@ -26,6 +26,9 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 2.1.0' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.9' + spec.add_development_dependency 'simplecov', '~> 0.18.2' + spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0' + spec.add_runtime_dependency 'json_pure', '~> 2.3' spec.add_runtime_dependency 'json-schema', '~> 2.8' spec.add_runtime_dependency 'openstudio-extension', '~> 0.5.1'