Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: bump spam detection to 3.1.0 #16

Merged
merged 6 commits into from
Aug 29, 2024
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
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ node_modules
public/uploads
deploy
.rubocop*
.overloads
.erb-lint.yml
.env-example
.env
Expand Down
135 changes: 106 additions & 29 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ env:
RAILS_ENV: test
NODE_VERSION: 16.9.1
RUBYOPT: '-W:no-deprecated'
# Set locales available for i18n tasks
ENFORCED_LOCALES: "en,fr"
AVAILABLE_LOCALES: "en,fr"

jobs:
todo:
name: TODO
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v4"
lint:
name: Lint code
runs-on: ubuntu-latest
Expand All @@ -26,13 +38,16 @@ jobs:
ruby_version: ${{ env.RUBY_VERSION }}
node_version: ${{ env.NODE_VERSION }}
tests:
strategy:
fail-fast: false
matrix:
slice: [ "0-2", "1-2" ]
name: Tests
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
services:
postgres:
image: postgres:11
ports: [ "5432:5432" ]
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -44,54 +59,117 @@ jobs:
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/[email protected]
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
- name: Create db
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- name: Precompile assets
bundle exec rails parallel:create parallel:migrate
- name: Register cache hash
id: cache-hash
run: |
bundle exec rake assets:precompile
echo "::set-output name=hash::$(bundle exec rake test:assets_hash)"
- uses: OpenSourcePolitics/cache-precompile-action@master
with:
key: asset-cache-${{ runner.os }}-${{ steps.cache-hash.outputs.hash }}
- run: mkdir -p ./spec/tmp/screenshots
name: Create the screenshots folder
- uses: nanasess/[email protected]
- run: bundle exec rspec
# TODO: Use latest version
- uses: nanasess/setup-chromedriver@v2
- run: bundle exec rake "test:run[exclude, spec/system/**/*_spec.rb, ${{ matrix.slice }}]"
name: RSpec
- run: ./.github/upload_coverage.sh $DECIDIM_MODULE $GITHUB_EVENT_PATH
- run: ./.github/upload_coverage.sh decidim-app $GITHUB_EVENT_PATH
name: Upload coverage
- uses: actions/upload-artifact@v2-preview
- uses: actions/upload-artifact@v3
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
path: ./spec/tmp/screenshots
- uses: actions/upload-artifact@v3
if: always()
with:
name: assets-manifest-${{ matrix.slice }}
path: ./tmp/assets_manifest.json
system_tests:
strategy:
matrix:
slice: [ "0-4", "1-4", "2-4", "3-4" ]
name: System tests
runs-on: ubuntu-latest
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/[email protected]
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
- name: Create db
run: |
bundle exec rails parallel:create parallel:migrate
- name: Register cache hash
id: cache-hash
run: |
echo "::set-output name=hash::$(bundle exec rake test:assets_hash)"
- uses: OpenSourcePolitics/cache-precompile-action@master
with:
key: asset-cache-${{ runner.os }}-${{ steps.cache-hash.outputs.hash }}
- run: mkdir -p ./spec/tmp/screenshots
name: Create the screenshots folder
# TODO: Use latest version
- uses: nanasess/setup-chromedriver@v2
- run: bundle exec rake "test:run[include, spec/system/**/*_spec.rb, ${{ matrix.slice }}]"
name: RSpec
- run: ./.github/upload_coverage.sh decidim-app $GITHUB_EVENT_PATH
name: Upload coverage
- uses: actions/upload-artifact@v3
if: always()
with:
name: screenshots
path: ./spec/tmp/screenshots
- uses: actions/upload-artifact@v3
if: always()
with:
name: assets-manifest-${{ matrix.slice }}
path: ./tmp/assets_manifest.json
test_build:
name: Test build docker image
runs-on: ubuntu-latest
Expand Down Expand Up @@ -124,7 +202,7 @@ jobs:
build_and_push_image_dev:
name: Build and push image to Registry
if: "github.ref == 'refs/heads/develop'"
needs: [ lint, tests, test_build ]
needs: [lint, tests, system_tests, test_build]
runs-on: ubuntu-latest
steps:
- uses: OpenSourcePolitics/build-and-push-images-action@master
Expand All @@ -136,13 +214,13 @@ jobs:
tag: "develop"
generate_release:
name: Generate release
needs: [ lint, tests, test_build ]
needs: [lint, tests, system_tests, test_build]
if: "github.ref == 'refs/heads/master'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mathieudutour/[email protected]
name: Bump vaersion and push tag
name: Bump version and push tag
id: tag_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -160,4 +238,3 @@ jobs:
password: ${{ secrets.TOKEN }}
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ steps.tag_version.outputs.new_tag }}

