Skip to content

Commit e84e64e

Browse files
authored
add CI-GithubActions and up ruby-version to 2.6.6 (#13)
1 parent 973e341 commit e84e64e

File tree

13 files changed

+141
-9117
lines changed

13 files changed

+141
-9117
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ POSTGRES_PASSWORD=
33
POSTGRES_DB=
44
ALFRED_KEY=
55
ALFRED_SECRET=
6+
TOKEN_CALENDARIFIC=
7+
API_GITHUB=
8+
SECRET_GITHUB=

.github/workflows/main.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
env:
2+
RUBY_VERSION: 2.6
3+
POSTGRES_USER: postgres
4+
POSTGRES_PASSWORD: postgres
5+
POSTGRES_DB: postgres
6+
TOKEN_CALENDARIFIC: ${{ secrets.TOKEN_CALENDARIFIC }}
7+
API_GITHUB: ${{ secrets.API_GITHUB }}
8+
SECRET_GITHUB: ${{ secrets.SECRET_GITHUB }}
9+
10+
name: Rails tests
11+
on: [push,pull_request]
12+
jobs:
13+
rubocop-test:
14+
name: Rubocop
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v1
18+
- uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: ${{ env.RUBY_VERSION }}
21+
- name: Install Rubocop
22+
run: gem install rubocop
23+
- name: Check code
24+
run: rubocop
25+
rspec-test:
26+
name: Rspec
27+
needs: rubocop-test
28+
runs-on: ubuntu-latest
29+
services:
30+
postgres:
31+
image: postgres:latest
32+
ports:
33+
- 5432:5432
34+
env:
35+
POSTGRES_USER: ${{ env.POSTGRES_USER }}
36+
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
37+
steps:
38+
- uses: actions/checkout@v1
39+
- uses: actions/setup-ruby@v1
40+
with:
41+
ruby-version: ${{ env.RUBY_VERSION }}
42+
- name: Install postgres client
43+
run: sudo apt-get install libpq-dev
44+
- name: Install dependencies
45+
run: |
46+
gem install bundler
47+
bundler install
48+
- name: Create database
49+
run: |
50+
bundler exec rails db:create RAILS_ENV=test
51+
bundler exec rails db:migrate RAILS_ENV=test
52+
- name: Check files by Yarn
53+
run: yarn install --check-files
54+
- name: Webpack compilation
55+
run: NODE_ENV=test bundle exec rails webpacker:compile
56+
- name: Run tests
57+
run: bundle exec rspec
58+
- name: Upload coverage results
59+
uses: actions/upload-artifact@master
60+
if: always()
61+
with:
62+
name: coverage report
63+
path: coverage

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby-2.6.3
1+
ruby-2.6.6

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source 'https://rubygems.org'
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
ruby '2.6.3'
6+
ruby '2.6.6'
77

88
gem 'countries'
99
gem 'kaminari'

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ DEPENDENCIES
384384
webpacker
385385

386386
RUBY VERSION
387-
ruby 2.6.3p62
387+
ruby 2.6.6p146
388388

389389
BUNDLED WITH
390390
2.1.4

app/models/account.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class Account < ApplicationRecord
1616

1717
has_one_attached :avatar
1818

19-
# rubocop: disable Metrics/AbcSize
2019
def self.from_omniauth(auth)
2120
where(provider: auth.provider, uid: auth.uid).first_or_create do |account|
2221
account.provider = auth.provider
@@ -42,7 +41,6 @@ def auth_provider_avatar(auth)
4241
content_type: downloaded_image.content_type
4342
)
4443
end
45-
# rubocop: enable Metrics/AbcSize
4644

4745
def auth_provider_name(auth)
4846
auth.provider == :alfred ? auth.info.first_name : auth.info.name

app/presenters/companies/calendar_presenter.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def days_status(employee)
4646
end
4747

4848
# rubocop: disable Metrics/MethodLength
49+
# rubocop: disable Metrics/CyclomaticComplexity
4950
def half_event(day, working_month)
5051
events.each do |_employee, employee_events|
5152
employee_events.each do |event|
@@ -59,6 +60,7 @@ def half_event(day, working_month)
5960
end
6061
end
6162
end
63+
# rubocop: enable Metrics/CyclomaticComplexity
6264
# rubocop: enable Metrics/MethodLength
6365
# rubocop: enable Metrics/AbcSize
6466

config/database.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ default: &default
33
encoding: unicode
44
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
55
host: <%= ENV.fetch('POSTGRES_HOST', 'localhost') %>
6-
user: <%= ENV["POSTGRES_USER"] %>
7-
password: <%= ENV["POSTGRES_PASSWORD"] %>
6+
user: <%= ENV.fetch("POSTGRES_USER") { "postgres" } %>
7+
password: <%= ENV.fetch("POSTGRES_PASSWORD") { "" } %>
88

99
development:
1010
<<: *default

config/initializers/devise.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259
# ==> OmniAuth
260260
# Add a new OmniAuth provider. Check the wiki for more information on setting
261261
# up on your models and hooks.
262-
config.omniauth :github, Rails.application.credentials.github[:api], Rails.application.credentials.github[:secret], scope: Rails.application.credentials.github[:scope]
262+
config.omniauth :github, ENV['API_GITHUB'], ENV['SECRET_GITHUB'], scope: 'user,public_repo'
263263
config.omniauth :alfred, ENV['ALFRED_KEY'], ENV['ALFRED_SECRET'], scope: 'user'
264264

265265
# ==> Warden configuration

0 commit comments

Comments
 (0)