Skip to content

Commit

Permalink
Migrate Travis to GitHub Actions (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
duffn authored Jun 12, 2022
1 parent 6a5cf5c commit c22dc85
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 35 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: danger

on: [pull_request]

jobs:
danger:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6.2"
bundler-cache: true
- uses: MeilCli/danger-action@v5
with:
danger_file: "Dangerfile"
danger_id: "danger-pr"
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: rubocop

on: [push, pull_request]

jobs:
rubocop:
name: RuboCop
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6.2"
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop
35 changes: 35 additions & 0 deletions .github/workflows/test-mongodb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: test-mongodb

on: [push, pull_request]

jobs:
test-mongodb:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: "54.0"
- name: Download geckodriver
uses: browser-actions/setup-geckodriver@latest
with:
geckodriver-version: "0.18.0"
- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6.2"
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: "5"
mongodb-db: slack-ruby-bot-server-stripe_test
- name: Run tests
uses: GabrielBB/xvfb-action@v1
env:
DATABASE_ADAPTER: mongoid
with:
run: |
bundle install
bundle exec rake
36 changes: 36 additions & 0 deletions .github/workflows/test-postgresql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: test-postgresql

on: [push, pull_request]

jobs:
test-postgresql:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: "54.0"
- name: Download geckodriver
uses: browser-actions/setup-geckodriver@latest
with:
geckodriver-version: "0.18.0"
- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6.2"
- uses: harmon758/postgresql-action@v1
with:
postgresql version: "14"
postgresql db: slack_ruby_bot_server_stripe__test
postgresql user: test
postgresql password: password
- name: Test
uses: GabrielBB/xvfb-action@v1
env:
DATABASE_ADAPTER: activerecord
DATABASE_URL: postgres://test:[email protected]:5432/slack_ruby_bot_server_stripe__test
with:
run: |
bundle install
bundle exec rake spec
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ Slack Ruby Bot Server Stripe Extension
======================================

[![Gem Version](https://badge.fury.io/rb/slack-ruby-bot-server-stripe.svg)](https://badge.fury.io/rb/slack-ruby-bot-server-stripe)
[![Build Status](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-stripe.svg?branch=master)](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-stripe)
[![mongodb](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-mongodb.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-mongodb.yml)
[![postgresql](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-postgresql.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/test-postgresql.yml)
[![rubocop](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/rubocop.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-stripe/actions/workflows/rubocop.yml)

A model extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that enables trials and paid subscriptions for your bots using [Stripe](https://stripe.com).

Expand Down
2 changes: 1 addition & 1 deletion lib/slack-ruby-bot-server-stripe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'stripe'

require 'slack-ruby-bot-server'
require 'slack-ruby-bot-server-rtm'

require_relative 'slack-ruby-bot-server-stripe/version'
require_relative 'slack-ruby-bot-server-stripe/config'
Expand Down
2 changes: 1 addition & 1 deletion slack-ruby-bot-server-stripe.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
spec.require_paths = ['lib']

spec.add_dependency 'slack-ruby-bot-server', '>= 0.12.0'
spec.add_dependency 'slack-ruby-bot-server-rtm'
spec.add_dependency 'stripe', '~> 1.58.0'
end
7 changes: 6 additions & 1 deletion spec/database_adapters/activerecord/activerecord.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# frozen_string_literal: true

db_config = YAML.safe_load(File.read(File.expand_path('postgresql.yml', __dir__)), [], [], true)[ENV['RACK_ENV']]
yml = ERB.new(File.read(File.expand_path('postgresql.yml', __dir__))).result
db_config = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
::YAML.safe_load(yml, aliases: true)[ENV['RACK_ENV']]
else
::YAML.safe_load(yml, [], [], true)[ENV['RACK_ENV']]
end
ActiveRecord::Tasks::DatabaseTasks.create(db_config)
ActiveRecord::Base.establish_connection(db_config)
ActiveRecord::Base.logger.level = :info
1 change: 1 addition & 0 deletions spec/database_adapters/activerecord/postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ development:
test:
<<: *default
database: slack_ruby_bot_server_stripe__test
url: <%= ENV["DATABASE_URL"] %>

production:
<<: *default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe SlackRubyBotServer::Stripe::Commands::Subscription, vcr: { cassette_name: 'slack/user_info' } do
let(:app) { SlackRubyBotServer::Server.new(team: team) }
let(:app) { SlackRubyBotServer::RealTime::Server.new(team: team) }
let(:client) { app.send(:client) }
shared_examples_for 'subscription' do
context 'on trial' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe SlackRubyBotServer::Stripe::Commands::Unsubscribe, vcr: { cassette_name: 'slack/user_info' } do
let(:app) { SlackRubyBotServer::Server.new(team: team) }
let(:app) { SlackRubyBotServer::RealTime::Server.new(team: team) }
let(:client) { app.send(:client) }
shared_examples_for 'unsubscribe' do
context 'on trial' do
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

Bundler.require

require 'slack-ruby-bot/rspec'
require 'slack-ruby-bot-server/rspec'

Dir[File.join(__dir__, 'support', '**/*.rb')].sort.each do |file|
Expand Down
1 change: 1 addition & 0 deletions spec/support/api/endpoints/endpoint_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'rack/test'
require 'hyperclient'

module SlackRubyBotServer
Expand Down

0 comments on commit c22dc85

Please sign in to comment.