Skip to content
Draft
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
4 changes: 3 additions & 1 deletion .github/workflows/ci_term_customizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ jobs:
main:
needs: build_app
name: Tests
uses: Platoniq/gha-decidim-module/.github/workflows/ci_rspec.yml@main
uses: ./.github/workflows/test_app.yml
with:
test_command: "bundle exec rspec --pattern './spec/**/*_spec.rb'"
secrets: inherit
106 changes: 106 additions & 0 deletions .github/workflows/test_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
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
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: decidim-app-cache
with:
path: ./spec/decidim_dummy_app/
key: app-${{ github.sha }}
restore-keys: decidim-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: |
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: |
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 .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.3.4
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ gem "decidim", DECIDIM_VERSION
gem "decidim-term_customizer", path: "."

gem "bootsnap", "~> 1.4"
gem "faker", "~> 3.6"
gem "puma", ">= 5.6.2"

gem "faker", "~> 3.2"
gem "uri", "1.0.4"

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri
gem "dalli", "~> 2.7", ">= 2.7.10" # For testing MemCacheStore
gem "decidim-dev", DECIDIM_VERSION
gem "rubocop-performance", "~> 1.21.0"
gem "rubocop-performance", "~> 1.25.0"
end

group :development do
Expand Down
Loading