Skip to content

Commit

Permalink
GitHub action coveralls (#236)
Browse files Browse the repository at this point in the history
* add Actions workflow with coveralls

* require simplecov in gemspec

* start simplecov in spec_helper

* comment schedule for testing

* remove bit of requirement line in gemspec that only makes sense in gemfile

* remove certified-update command from ci

* add coverage badge to readme

* remove testing ci run and run weeknights on schedule
  • Loading branch information
vtnate committed Jul 14, 2022
1 parent 3345753 commit 28e5068
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/nightly_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

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: '21 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-geojson-gem.lcov"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# URBANopt GeoJSON Gem

[![Coverage Status](https://coveralls.io/repos/github/urbanopt/urbanopt-geojson-gem/badge.svg?branch=github-action-coveralls)](https://coveralls.io/github/urbanopt/urbanopt-geojson-gem?branch=github-action-coveralls)

Library and measures to translate URBANopt™ GeoJSON format to OpenStudio. See the [developer documentation](https://urbanopt.github.io/urbanopt-geojson-gem/) for more details.

## Installation
Expand Down
10 changes: 10 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/geojson'

Expand Down
2 changes: 2 additions & 0 deletions urbanopt-geojson-gem.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ 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-schema', '~> 2.8'
spec.add_runtime_dependency 'urbanopt-core', '~> 0.8.0'
Expand Down

0 comments on commit 28e5068

Please sign in to comment.