Skip to content

Commit 12d0e94

Browse files
authored
Merge pull request #12 from blocknotes/github-actions-improvements
GitHub Actions improvements
2 parents 890ec8a + 1f4b17d commit 12d0e94

File tree

13 files changed

+204
-3
lines changed

13 files changed

+204
-3
lines changed

.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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Specs
23

34
on:

.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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
---
12
inherit_from:
23
- https://relaxed.ruby.style/rubocop.yml
34

5+
require:
6+
- rubocop-rspec
7+
48
AllCops:
59
Exclude:
610
- bin/*
11+
- db/schema.rb
712
- spec/dummy/**/*
13+
- vendor/**/*
814
NewCops: enable
915

1016
Gemspec/RequiredRubyVersion:
@@ -17,6 +23,12 @@ Layout/LineLength:
1723
Enabled: true
1824
Max: 120
1925

26+
RSpec/ExampleLength:
27+
Max: 10
28+
29+
RSpec/MultipleExpectations:
30+
Max: 12
31+
2032
Style/HashEachMethods:
2133
Enabled: true
2234

Gemfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@ group :development, :test do
1010
gem 'puma', '~> 4.3'
1111
gem 'rspec_junit_formatter', '~> 0.4'
1212
gem 'rspec-rails', '~> 4.0'
13-
gem 'rubocop', '~> 1.0'
1413
gem 'sassc', '~> 2.4'
1514
gem 'selenium-webdriver', '~> 3.142'
1615
gem 'sprockets-rails', '~> 3.2'
1716
gem 'sqlite3', '~> 1.4'
1817

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
1929
gem 'pry-rails'
2030
end

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# ActiveAdmin Dynamic Fields [![Gem Version](https://badge.fury.io/rb/activeadmin_dynamic_fields.svg)](https://badge.fury.io/rb/activeadmin_dynamic_fields) [![Gem downloads](https://badgen.net/rubygems/dt/activeadmin_dynamic_fields)](https://rubygems.org/gems/activeadmin_dynamic_fields) [![Specs](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/specs.yml/badge.svg)](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/specs.yml)
1+
# ActiveAdmin Dynamic Fields
2+
[![gem version](https://badge.fury.io/rb/activeadmin_dynamic_fields.svg)](https://badge.fury.io/rb/activeadmin_dynamic_fields) [![gem downloads](https://badgen.net/rubygems/dt/activeadmin_dynamic_fields)](https://rubygems.org/gems/activeadmin_dynamic_fields) [![linters](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/linters.yml/badge.svg)](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/linters.yml) [![specs](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/specs.yml/badge.svg)](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/specs.yml)
23

34
An Active Admin plugin to add dynamic behaviors to some fields.
45

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")

0 commit comments

Comments
 (0)