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
107 changes: 72 additions & 35 deletions .github/workflows/ci_cleaner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on: [push]
env:
CI: "true"
CODECOV: "true"
RUBY_VERSION: 3.2.2
NODE_VERSION: 18.17.1
RUBY_VERSION: 3.3.4
NODE_VERSION: 22.14.0
SHAKAPACKER_RUNTIME_COMPILE: "false"
RAILS_ENV: test
DISABLE_SPRING: "true"
Expand All @@ -27,7 +27,7 @@ jobs:
timeout-minutes: 30
services:
postgres:
image: postgres:11
image: postgres:14
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
Expand All @@ -45,42 +45,79 @@ jobs:
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: OpenSourcePolitics/rspec-action@master
- uses: actions/checkout@v4
with:
command: "bundle exec rspec --exclude-pattern 'spec/system/**/*_spec.rb'"
system_tests:
name: System tests
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: sudo apt install imagemagick
name: Install imagemagick
- run: bundle exec rake test_app
name: Create test 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: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
name: Create the screenshots folder
- uses: nanasess/setup-chromedriver@v2
- name: Run precompile if needed
run: |
if [[ -d "app/views" ]] || [[ -d "spec/mailers" ]] || [[ -d "spec/system" ]]; then
cd "spec/decidim_dummy_app"
bundle exec rails assets:precompile
else
echo "No need to precompile assets since system folder is empty"
fi
- run: bundle exec rspec
name: RSpec
- uses: codecov/codecov-action@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
if-no-files-found: ignore
release:
if: "github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'"
needs: [ tests, lint ]
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
steps:
- uses: rokroskar/workflow-run-cleanup-action@v0.3.0
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: OpenSourcePolitics/rspec-action@master
- uses: actions/checkout@v4
with:
command: "bundle exec rspec spec/system"
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup git and gh
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
- run: gem install parse_gemspec-cli
name: Intall gem parser
- run: echo "::set-output name=tag::$(parse-gemspec-cli *.gemspec | jq .'version')"
name: Set tag version
id: set_tag
- name: Add tag and push
run: |
git tag
git push --tags
- name: Create release
run: gh release create ${{ steps.set_tag.outputs.tag }} --generate-notes
publish:
if: "github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release' )"
needs: [tests, system_tests, lint]
needs: release
runs-on: ubuntu-latest
steps:
- uses: OpenSourcePolitics/publish-gem-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
- uses: actions/checkout@v4
- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
5 changes: 3 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
require: rubocop-factory_bot
plugins:
- rubocop-factory_bot

inherit_from:
- .rubocop_ruby.yml
- .rubocop_rails.yml

AllCops:
TargetRubyVersion: 3.1
TargetRubyVersion: 3.3
Include:
- "**/*.rb"
- "**/*.rake"
Expand Down
5 changes: 3 additions & 2 deletions .rubocop_rails.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require: rubocop-rails
plugins:
- rubocop-rails

Rails:
Enabled: true
Expand Down Expand Up @@ -93,4 +94,4 @@ Rails/Validation:
- decidim-*/app/models/**/*.rb

FactoryBot/FactoryAssociationWithStrategy:
Enabled: false
Enabled: false
6 changes: 3 additions & 3 deletions .rubocop_ruby.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require:
plugins:
- rubocop-rspec
- rubocop-faker

Expand Down Expand Up @@ -68,7 +68,7 @@ AllCops:
# If a value is specified for TargetRubyVersion then it is used.
# Else if .ruby-version exists and it contains an MRI version it is used.
# Otherwise we fallback to the oldest officially supported Ruby version (2.0).
TargetRubyVersion: 2.7
TargetRubyVersion: 3.3.4

# Indent private/protected/public as deep as method definitions
Layout/AccessModifierIndentation:
Expand Down Expand Up @@ -793,7 +793,7 @@ Style/PercentQLiterals:
Style/SlicingWithRange:
Enabled: false

Naming/PredicateName:
Naming/PredicatePrefix:
# Predicate name prefixes.
NamePrefix:
- is_
Expand Down
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
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ source "https://rubygems.org"

ruby RUBY_VERSION

gem "decidim", "~> 0.29.1"
gem "decidim", "~> 0.31.0"
gem "decidim-cleaner", path: "."

gem "bootsnap", "~> 1.4"
gem "puma", ">= 6.3.1"

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri
gem "decidim-dev", "~> 0.29.1"
gem "decidim-dev", "~> 0.31.0"
gem "rubocop-rails", "~> 2.25"
end

Expand Down
Loading