Skip to content
Open
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
47 changes: 0 additions & 47 deletions .circleci/config.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/build_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
on:
workflow_call:
inputs:
ruby_version:
description: 'Ruby Version'
default: "3.2.2"
type: string
required: false
node_version:
description: 'Node version'
default: '18.17.1'
required: false
type: string
jobs:
build_app:
name: Build app
runs-on: ubuntu-22.04
if: "!startsWith(github.head_ref, 'chore/l10n')"
timeout-minutes: 60
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
RUBYOPT: '-W:no-deprecated'
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
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
bundler-cache: true
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
- uses: actions/cache@v3
id: app-cache
with:
path: ./spec/decidim_dummy_app/
key: app-${{ github.sha }}
restore-keys: app-${{ github.sha }}
- run: bundle exec rake test_app
name: Create test app
shell: "bash"
- run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
name: Create the screenshots folder
shell: "bash"
- run: RAILS_ENV=test bundle exec rails assets:precompile
name: Precompile assets
working-directory: ./spec/decidim_dummy_app/
shell: "bash"
env:
NODE_ENV: "test"
46 changes: 46 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "[CI] AnonymousProposals"
on:
push:

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

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

jobs:
build_app:
uses: ./.github/workflows/build_app.yml
secrets: inherit
name: Build test application

lint:
name: Lint code
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
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
- run: bundle exec erblint app/**/*.erb
name: Lint ERB files

tests:
name: Tests
needs: build_app
uses: ./.github/workflows/test_app.yml
with:
test_command: "bundle exec rspec --pattern './spec/**/*_spec.rb'"
secrets: inherit
86 changes: 86 additions & 0 deletions .github/workflows/test_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
on:
workflow_call:
inputs:
ruby_version:
description: 'Ruby Version'
default: "3.2.2"
required: false
type: string
test_command:
description: 'The testing command to be ran'
required: true
type: string

jobs:
build_app:
name: Test app
runs-on: ubuntu-22.04
if: "!startsWith(github.head_ref, 'chore/l10n')"
timeout-minutes: 60
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
RUBYOPT: '-W:no-deprecated'
services:
validator:
image: ghcr.io/validator/validator:latest
ports: ["8888:8888"]
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
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
bundler-cache: true
- name: Setup Chrome and ChromeDriver
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- uses: actions/cache@v3
id: app-cache
with:
path: ./spec/decidim_dummy_app/
key: app-${{ github.sha }}
restore-keys: app-${{ github.sha }}
- run: bundle exec rails db:create db:schema:load
name: Install gems and create db
shell: "bash"
working-directory: ./spec/decidim_dummy_app/
- run: |
sudo Xvfb -ac $DISPLAY -screen 0 1920x1084x24 > /dev/null 2>&1 &
${{ inputs.test_command }}
name: RSpec
working-directory: ./
env:
VALIDATOR_HTML_URI: http://localhost:8888/
RUBY_VERSION: ${{ inputs.ruby_version }}
DECIDIM_MODULE: ${{ inputs.working-directory }}
DISPLAY: ":99"
CI: "true"
SIMPLECOV: "true"
SHAKAPACKER_RUNTIME_COMPILE: "false"
NODE_ENV: "test"
- uses: codecov/codecov-action@v3
name: Upload coverage
with:
name: ${{ inputs.working-directory }}
flags: ${{ inputs.working-directory }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
if-no-files-found: ignore
overwrite: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ spec/decidim_dummy_app

# default development application
development_app

# rubocop https config files
.rubocop-https*
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.17.1
Loading