Skip to content

Commit

Permalink
Init module (#11)
Browse files Browse the repository at this point in the history
* Init module

* Add rubocop an lint ruby code

* Update .gitignore

* Add GitHub CI workflows

* Add i18n spec

* Add erblint

* Add markdownlint

* Add .ruby-version

* Add simplecov and codecov

* Add badges to README.md

* Remove component references

* Update module version

* Add linux platform

* Add WIP note

* Disable erblint on CI
  • Loading branch information
fblupi committed Nov 30, 2023
1 parent 63c513f commit 4e5cbf1
Show file tree
Hide file tree
Showing 34 changed files with 1,307 additions and 52 deletions.
30 changes: 30 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---

linters:
ExtraNewline:
enabled: true

FinalNewline:
enabled: true

SpaceAroundErbTag:
enabled: true

AllowedScriptType:
enabled: true
allowed_types:
- text/javascript
- text/template

Rubocop:
enabled: true

rubocop_config:
AllCops:
DisabledByDefault: true

Style/StringLiterals:
EnforcedStyle: double_quotes

Layout/SpaceInsideHashLiteralBraces:
Enabled: true
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "[CI] Lint"

on:
push:
branches:
- main
pull_request:

env:
RUBY_VERSION: 3.0.2

jobs:
lint-report:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- run: bundle exec rubocop -P
name: Lint Ruby files

# - run: bundle exec erblint app/**/*.erb
# name: Lint ERB files

- run: bundle exec mdl *.md
name: Lint Markdown files
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "[CI] Test"

on:
push:
branches:
- main
pull_request:

env:
RUBY_VERSION: 3.0.2

jobs:
test-report:
runs-on: ubuntu-20.04

services:
postgres:
image: postgres:11
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_PASSWORD: postgres
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- name: Setup Database
run: bundle exec rake test_app

- name: Run RSpec
run: SIMPLECOV=1 CODECOV=1 bundle exec rspec

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- uses: actions/upload-artifact@v2-preview
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
65 changes: 17 additions & 48 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,56 +1,25 @@
*.gem
*.rbc
/.config
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/InstalledFiles
/doc/
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env
# rspec failure tracking
.rspec-failures

# Ignore Byebug command history file.
.byebug_history

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/
# default test application
spec/decidim_dummy_app

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/
# default development application
development_app

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*
.rubocop-*
.rbenv-vars
.vscode
.byebug_history
*.gem
node_modules/
npm_debug.log
15 changes: 15 additions & 0 deletions .mdl_style.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

all

exclude_rule "first-line-h1"

exclude_rule "line-length"

exclude_rule "no-bare-urls"

exclude_rule "no-inline-html"

exclude_rule "ol-prefix"

rule "no-trailing-punctuation", punctuation: ".,;:!"
1 change: 1 addition & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style ".mdl_style.rb"
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inherit_from: https://raw.githubusercontent.com/decidim/decidim/release/0.27-stable/.rubocop.yml
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.2
13 changes: 13 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

SimpleCov.start do
root ENV.fetch("ENGINE_ROOT", nil)

add_filter "lib/decidim/centers/test"
add_filter "lib/decidim/centers/version.rb"
add_filter "/spec"
end

SimpleCov.command_name ENV.fetch("COMMAND_NAME", nil) || File.basename(Dir.pwd)

SimpleCov.merge_timeout 1800
39 changes: 39 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

source "https://rubygems.org"

ruby RUBY_VERSION

# Inside the development app, the relative require has to be one level up, as
# the Gemfile is copied to the development_app folder (almost) as is.
base_path = ""
base_path = "../" if File.basename(__dir__) == "development_app"
require_relative "#{base_path}lib/decidim/centers/version"

DECIDIM_VERSION = Decidim::Centers::DECIDIM_VERSION

gem "decidim", DECIDIM_VERSION
gem "decidim-centers", path: "."

gem "bootsnap", "~> 1.4"
gem "puma", ">= 4.3"

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri

gem "decidim-dev", DECIDIM_VERSION
end

group :development do
gem "faker", "~> 2.14"
gem "letter_opener_web", "~> 2.0"
gem "listen", "~> 3.1"
gem "rubocop-faker", "~> 1.1"
gem "spring", "~> 2.0"
gem "spring-watcher-listen", "~> 2.0"
gem "web-console", "~> 4.2"
end

group :test do
gem "codecov", require: false
end
Loading

0 comments on commit 4e5cbf1

Please sign in to comment.