Skip to content

Commit

Permalink
Add linters and gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
verarojman committed Oct 19, 2020
1 parent 14fe74d commit 530eb70
Show file tree
Hide file tree
Showing 6 changed files with 1,414 additions and 15 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Lint

on:
push:
branches:
- master
pull_request:

env:
RUBY_VERSION: 2.6.6
NODE_VERSION: 12.9.1

jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
steps:
- uses: actions/[email protected]
with:
fetch-depth: 1

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

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

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

- run: bundle exec mdl *.md
name: Lint Markdown files

37 changes: 22 additions & 15 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Test

on:
push:
Expand All @@ -8,25 +8,22 @@ on:

env:
RUBY_VERSION: 2.6.6

NODE_VERSION: 12.9.1

jobs:
build:
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2
Expand All @@ -42,9 +39,15 @@ jobs:
run: |
bundle exec rake decidim:generate_external_test_app
bundle exec rails db:create db:schema:load
env:
RAILS_ENV: test
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres

- name: Precompile assets
run: bundle exec rake assets:precompile
env:
RAILS_ENV: test

# - name: Setup Code Climate test-reporter
# run: |
Expand All @@ -54,10 +57,14 @@ jobs:

- name: Run RSpec
run: SIMPLECOV=1 CODECOV=1 bundle exec rake
env:
RAILS_ENV: test
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres

# - name: Publish code coverage
# run: |
# export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
# ./cc-test-reporter after-build -r "$CC_TEST_REPORTER_ID"
# env:
# CC_TEST_REPORTER_ID: dc93f2c0d045a6fd7b2d2a9b03dfaf2c3b298c520605744bc0283a7535d5dc92
# CC_TEST_REPORTER_ID: dc93f2c0d045a6fd7b2d2a9b03dfaf2c3b298c520605744bc0283a7535d5dc92
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"
Loading

0 comments on commit 530eb70

Please sign in to comment.