2 changes: 2 additions & 0 deletions .rubocop_rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Rails/ScopeArgs:

Rails/SkipsModelValidations:
Enabled: true
Exclude:
- db/migrate/*.rb

Rails/Validation:
Include:
Expand Down
69 changes: 34 additions & 35 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,45 @@

source "https://rubygems.org"

DECIDIM_VERSION = "release/0.26-stable"
DECIDIM_VERSION = "0.26"
DECIDIM_BRANCH = "release/#{DECIDIM_VERSION}-stable"

ruby RUBY_VERSION

gem "decidim", git: "https://github.com/decidim/decidim.git", branch: DECIDIM_VERSION
gem "decidim-conferences", git: "https://github.com/decidim/decidim.git", branch: DECIDIM_VERSION
# Many gems depend on environment variables, so we load them as soon as possible
gem "dotenv-rails", require: "dotenv/rails-now"

# gem "acts_as_textcaptcha", "~> 4.5.1"
# Core gems
gem "decidim", "~> #{DECIDIM_VERSION}.0"
gem "decidim-conferences", "~> #{DECIDIM_VERSION}.0"
gem "decidim-templates", "~> #{DECIDIM_VERSION}.0"

# External Decidim gems
gem "decidim-cache_cleaner"
gem "decidim-decidim_awesome"
gem "decidim-friendly_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git"
gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_VERSION
gem "decidim-ludens", git: "https://github.com/OpenSourcePolitics/decidim-ludens.git", branch: DECIDIM_VERSION
gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_VERSION
# gem "decidim-question_captcha", git: "https://github.com/OpenSourcePolitics/decidim-module-question_captcha.git", branch: DECIDIM_VERSION
gem "decidim-spam_detection", git: "https://github.com/OpenSourcePolitics/decidim-spam_detection.git"
gem "decidim-templates"
gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer.git"
gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH
gem "decidim-ludens", git: "https://github.com/OpenSourcePolitics/decidim-ludens.git", branch: DECIDIM_BRANCH
gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH
gem "decidim-spam_detection"
gem "decidim-term_customizer", git: "https://github.com/armandfardeau/decidim-module-term_customizer.git", branch: "fix/precompile-on-docker-0.26"

# Omniauth gems
gem "omniauth-france_connect", git: "https://github.com/OpenSourcePolitics/omniauth-france_connect"
gem "omniauth-publik", git: "https://github.com/OpenSourcePolitics/omniauth-publik"

gem "dotenv-rails"

gem "bootsnap", "~> 1.4"
gem "foundation_rails_helper", git: "https://github.com/sgruhier/foundation_rails_helper.git"

gem "puma", ">= 5.5.1"

gem "faker", "~> 2.14"

# Default
gem "activejob-uniqueness", require: "active_job/uniqueness/sidekiq_patch"
gem "aws-sdk-s3", require: false
gem "bootsnap", "~> 1.4"
gem "faker", "~> 2.14"
gem "fog-aws"
gem "sys-filesystem"

gem "foundation_rails_helper", git: "https://github.com/sgruhier/foundation_rails_helper.git"
gem "nokogiri", "1.13.4"
gem "omniauth-rails_csrf_protection", "~> 1.0"

group :development, :test do
gem "brakeman", "~> 5.1"
gem "byebug", "~> 11.0", platform: :mri
gem "climate_control", "~> 1.2"
gem "decidim-dev", git: "https://github.com/decidim/decidim.git", branch: DECIDIM_VERSION
gem "parallel_tests"
end
gem "puma", ">= 5.5.1"
gem "rack-attack", "~> 6.6"
gem "sys-filesystem"

group :development do
gem "letter_opener_web", "~> 1.3"
Expand All @@ -55,12 +51,18 @@ group :development do
gem "web-console", "4.0.4"
end

group :development, :test do
gem "brakeman", "~> 5.1"
gem "byebug", "~> 11.0", platform: :mri
gem "climate_control", "~> 1.2"
gem "decidim-dev", "~> #{DECIDIM_VERSION}.0"
gem "parallel_tests"
end

group :production do
gem "dalli"
gem "health_check", "~> 3.1"
gem "lograge"
gem "newrelic_rpm"
gem "passenger"
gem "sendgrid-ruby"
gem "sentry-rails"
gem "sentry-ruby"
Expand All @@ -69,6 +71,3 @@ group :production do
gem "sidekiq_alive", "~> 2.2"
gem "sidekiq-scheduler", "~> 5.0"
end
gem "nokogiri", "1.13.4"

gem "rack-attack", "~> 6.6"
Loading
Loading