Skip to content

Commit

Permalink
Setup Project CI (#3)
Browse files Browse the repository at this point in the history
* Add initial ci set-up

* Fix gemfiles

* add spec

* fix spec_helper

* Lint
  • Loading branch information
alecslupu authored Dec 2, 2023
1 parent f9894e7 commit a4703e9
Show file tree
Hide file tree
Showing 16 changed files with 2,133 additions and 9 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci_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: 2.7.5
NODE_VERSION: 16.9.1
BUNDLE_GEMFILE: gemfiles/decidim_0.26.gemfile

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

- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}

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

- run: bundle exec rubocop -P
name: Lint Ruby files
57 changes: 57 additions & 0 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "[CI] I18n test"

on:
push:
branches:
- main
pull_request:

env:
NODE_VERSION: 16.9.1

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
BUNDLE_GEMFILE: gemfiles/decidim_0.26.gemfile
RUBY_VERSION: 2.7.5

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: bundle exec rspec spec/i18n_spec.rb
env:
SIMPLECOV: 0
CODECOV: 0

- uses: actions/upload-artifact@v2-preview
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
70 changes: 70 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "[CI] Test"

on:
push:
branches:
- main
pull_request:

env:
NODE_VERSION: 16.9.1

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
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
RUBY_VERSION: ${{ matrix.ruby }}

strategy:
matrix:
gemfile:
- gemfiles/decidim_0.26.gemfile
- gemfiles/decidim_0.27.gemfile
ruby:
- 2.7.5
- 3.0.2
exclude:
- gemfile: gemfiles/decidim_0.26.gemfile
ruby: 3.0.2
- gemfile: gemfiles/decidim_0.27.gemfile
ruby: 2.7.5
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

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

- name: Setup Database
run: bundle exec rake test_app

- name: Run RSpec
run: bundle exec rspec --exclude-pattern "spec/i18n_spec.rb"
env:
SIMPLECOV: 1
CODECOV: 1

- uses: actions/upload-artifact@v2-preview
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
inherit_from:
- .rubocop_ruby.yml
- .rubocop_rails.yml
87 changes: 87 additions & 0 deletions .rubocop_rails.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
require: rubocop-rails

Rails:
Enabled: true

Rails/ActionFilter:
Include:
- app/controllers/**/*.rb

Rails/ContentTag:
Enabled: false

Rails/CreateTableWithTimestamps:
Enabled: false

Rails/EnumUniqueness:
Include:
- app/models/**/*.rb

Rails/Exit:
Include:
- app/**/*.rb
- config/**/*.rb
- lib/**/*.rb
Exclude:
- lib/**/*.rake

Rails/FindBy:
Include:
- "**/*.rb"

Rails/FindEach:
Include:
- app/models/**/*.rb

Rails/HasAndBelongsToMany:
Include:
- app/models/**/*.rb

Rails/HasManyOrHasOneDependent:
Include:
- app/models/**/*.rb

Rails/InverseOf:
Enabled: false

Rails/LexicallyScopedActionFilter:
Include:
- app/controllers/**/*.rb

Rails/NotNullColumn:
Enabled: false

Rails/Output:
Include:
- app/**/*.rb
- config/**/*.rb
- db/**/*.rb
- lib/**/*.rb
Exclude:
- db/seeds.rb
Rails/OutputSafety:
Enabled: false

Rails/Pluck:
Enabled: false

Rails/RakeEnvironment:
Enabled: false

Rails/ReadWriteAttribute:
Include:
- app/models/**/*.rb

Rails/ReversibleMigration:
Enabled: false

Rails/ScopeArgs:
Include:
- app/models/**/*.rb

Rails/SkipsModelValidations:
Enabled: true

Rails/Validation:
Include:
- app/models/**/*.rb
Loading

0 comments on commit a4703e9

Please sign in to comment.