From f919f9552c6643763aba84cdf83ccbf63df2b35b Mon Sep 17 00:00:00 2001 From: Jan Graichen Date: Sat, 20 Jul 2024 13:29:07 +0200 Subject: [PATCH] chore: Set up GitHub actions CI --- .github/workflows/maintenance-cache-wipe.yml | 13 ++++++ .../maintenance-workflow-cleanup.yml | 17 ++++++++ .github/workflows/test.yml | 43 +++++++++++++++++++ .travis.yml | 13 ------ Gemfile | 4 +- spec/spec_helper.rb | 16 ++++--- 6 files changed, 86 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/maintenance-cache-wipe.yml create mode 100644 .github/workflows/maintenance-workflow-cleanup.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/maintenance-cache-wipe.yml b/.github/workflows/maintenance-cache-wipe.yml new file mode 100644 index 0000000..2871734 --- /dev/null +++ b/.github/workflows/maintenance-cache-wipe.yml @@ -0,0 +1,13 @@ +--- +name: maintenance-cache-clear +on: + schedule: + - cron: "0 0 1 * *" + workflow_dispatch: + +jobs: + cache-clear: + runs-on: ubuntu-latest + + steps: + - uses: easimon/wipe-cache@v2 diff --git a/.github/workflows/maintenance-workflow-cleanup.yml b/.github/workflows/maintenance-workflow-cleanup.yml new file mode 100644 index 0000000..dd4b060 --- /dev/null +++ b/.github/workflows/maintenance-workflow-cleanup.yml @@ -0,0 +1,17 @@ +--- +name: maintenance-workflow-cleanup +on: + schedule: + - cron: "0 0 1 * *" + workflow_dispatch: + +jobs: + delete-workflow-runs: + runs-on: ubuntu-latest + steps: + - uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: 180 + keep_minimum_runs: 50 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6d999f1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +--- +name: test +on: push +jobs: + rspec: + name: "ruby-${{ matrix.ruby }}" + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + ruby: + - "3.3" + - "3.2" + - "3.1" + - "3.0" + - "2.7" + + env: + BUNDLE_WITHOUT: development + + steps: + - uses: actions/checkout@master + + - run: | + apt-get update --quiet + apt-get install --quiet --yes libkrb5-dev + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + env: + BUNDLE_JOBS: 4 + BUNDLE_RETRY: 3 + + - run: | + bundle exec rspec --color --format documentation + + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e5a1b12..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: ruby -cache: bundler -rvm: -- '2.4.0' -- '2.3.3' -- '2.2.6' -- '2.1.10' -env: - global: - secure: GFgbyRIlAc93IyH5clByNGS9iI/5OSaa2Ba0iGemyLR93I80qxIUNgMvXzp74YTTbGTrWyz9JPBSD14uO/3tuPYhXuawbDT0k1D/97Xm7wMhxLXZNSEATKt71g3bk/106fy+ULz6aqzQWnLkGHsvfg3vlkdyn8rX/X1HstajrcI= -after_success: - - bundle exec codeclimate-test-reporter diff --git a/Gemfile b/Gemfile index 16239e5..927a9ae 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,9 @@ source 'https://rubygems.org' # Specify your gem's dependencies in omniauth-kerberos.gemspec gemspec -gem 'codeclimate-test-reporter', '~> 1.0' gem 'rack-test' gem 'rake' gem 'rspec' + +gem 'simplecov' +gem 'simplecov-cobertura' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bb59cce..1dbbe0a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,13 +1,17 @@ require 'rspec' -if ENV['CI'] || (defined?(:RUBY_ENGINE) && RUBY_ENGINE != 'rbx') - begin - require 'simplecov' - SimpleCov.start - rescue LoadError - end +require 'simplecov' +require 'simplecov-cobertura' + +SimpleCov.start do + add_filter 'spec' end +SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::CoberturaFormatter, +] + require 'omniauth-kerberos' Dir[File.expand_path('spec/support/**/*.rb')].each { |f| require f }