Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 12 additions & 0 deletions .github/run_erblint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

shopt -s globstar

bundle exec erblint app/{cells,views}/**/*.erb

# Store the return code of the erblint execution
EXIT_CODE=$?

shopt -u globstar

exit $EXIT_CODE
14 changes: 14 additions & 0 deletions .github/upload_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

REPORT_NAME=$1
EVENT_PAYLOAD_FILE=$2

PRID=`jq ".number // .check_run.pull_requests[0].number" $EVENT_PAYLOAD_FILE`
SHA=`jq -r ".pull_request.head.sha // .check_run.head_sha // .after" $EVENT_PAYLOAD_FILE`

if [ $PRID = "null" ]
then
bash <(curl -s https://codecov.io/bash) -n $REPORT_NAME -C $SHA
else
bash <(curl -s https://codecov.io/bash) -n $REPORT_NAME -C $SHA -P $PRID
fi
51 changes: 51 additions & 0 deletions .github/workflows/lint_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "[CI] Lint"
on:
push:
branches:
- develop
- release/*
- "*-stable"
pull_request:
branches-ignore:
- "chore/l10n*"

env:
CI: "true"
SIMPLECOV: "true"
RUBY_VERSION: 2.7.1

jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
timeout-minutes: 60
steps:
- uses: rokroskar/workflow-run-cleanup-action@v0.3.0
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm get cache)-lint"
- uses: actions/cache@v2
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
68 changes: 68 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Tests
on:
push:
branches:
- develop
- master
- release/*
- "*-stable"
pull_request:
branches-ignore:
- "chore/l10n*"

env:
CI: "true"
SIMPLECOV: "true"
RUBY_VERSION: 2.7.1

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
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
RAILS_ENV: test
# Set locales available for i18n tasks
ENFORCED_LOCALES: "en,fr"
steps:
- uses: rokroskar/workflow-run-cleanup-action@v0.2.2
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Create db
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- run: mkdir -p ./spec/tmp/screenshots
name: Create the screenshots folder
- uses: nanasess/setup-chromedriver@v1.0.1
- run: bundle exec rspec
name: RSpec
- run: ./.github/upload_coverage.sh $DECIDIM_MODULE $GITHUB_EVENT_PATH
name: Upload coverage
- uses: actions/upload-artifact@v2-preview
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15.14.0
Loading