diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml new file mode 100644 index 00000000..fa8dfbf2 --- /dev/null +++ b/.github/workflows/unit.yml @@ -0,0 +1,30 @@ +# This is a basic workflow to help you get started with Action +name: CI + +# Controls when the workflow will run +on: + push: + branches: main + pull_request: + branches: main + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + coverage-test: + name: Coverage + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Set up ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - name: run specs + run: bundle exec rake spec --trace + - name: Simplecov Report + uses: aki77/simplecov-report-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + failedThreshold: 90 + resultPath: coverage/.last_run.json diff --git a/Gemfile b/Gemfile index 986bc415..0319f14f 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,8 @@ group :test do if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7") gem "ohai", "~> 16" end + + gem "simplecov", require: false end group :development do diff --git a/coverage/.last_run.json b/coverage/.last_run.json new file mode 100644 index 00000000..5bb3b2a1 --- /dev/null +++ b/coverage/.last_run.json @@ -0,0 +1,5 @@ +{ + "result": { + "line": 98.51 + } +} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0b6e2cea..10b5cbfb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,6 +24,8 @@ require "chef/config" require "chef-cli/cli" +require "simplecov" +SimpleCov.start RSpec.configure do |c| running_on_windows = (RUBY_PLATFORM =~ /mswin|mingw|windows/)