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
70 changes: 70 additions & 0 deletions .github/workflows/build_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
on:
workflow_call:
inputs:
ruby_version:
description: 'Ruby Version'
default: "3.3.4"
type: string
required: false
node_version:
description: 'Node version'
default: '22.14.0'
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@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
bundler-cache: true
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: 'npm'
cache-dependency-path: ./package-lock.json
- uses: actions/cache@v4
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: |
rm -f ./spec/decidim_dummy_app/app/services/dummy_signature_handler.rb
rm -f ./spec/decidim_dummy_app/app/services/dummy_sms_mobile_phone_validator.rb
name: Remove Initiative-dependent dummy files
- run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
name: Create the screenshots folder
shell: "bash"
- run: RAILS_ENV=test bundle exec rails shakapacker:compile
name: Precompile assets
working-directory: ./spec/decidim_dummy_app/
shell: "bash"
env:
NODE_ENV: "test"
77 changes: 38 additions & 39 deletions .github/workflows/ci_budgets_importer.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
name: "[CI] BudgetsImporter"
on: [push]
on:
push:
branches:
- develop
- release/*
- "*-stable"
pull_request:
branches-ignore:
- "chore/l10n*"
paths:
- "*"
- ".github/**"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
CI: "true"
RUBY_VERSION: 3.0.2
NODE_VERSION: 16.9.1
RUBY_VERSION: 3.3.4
NODE_VERSION: 22.14.0

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

lint:
name: Lint code
runs-on: ubuntu-latest
timeout-minutes: 30
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
timeout-minutes: 60
steps:
- name: Linting
uses: OpenSourcePolitics/lint-action@master
with:
ruby_version: ${{ env.RUBY_VERSION }}
node_version: ${{ env.NODE_VERSION }}
- name: Running rspec
uses: OpenSourcePolitics/rspec-action@master
- uses: rokroskar/workflow-run-cleanup-action@v0.3.0
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: OpenSourcePolitics/lint-action@master
with:
ruby_version: ${{ env.RUBY_VERSION }}
node_version: ${{ env.NODE_VERSION }}
release:
name: Generate release and push to RubyGems
needs: [main]
if: "github.ref == 'refs/heads/master'"
runs-on: ubuntu-latest
steps:
- name: Github release and RubyGems push
uses: OpenSourcePolitics/decidim-publish-gem-action@master
with:
rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}

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

jobs:
build_app:
name: Test
runs-on: ubuntu-latest
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
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
- run: |
sudo apt update
sudo apt install libu2f-udev imagemagick
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${{inputs.chrome_version}}-1_amd64.deb
sudo dpkg -i /tmp/chrome.deb
rm /tmp/chrome.deb
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: ${{inputs.chrome_version}}
name: Install Chrome version ${{inputs.chrome_version}}
- uses: actions/cache@v4
id: app-cache
with:
path: ./spec/decidim_dummy_app/
key: app-${{ github.sha }}
restore-keys: app-${{ github.sha }}
- run: |
bundle install
bundle exec rake 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 & # optional
${{ inputs.test_command }}
name: RSpec
working-directory: ./
env:
VALIDATOR_HTML_URI: http://localhost:8888/
RUBY_VERSION: ${{ inputs.ruby_version }}
DECIDIM_MODULE: "decidim-module-additional_authorization_handler"
DISPLAY: ":99"
CI: "true"
SIMPLECOV: "true"
SHAKAPACKER_RUNTIME_COMPILE: "false"
NODE_ENV: "test"
- uses: codecov/codecov-action@v3
name: Upload coverage
- uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
if-no-files-found: ignore
overwrite: true
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.9.1
22.14.0
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
inherit_from: https://raw.githubusercontent.com/decidim/decidim/release/0.27-stable/.rubocop.yml
inherit_from: https://raw.githubusercontent.com/decidim/decidim/release/0.31-stable/.rubocop.yml

AllCops:
Include:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.3.4
13 changes: 7 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ gem "decidim"
gem "decidim-budgets_importer", path: "."

gem "bootsnap", "~> 1.4"
gem "puma", ">= 5.5.1"
gem "openssl", "3.3.0"
gem "puma", ">= 6.3.1"

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri

gem "decidim-dev"
gem "decidim-dev", "~> 0.31"
end

group :development do
gem "faker", "~> 2.14"
gem "letter_opener_web", "~> 1.3"
gem "faker", "3.5.3"
gem "letter_opener_web", "~> 2.0"
gem "listen", "~> 3.1"
gem "rubocop-faker"
gem "spring", "~> 2.0"
gem "spring", "~> 4.0"
gem "spring-watcher-listen", "~> 2.0"
gem "web-console", "~> 4.0.4"
gem "web-console", "~> 4.2"
end
Loading
Loading