Skip to content

Commit

Permalink
Merge branch 'renovate/all-minor-patch-bundler'
Browse files Browse the repository at this point in the history
  • Loading branch information
lodewiges committed Jan 21, 2025
2 parents 9032dfc + 22762d7 commit 004503f
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 42 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ POSTGRES_PASSWORD=<password>
HOST=csvalpha.nl

NGROK_HOST=<subdomain>.ngrok.io

NOREPLY_EMAIL=[email protected]
ICT_EMAIL=[email protected]
PRIVACY_EMAIL=[email protected]
MAILADMIN_EMAIL=[email protected]
9 changes: 5 additions & 4 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
docker-compose up -d
- name: Finalize Sentry release
uses: getsentry/action-release@e769183448303de84c5a06aaaddf9da7be26d6c7 # v1.7.0
uses: getsentry/action-release@f6dfa3d84a1c740b94aa45255c5e032b744a095d # v1.9.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG_NAME }}
Expand All @@ -190,6 +190,8 @@ jobs:
runs-on: ubuntu-latest
needs: [branch_check, metadata, merge, continuous_integration, publish_image, deploy]
if: (github.ref_name == 'staging' || github.ref_name == 'master') && always()
permissions:
checks: write
steps:
- name: Get conclusion
id: get_conclusion
Expand All @@ -205,11 +207,10 @@ jobs:
done
- name: Update Continuous Delivery check run
uses: guidojw/actions/update-check-run@ec8c080252c6b8903a4431211b78c543609f5f89 # v1.4.6
uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2.0.0
with:
app_id: ${{ vars.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
sha: ${{ needs.merge.outputs.sha }}
token: ${{ github.token }}
name: Continuous Delivery
conclusion: ${{ steps.get_conclusion.outputs.conclusion }}
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
16 changes: 8 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
ref: ${{ inputs.sha }}

- name: Build test image
uses: guidojw/actions/build-docker-image@ec8c080252c6b8903a4431211b78c543609f5f89 # v1.4.6
uses: guidojw/actions/build-docker-image@3ad963828827110a6b716a011f242bf01fdf1db4 # v1.4.7
with:
file: Dockerfile
build-args: |
Expand Down Expand Up @@ -68,10 +68,10 @@ jobs:
- name: Download actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.26
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.7
- name: Load test image
uses: guidojw/actions/load-docker-image@ec8c080252c6b8903a4431211b78c543609f5f89 # v1.4.6
uses: guidojw/actions/load-docker-image@3ad963828827110a6b716a011f242bf01fdf1db4 # v1.4.7
with:
name: app

Expand All @@ -80,8 +80,8 @@ jobs:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: |
EXIT_STATUS=0
./actionlint -ignore 'property "gh_app_private_key" is not defined' -ignore 'SC2153:' \
-ignore 'property "sha" is not defined in object type {}' || EXIT_STATUS=$?
./actionlint -ignore 'SC2153:' -ignore 'property "sha" is not defined in object type {}' || \
EXIT_STATUS=$?
docker run -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_HOST=localhost -e \
RAILS_MASTER_KEY --network=host app bin/ci.sh lint || EXIT_STATUS=$?
exit $EXIT_STATUS
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
echo '::add-matcher::.github/problem-matchers/rspec.json'
- name: Load test image
uses: guidojw/actions/load-docker-image@ec8c080252c6b8903a4431211b78c543609f5f89 # v1.4.6
uses: guidojw/actions/load-docker-image@3ad963828827110a6b716a011f242bf01fdf1db4 # v1.4.7
with:
name: app

Expand All @@ -128,14 +128,14 @@ jobs:
- name: Upload coverage report to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload coverage report artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: coverage
path: coverage/
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0

- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
Expand All @@ -64,7 +64,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
with:
push: true
context: .
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Create Sentry release
if: ${{ !(github.event_name == 'workflow_dispatch' && github.workflow == 'Publish Image') }}
uses: getsentry/action-release@e769183448303de84c5a06aaaddf9da7be26d6c7 # v1.7.0
uses: getsentry/action-release@f6dfa3d84a1c740b94aa45255c5e032b744a095d # v1.9.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG_NAME }}
Expand All @@ -91,6 +91,8 @@ jobs:
runs-on: ubuntu-latest
needs: [metadata, publish]
if: github.event_name == 'workflow_dispatch' && github.workflow == 'Publish Image' && always()
permissions:
checks: write
steps:
- name: Get conclusion
id: get_conclusion
Expand All @@ -106,10 +108,9 @@ jobs:
done
- name: Update Publish Image check run
uses: guidojw/actions/update-check-run@ec8c080252c6b8903a4431211b78c543609f5f89 # v1.4.6
uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2.0.0
with:
app_id: ${{ vars.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
token: ${{ github.token }}
name: Publish Image
conclusion: ${{ steps.get_conclusion.outputs.conclusion }}
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
12 changes: 6 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem 'counter_culture', '~> 3.8', '>= 3.8.2'
gem 'dav4rack_ext', '~> 1.0'
gem 'doorkeeper', '~> 5.8', '>= 5.8.1'
gem 'doorkeeper-i18n', '~> 5.2', '>= 5.2.7'
gem 'exifr', '~> 1.4'
gem 'exifr', '~> 1.4', '>= 1.4.1'
gem 'friendly_id', '~> 5.5', '>= 5.5.1'
gem 'http', '~> 5.2'
gem 'iban-tools', '~> 1.2.1'
Expand All @@ -25,25 +25,25 @@ gem 'jsonapi-resources', '~> 0.9.1'
gem 'message_bus', '~> 4.3', '>= 4.3.8'
gem 'mini_magick', '~> 4.13', '>= 4.13.2'
gem 'paper_trail', '~> 14.0'
gem 'paranoia', '~> 3.0'
gem 'paranoia', '~> 3.0', '>= 3.0.1'
gem 'pg', '~> 1.5', '>= 1.5.9'
gem 'phonelib'
gem 'puma', '~> 6.5'
gem 'pundit', '~> 2.4'
gem 'rack-attack', '~> 6.7'
gem 'rack-cors', '~> 2.0', '>= 2.0.2', require: 'rack/cors'
gem 'rails', '~> 7.0.0', '>= 7.0.8.7'
gem 'rails', '~> 7.1.5', '>= 7.1.5'
gem 'rails-i18n', '~> 7.0', '>= 7.0.10'
gem 'redis', '~> 4.8', '>= 4.8.1'
gem 'roo', '~> 2.10', '>= 2.10.1'
gem 'ruby-filemagic', '~> 0.7', '>= 0.7.3'
gem 'rubyzip', '~> 2.3', '>= 2.3.2'
gem 'rubyzip', '~> 2.4', '>= 2.4.1'
gem 'sentry-raven', '~> 3.1', '>= 3.1.2'
gem 'sepa_king', '~> 0.14'
gem 'sidekiq', '~> 6.5', '>= 6.5.12'
gem 'sidekiq', '~> 7.3', '>= 7.3.8'
gem 'sidekiq-scheduler', '~> 5.0', '>= 5.0.6'
gem 'slack-notifier', '~> 2.4'
gem 'validates_timeliness', '~> 7.0.0'
gem 'validates_timeliness', '~> 7.1.0'
gem 'vpim', '~> 24.2', '>= 24.2.20'

group :development, :test do
Expand Down
16 changes: 10 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ GEM
coderay (1.1.3)
colorize (0.8.1)
concurrent-ruby (1.3.4)
connection_pool (2.3.0)
connection_pool (2.4.1)
consistency_fail (0.3.7)
counter_culture (3.8.2)
activerecord (>= 4.2)
Expand Down Expand Up @@ -245,6 +245,7 @@ GEM
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
logger (1.6.3)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -370,6 +371,8 @@ GEM
ffi (~> 1.0)
rb-readline (0.5.5)
redis (4.8.1)
redis-client (0.23.0)
connection_pool
regexp_parser (2.2.1)
request_store (1.5.1)
rack (>= 1.4)
Expand Down Expand Up @@ -458,10 +461,11 @@ GEM
iban-tools
nokogiri
shellany (0.0.1)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
redis (>= 4.5.0, < 5)
sidekiq (7.3.7)
connection_pool (>= 2.3.0)
logger
rack (>= 2.2.4)
redis-client (>= 0.22.2)
sidekiq-scheduler (5.0.6)
rufus-scheduler (~> 3.2)
sidekiq (>= 6, < 8)
Expand Down Expand Up @@ -594,7 +598,7 @@ DEPENDENCIES
rubyzip (~> 2.3, >= 2.3.2)
sentry-raven (~> 3.1, >= 3.1.2)
sepa_king (~> 0.14)
sidekiq (~> 6.5, >= 6.5.12)
sidekiq (~> 7.3, >= 7.3.7)
sidekiq-scheduler (~> 5.0, >= 5.0.6)
simplecov
simplecov-lcov (~> 0.8.0)
Expand Down
34 changes: 31 additions & 3 deletions app/helpers/markdown_helper.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
module MarkdownHelper
include CamoHelper

def camofy(markdown)
return unless markdown
def camofy(text)
return unless text

markdown.gsub(markdown_img_regex) do
text = sub_markdown(text)
sub_html(text)
end

def sub_markdown(text)
text.gsub(markdown_img_regex) do
"![#{Regexp.last_match(1)}](#{camo(Regexp.last_match(2))}#{Regexp.last_match(3)})"
end
end

def sub_html(text)
text.gsub(html_img_regex) do
preceding_src = Regexp.last_match(1)
quote_mark = Regexp.last_match(2)
url = Regexp.last_match(3)
ending = Regexp.last_match(4)
"<img#{preceding_src}src=#{quote_mark}#{camo(url)}#{quote_mark}#{ending}"
end
end

def markdown_img_regex
# ![alt text](url =widthxheight "title")
/!\[([^\[]*)\]\(([^\ )]+)(( =[^)]?[^ ]+)?( [^)]?"[^)]+")?)?\)/
end

def html_img_regex
# warning: this regex may not be perfect. They rarely are.
# If you find an edge case, improve this regex!
# <img...something... src="url"...ending...
# or, the alternative quotes: <img...something... src='url'...ending...
# or, even without quotes: <img...something... src=url...ending...
# and the ...ending... can be either a space, a > or />
# note that we don't allow mismatched quotes like 'url" or shenanigans like that
# This regex contains two particularly useful features:
# capturing groups, and lazy matching.
%r{<img([^>]*\s)src=(["']?)(.+?)\2(\s|>|/)}
end
end
1 change: 1 addition & 0 deletions app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Group < ApplicationRecord
has_many :groups_permissions, class_name: 'GroupsPermissions', dependent: :destroy
has_many :permissions, through: :groups_permissions
has_many :mail_aliases
has_many :articles

scope :active, (lambda {
joins(:memberships).merge(Membership.active).distinct
Expand Down
2 changes: 1 addition & 1 deletion app/models/study_room_presence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class StudyRoomPresence < ApplicationRecord
validates :start_time, presence: true
validates :end_time, presence: true
validates_datetime :end_time, after: :start_time
validates :status, inclusion: { in: %w[chilling studying banaan] }
validates :status, inclusion: { in: %w[chilling studying vergaderen] }

scope :current, (lambda {
where('start_time <= :current_time AND end_time >= :current_time',
Expand Down
1 change: 1 addition & 0 deletions app/resources/v1/group_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def description_camofied
has_many :memberships
has_many :mail_aliases
has_many :permissions
has_many :articles

filter :active, apply: ->(records, _value, _options) { records.active }
filter :kind
Expand Down
8 changes: 4 additions & 4 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class Application < Rails::Application

config.x.healthcheck_ids = credentials.dig(Rails.env.to_sym, :healthcheck_ids)

config.x.noreply_email = ENV.fetch('NOREPLY_EMAIL', 'no-reply@csvalpha.com')
config.x.ict_email = ENV.fetch('ICT_EMAIL', 'ict@csvalpha.com')
config.x.privacy_email = ENV.fetch('PRIVACY_EMAIL', 'privacy@csvalpha.com')
config.x.mailbeheer_email = ENV.fetch('PRIVACY_EMAIL', 'mailbeheer@csvalpha.com')
config.x.noreply_email = ENV.fetch('NOREPLY_EMAIL', 'no-reply@csvalpha.nl')
config.x.ict_email = ENV.fetch('ICT_EMAIL', 'ict@csvalpha.nl')
config.x.privacy_email = ENV.fetch('PRIVACY_EMAIL', 'privacy@csvalpha.nl')
config.x.mailbeheer_email = ENV.fetch('MAILADMIN_EMAIL', 'mailbeheer@csvalpha.nl')
end
end
1 change: 0 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_11_13_091607) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down
9 changes: 9 additions & 0 deletions db/seeds/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@
scopes: 'public',
confidential: false
)

FactoryBot.create(
:application,
name: 'SOFIA - Streepsysteem der C.S.V. Alpha',
uid: '987654321',
redirect_uri: 'http://localhost:5000/users/auth/amber_oauth2/callback',
scopes: 'public sofia',
confidential: false
)
2 changes: 1 addition & 1 deletion spec/factories/study_room_presences.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
factory :study_room_presence do
start_time { Faker::Time.between(from: 3.days.ago, to: 5.days.ago) }
end_time { Faker::Time.between(from: 10.days.from_now, to: 5.days.from_now) }
status { %w[chilling studying banaan].sample }
status { %w[chilling studying vergaderen].sample }
user

trait(:future) { start_time { Faker::Time.between(from: 1.day.from_now, to: 4.days.from_now) } }
Expand Down
Loading

0 comments on commit 004503f

Please sign in to comment.