Skip to content

Commit

Permalink
refactoring of CI from Travis to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Apr 19, 2021
1 parent 9fb1195 commit ef1980e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
1 change: 1 addition & 0 deletions ci-gemfiles/ruby-3.0 → .github/ci-gemfiles/ruby-3.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ gem 'rake'
gem 'rack'
gem 'i18n'
gem 'minitest'
gem 'ansi'

gem 'oj', require: false # false is for testing with or without it

Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/pagy-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pagy CI

on:
push:
branches: ['**']
pull_request:
branches: ['**']

jobs:
test:
name: Ruby ${{ matrix.ruby-version }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- ruby-version: 3.0
env:
BUNDLE_GEMFILE: .github/ci-gemfiles/ruby-3.0
CODECOV: true
fail-fast: false
env: ${{ matrix.env }}

steps:
- uses: actions/checkout@v2

- name: Set up ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Run tests
run: bundle exec rake test

- name: Run rubocop for github
run: bundle exec rubocop --format github

- name: Codecov
if: ${{ env.CODECOV == 'true' }}
uses: codecov/[email protected]
with:
fail_ci_if_error: true
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ AllCops:
TargetRubyVersion: 3.0
NewCops: enable
Exclude:
- ___*/**/* # '___' prefixed dirs are excluded
- ___*/**/* # '___' prefixed dirs are excluded
- vendor/bundle/**/* # avoid Error: RuboCop found unsupported Ruby version 2.1 in `TargetRubyVersion` parameter (in vendor/bundle/ruby/3.0.0/gems/rainbow-3.0.0/.rubocop.yml).

# No, thank you!
Layout:
Expand Down
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

$VERBOSE = {'false' => false, 'true' => true}[ENV['VERBOSE']] if ENV['VERBOSE']

if ENV['RUN_CODECOV']
if ENV['CODECOV']
require 'codecov' # requires also simplecov
SimpleCov.formatter = SimpleCov::Formatter::Codecov
else
# if you want the formatter to upload the results use SimpleCov::Formatter::Codecov instead
SimpleCov.formatter = Codecov::SimpleCov::Formatter
elsif !ENV['CI']
require 'simplecov'
end

Expand Down

0 comments on commit ef1980e

Please sign in to comment.