Skip to content

Commit

Permalink
Configure CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi committed Nov 18, 2024
1 parent 1448531 commit 4a6d2b7
Show file tree
Hide file tree
Showing 22 changed files with 15,008 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .csslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--exclude-exts=.min.css
--ignore=adjoining-classes,box-model,ids,order-alphabetical,unqualified-attributes
121 changes: 121 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
glob: "app/{cells,views}/**/*.erb"
exclude:
- '**/vendor/**/*'
- '**/node_modules/**/*'

linters:
ExtraNewline:
enabled: true

FinalNewline:
enabled: true

RequireInputAutocomplete:
enabled: false

SpaceAroundErbTag:
enabled: true

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

DeprecatedClasses:
enabled: true
addendum: "Please remove it from code."
rule_set:
- deprecated: ['process-content']
suggestion: "This class is deprecated. Please remove the surrounding element"
- deprecated: ['xlarge-[\w]*']
suggestion: "Foundation classes are deprecated."

Rubocop:
enabled: true

rubocop_config:
inherit_from:
- .rubocop.yml

AllCops:
DisabledByDefault: true

Layout/InitialIndentation:
Enabled: false

Lint/SymbolConversion:
Enabled: false

Layout/SpaceInsideParens:
Enabled: false

Layout/SpaceAfterColon:
Enabled: false

Lint/UselessAssignment:
Enabled: false

Layout/ArgumentAlignment:
Enabled: true

Layout/SpaceAfterComma:
Enabled: false

Layout/TrailingWhitespace:
Enabled: false

Layout/LeadingEmptyLines:
Enabled: false

Layout/SpaceBeforeComma:
Enabled: false

Style/Copyright:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Layout/LineLength:
Enabled: false

Layout/FirstArgumentIndentation:
Enabled: false

Layout/SpaceInsideHashLiteralBraces:
Enabled: true

Layout/BlockAlignment:
Enabled: false

Layout/MultilineMethodCallBraceLayout:
Enabled: false

Layout/FirstArrayElementIndentation:
Enabled: false

Layout/TrailingEmptyLines:
Enabled: false

Naming/FileName:
Enabled: false

Rails/LinkToBlank:
Enabled: false

Naming/VariableName:
Enabled: false

Layout/MultilineMethodCallIndentation:
Enabled: true

Layout/IndentationWidth:
Enabled: false

Layout/MultilineAssignmentLayout:
Enabled: false
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**/*{.,-}min.js
spec/decidim_dummy_app/**/*.js
development_app
**/node_modules/**
bundle.js
karma.conf.js
webpack.config.js
webpack.config.babel.js
entry.test.js
entry.js
*_manifest.js
coverage
vendor/bundle
75 changes: 75 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "[CI] Lint"
on:
push:
branches:
- main
- release/*
- "*-stable"
pull_request:
branches-ignore:
- "chore/l10n*"

env:
CI: "true"
RUBY_VERSION: 3.1.1
NODE_VERSION: 18.17.1

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
main:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:14
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@v3
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "dir=$(npm get cache)-ub" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-
- name: Install JS dependencies
run: npm ci
- run: bundle exec rubocop -P
name: Lint Ruby files
- run: npm run lint
name: Lint JavaScript files
- run: npm run stylelint
name: Lint CSS files
- run: npm run linthtml
name: Lint HTML files
- run: npm run markdownlint
name: Lint Markdown files
- run: npm run prettier
name: Format files
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -58,6 +59,8 @@ jobs:
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-
- name: Install JS dependencies
run: npm ci
- run: bundle exec rake test_app
name: Create test app
- run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
/pkg/
/spec/reports/
/tmp/
.DS_Store
node_modules/

# rspec failure tracking
.rspec-failures
Expand Down
9 changes: 9 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
default: true

first-line-h1: false

line-length: false

no-bare-urls: false

no-inline-html: false
5 changes: 5 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
decidim_dummy_app/
*/public/decidim-packs/
vendor/bundle
development_app/
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
spec/decidim_dummy_app/
node_modules/
development_app*/

# Decidim webpack packs
public/decidim-packs
# tmp folder (used by webpack to deal with cache)
tmp
# webpack packs output
decidim-packs
24 changes: 24 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
inherit_from: .rubocop_todo.yml

inherit_gem:
decidim-dev: rubocop-decidim.yml

inherit_mode:
merge:
- Exclude

AllCops:
Include:
- "**/*.rb"
- "**/*.rake"
- "**/*.ru"
- "**/Gemfile"
- "**/Rakefile"
Exclude:
- "spec/decidim_dummy_app/**/*"
- "**/spec/decidim_dummy_app/**/*"
- "bin/**/*"
- "node_modules/**/*"
- "**/node_modules/**/*"
- "db/schema.rb"
- "db/migrate/*"
- "vendor/**/*"
- "**/vendor/**/*"
Empty file added .rubocop_todo.yml
Empty file.
16 changes: 16 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

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

track_files "{app,lib}/**/*.rb"

add_filter "lib/generators"
add_filter "lib/decidim/superspace/version.rb"
add_filter "lib/omniauth/superspace.rb"
add_filter "/spec"
end

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

SimpleCov.merge_timeout 1800
2 changes: 2 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
app/packs/stylesheets/vendor/*
vendor/*
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ruby RUBY_VERSION
gem "decidim", "~> 0.28.4"
gem "decidim-superspace", path: "."

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

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri
Expand All @@ -22,3 +22,7 @@ group :development do
gem "listen", "~> 3.1"
gem "web-console", "~> 4.2"
end

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

0 comments on commit 4a6d2b7

Please sign in to comment.