Skip to content

Commit e2de3c0

Browse files
Replace Travis CI with GHA (#13)
* add workflows for rubocop, mongo, postgres * use meaningful name for workflows * add danger for PR linting, remove xvfb * use services for postgres container * parse yml with ERB for env var * fix typo * try danger on pull, add some badges * add all badges, revert pull in danger flow * add changelog * remove browser env that is unnecessary
1 parent fb68e18 commit e2de3c0

File tree

9 files changed

+107
-19
lines changed

9 files changed

+107
-19
lines changed

.github/workflows/danger.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: danger
3+
on: [pull_request]
4+
jobs:
5+
danger:
6+
runs-on: ubuntu-20.04
7+
steps:
8+
- uses: actions/checkout@v1
9+
- name: Set up Ruby
10+
uses: ruby/setup-ruby@v1
11+
with:
12+
ruby-version: 2.6
13+
bundler-cache: true
14+
- name: Run Danger
15+
run: |
16+
# the personal token is public, this is ok, base64 encode to avoid tripping Github
17+
TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode)
18+
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose

.github/workflows/rubocop.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: lint
3+
on: [push, pull_request]
4+
jobs:
5+
lint:
6+
name: RuboCop
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Ruby
11+
uses: ruby/setup-ruby@v1
12+
with:
13+
ruby-version: 2.7
14+
bundler-cache: true
15+
- name: Run RuboCop
16+
run: bundle exec rubocop

.github/workflows/test-mongodb.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: test with mongodb
3+
on: [push, pull_request]
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
entry:
10+
- { ruby: 2.6.2, mongoid: 6.4.8, mongodb: 4.4 }
11+
- { ruby: 2.6.2, mongoid: 7.2.3, mongodb: 4.4 }
12+
- { ruby: 2.6.2, mongoid: 7.3.0, mongodb: 4.4 }
13+
name: test (ruby=${{ matrix.entry.ruby }}, mongoid=${{ matrix.entry.mongoid }}, mongodb=${{ matrix.entry.mongodb }})
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: ${{ matrix.entry.ruby }}
19+
- uses: supercharge/[email protected]
20+
with:
21+
mongodb-version: ${{ matrix.entry.mongodb }}
22+
- name: Test
23+
run: |
24+
bundle install
25+
bundle exec rake spec
26+
env:
27+
DATABASE_ADAPTER: mongoid
28+
MONGOID_VERSION: ${{ matrix.entry.mongoid }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: test with postgresql
3+
on: [push, pull_request]
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
entry:
10+
- { ruby: 2.6.2, postgresql: 11 }
11+
- { ruby: 2.6.2, postgresql: 14 }
12+
name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }})
13+
services:
14+
postgres:
15+
image: postgres:${{ matrix.entry.postgresql }}
16+
env:
17+
POSTGRES_USER: test
18+
POSTGRES_PASSWORD: password
19+
POSTGRES_DB: slack_ruby_bot_server_slack_test
20+
ports:
21+
- 5432:5432
22+
# needed because the postgres container does not provide a healthcheck
23+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: ruby/setup-ruby@v1
27+
with:
28+
ruby-version: ${{ matrix.entry.ruby }}
29+
- name: Test
30+
run: |
31+
bundle install
32+
bundle exec rake spec
33+
env:
34+
DATABASE_ADAPTER: activerecord
35+
DATABASE_URL: postgres://test:password@localhost/slack_ruby_bot_server_slack_test

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#### 0.3.2 (Next)
44

5+
* [#13](https://github.com/slack-ruby/slack-ruby-bot-server-events/pull/13): Replace Travis CI with Github Actions - [@CrazyOptimist](https://github.com/CrazyOptimist).
56
* Your contribution here.
67

78
#### 0.3.1 (2/4/2021)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ Slack Ruby Bot Server Events Extension
22
======================================
33

44
[![Gem Version](https://badge.fury.io/rb/slack-ruby-bot-server-events.svg)](https://badge.fury.io/rb/slack-ruby-bot-server-events)
5-
[![Build Status](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-events.svg?branch=master)](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-events)
5+
[![lint](https://github.com/slack-ruby/slack-ruby-bot-server-events/actions/workflows/rubocop.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-events/actions/workflows/rubocop.yml)
6+
[![test with mongodb](https://github.com/slack-ruby/slack-ruby-bot-server-events/actions/workflows/test-mongodb.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-events/actions/workflows/test-mongodb.yml)
7+
[![test with postgresql](https://github.com/slack-ruby/slack-ruby-bot-server-events/actions/workflows/test-postgresql.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-events/actions/workflows/test-postgresql.yml)
68

79
An extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that makes it easy to handle Slack slash commands, interactive buttons and events.
810

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# frozen_string_literal: true
22

3-
db_config = YAML.safe_load(File.read(File.expand_path('postgresql.yml', __dir__)), [], [], true)[ENV['RACK_ENV']]
3+
db_config = YAML.safe_load(
4+
ERB.new(File.read(
5+
File.expand_path('postgresql.yml', __dir__)
6+
)).result, [], [], true
7+
)[ENV['RACK_ENV']]
48
ActiveRecord::Tasks::DatabaseTasks.create(db_config)
59
ActiveRecord::Base.establish_connection(db_config)
610
ActiveRecord::Base.logger.level = :info

spec/database_adapters/activerecord/postgresql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ development:
1111
test:
1212
<<: *default
1313
database: slack_ruby_bot_server_slack_test
14+
url: <%= ENV["DATABASE_URL"] %>
1415

1516
production:
1617
<<: *default

0 commit comments

Comments
 (0)