From 64d2eb9a432236184c856b1c3d13a5bc86e3b82f Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Sun, 5 Jun 2022 12:57:27 +0200 Subject: [PATCH] Add github action for rspec --- .github/workflows/rspec.yml | 34 ++++++++++++++++++++++++++++++++++ Gemfile | 1 + Rakefile | 4 ++++ 3 files changed, 39 insertions(+) create mode 100644 .github/workflows/rspec.yml diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml new file mode 100644 index 0000000..3538355 --- /dev/null +++ b/.github/workflows/rspec.yml @@ -0,0 +1,34 @@ +name: "RSpec" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + rspec: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf + with: + ruby-version: 2.7 + + - name: Install dependencies + run: bundle install --with=ci + + - name: Run tests + run: bundle exec rake spec_github + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() # always run even if the previous step fails + with: + report_paths: 'rspec.xml' diff --git a/Gemfile b/Gemfile index 3cf16ce..b37c960 100644 --- a/Gemfile +++ b/Gemfile @@ -6,4 +6,5 @@ gemspec group :ci do gem 'code-scanning-rubocop' + gem "rspec_junit_formatter" end diff --git a/Rakefile b/Rakefile index 78e0d48..f0ec11c 100644 --- a/Rakefile +++ b/Rakefile @@ -24,3 +24,7 @@ end require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) + +RSpec::Core::RakeTask.new(:spec_github) do |t| + t.rspec_opts = '--format RspecJunitFormatter --out rspec.xml' +end