Skip to content

Commit

Permalink
Merge pull request #76 from dry-rb/github-actions
Browse files Browse the repository at this point in the history
Setup GH Actions
  • Loading branch information
flash-gordon authored Nov 6, 2019
2 parents 204f0ad + 3406571 commit 174c9f5
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 39 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: ci

on:
push:
paths:
- .github/workflows/ci.yml
- lib/**
- spec/**

jobs:
tests-mri:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["2.6.x", "2.5.x", "2.4.x"]
include:
- ruby: "2.6.x"
coverage: "true"
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
- name: Download test reporter
if: "matrix.coverage == 'true'"
run: |
mkdir -p tmp/
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
chmod +x ./tmp/cc-test-reporter
./tmp/cc-test-reporter before-build
- name: Run all tests
env:
COVERAGE: ${{matrix.coverage}}
run: |
gem install bundler
bundle install --jobs 4 --retry 3 --without tools docs
bundle exec rake
- name: Send coverage results
if: "matrix.coverage == 'true'"
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
GIT_COMMIT_SHA: ${{github.sha}}
GIT_BRANCH: ${{github.ref}}
GIT_COMMITTED_AT: ${{github.event.head_commit.timestamp}}
run: |
GIT_BRANCH=`ruby -e "puts ENV['GITHUB_REF'].split('/', 3).last"` \
GIT_COMMITTED_AT=`ruby -r time -e "puts Time.iso8601(ENV['GIT_COMMITTED_AT']).to_i"` \
./tmp/cc-test-reporter after-build
tests-others:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: ["jruby:9.2.8", "ruby:rc"]
container:
image: ${{matrix.image}}
steps:
- uses: actions/checkout@v1
- name: Install git
run: |
apt-get update
apt-get install -y --no-install-recommends git
- name: Run all tests
run: |
gem install bundler
bundle install --jobs 4 --retry 3 --without tools docs
bundle exec rspec
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

21 changes: 11 additions & 10 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
if RUBY_ENGINE == 'ruby' && ENV['COVERAGE'] == 'true'
require 'yaml'
rubies = YAML.load(File.read(File.join(__dir__, '..', '.travis.yml')))['rvm']
latest_mri = rubies.select { |v| v =~ /\A\d+\.\d+.\d+\z/ }.max

if RUBY_VERSION == latest_mri
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require 'pathname'

SPEC_ROOT = Pathname(__FILE__).dirname

if ENV['COVERAGE'] == 'true'
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
end

Expand All @@ -18,6 +18,7 @@

require 'warning'

Warning.ignore(/rspec\/mocks/)
Warning.process { |w| raise RuntimeError, w }

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
Expand Down

0 comments on commit 174c9f5

Please sign in to comment.