Skip to content

Commit 89d81fa

Browse files
authored
Merge pull request #13 from blocknotes/github_actions_improvements
GitHub Actions improvements
2 parents 9aa89b2 + 40ddecf commit 89d81fa

13 files changed

Lines changed: 218 additions & 16 deletions

File tree

.fasterer.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
exclude_paths:
3+
- bin/*
4+
- db/schema.rb
5+
- spec/dummy/**/*
6+
- vendor/**/*

.github/workflows/linters.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Linters
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
reviewdog:
12+
name: reviewdog
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '2.7'
23+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
24+
25+
- uses: reviewdog/action-setup@v1
26+
with:
27+
reviewdog_version: latest
28+
29+
- name: Run reviewdog
30+
env:
31+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
reviewdog -fail-on-error -reporter=github-pr-review -runners=brakeman,fasterer,reek,rubocop
34+
35+
# NOTE: check with: reviewdog -fail-on-error -reporter=github-pr-review -runners=fasterer -diff="git diff" -tee

.github/workflows/specs.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Specs
23

34
on:
@@ -17,10 +18,19 @@ jobs:
1718
steps:
1819
- name: Checkout
1920
uses: actions/checkout@v2
21+
2022
- name: Set up Ruby
2123
uses: ruby/setup-ruby@v1
2224
with:
2325
ruby-version: ${{ matrix.ruby }}
24-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26+
bundler-cache: true
27+
2528
- name: Run tests
2629
run: bundle exec rake
30+
31+
- name: Archive screenshots for failed tests
32+
uses: actions/upload-artifact@v2
33+
if: failure()
34+
with:
35+
name: test-failed-screenshots
36+
path: spec/dummy/tmp/screenshots

.reek.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
exclude_paths:
3+
- bin/*
4+
- db/schema.rb
5+
- spec/dummy/**/*
6+
- vendor/**/*

.reviewdog.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
runner:
3+
brakeman:
4+
cmd: bin/brakeman
5+
level: info
6+
fasterer:
7+
cmd: bin/fasterer
8+
level: info
9+
reek:
10+
cmd: bin/reek
11+
level: info
12+
rubocop:
13+
cmd: bin/rubocop
14+
level: info

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
---
12
inherit_from:
23
- https://relaxed.ruby.style/rubocop.yml
34

45
AllCops:
56
Exclude:
67
- bin/*
8+
- db/schema.rb
79
- spec/dummy/**/*
10+
- vendor/**/*
811
NewCops: enable
912

1013
Gemspec/RequiredRubyVersion:

Gemfile

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@ source 'https://rubygems.org'
44

55
gemspec
66

7-
gem 'pry-rails'
7+
group :development, :test do
8+
gem 'activestorage', '~> 6.0'
9+
gem 'capybara', '~> 3.33'
10+
gem 'puma', '~> 4.3'
11+
gem 'rspec_junit_formatter', '~> 0.4'
12+
gem 'rspec-rails'
13+
gem 'sassc', '~> 2.4'
14+
gem 'selenium-webdriver', '~> 3.142'
15+
gem 'sprockets-rails', '~> 3.2'
16+
gem 'sqlite3', '~> 1.4'
817

9-
gem 'activestorage', '~> 6.0'
10-
gem 'capybara', '~> 3.33'
11-
gem 'puma', '~> 4.3'
12-
gem 'rspec-rails'
13-
gem 'rspec_junit_formatter', '~> 0.4'
14-
gem 'rubocop', '~> 1.0'
15-
gem 'sassc', '~> 2.4'
16-
gem 'selenium-webdriver', '~> 3.142'
17-
gem 'sprockets-rails', '~> 3.2'
18-
gem 'sqlite3', '~> 1.4'
18+
# Linters
19+
gem 'brakeman'
20+
gem 'fasterer'
21+
gem 'reek'
22+
gem 'rubocop'
23+
gem 'rubocop-packaging'
24+
gem 'rubocop-performance'
25+
gem 'rubocop-rails'
26+
gem 'rubocop-rspec'
27+
28+
# Tools
29+
gem 'pry-rails'
30+
end

bin/brakeman

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'brakeman' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("brakeman", "brakeman")

bin/code_climate_reek

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'code_climate_reek' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("reek", "code_climate_reek")

bin/fasterer

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'fasterer' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("fasterer", "fasterer")

0 commit comments

Comments
 (0)