From 8845854eec0b7358d0d821a71de8426e31b30038 Mon Sep 17 00:00:00 2001 From: Matteo Bronkhorst <32799956+DrumsnChocolate@users.noreply.github.com> Date: Fri, 29 Nov 2024 23:22:33 +0100 Subject: [PATCH] Manually merge staging into master (#956) * chore(deps): update dependency paranoia to v3 (#931) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Edited the env file (#944) * edited the env file * changed company name to UTF-8 * chore(deps): update dependency puma to '~> 6.4.0' [security] (#935) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/delete-package-versions action to v5 (#906) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency rails to v7.0.8.1 [security] (#918) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update docker/build-push-action action to v6 (#928) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update docker/login-action action to v3 (#886) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(tests): add code coverage reporting (#891) * feat(tests): add code coverage reporting * fix: correct coverage path * refactor: use simplecov-lcov * fix: indentation in Gemfile.lock * fix: remove test filters * feat(README): add badge * refactor: try tokenless report uploading * chore: update codecov-action * chore: update codecov-action * fix(cd): pass CODECOV_TOKEN To ci * Revert "chore(deps): update docker/login-action action to v3 (#886)" (#951) This reverts commit d546681f8b0ca25b867fc2bc34192928991e6ff9. due to CI failure * chore(deps): update codecov/codecov-action action to v5 (#950) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency puma to v6.4.3 [security] (#948) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/upload-artifact action to v4 (#949) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Refractor/tomato to sofia (#947) * Intial commit * updated apliction.rb * Fixed mistake in credentials * Made it so the file is backwards compatiable * Fixed a typo * Update amber_oauth2.rb remove tomato paramater * Remove development title lux ad mosam (#946) * intial commit * Fix typo * update tomato to sofia * updated with suggestion --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: lodewiges <131907615+lodewiges@users.noreply.github.com> Co-authored-by: Guido de Jong <35309288+guidojw@users.noreply.github.com> --- .env.example | 6 +- .github/workflows/cleanup-registry.yml | 2 +- .github/workflows/continuous-delivery.yml | 1 + .github/workflows/continuous-integration.yml | 21 ++- .github/workflows/publish-image.yml | 2 +- Gemfile | 5 +- Gemfile.lock | 162 +++++++++---------- README.md | 3 +- app/models/payment.rb | 2 +- app/views/partials/_footer.html.erb | 4 +- config/application.rb | 4 +- config/credentials.yml.enc | 2 +- config/environments/production.rb | 2 +- lib/omniauth/strategies/amber_oauth2.rb | 2 +- spec/spec_helper.rb | 13 +- 15 files changed, 123 insertions(+), 108 deletions(-) diff --git a/.env.example b/.env.example index f98c69fb8..2667f8681 100644 --- a/.env.example +++ b/.env.example @@ -18,10 +18,10 @@ TREASURER_NAME= TREASURER_PHONE= AUTHORIZE_URL=/oauth/authorize -TOKEN_URL=/oauth/token -ME_URL=/oauth/me +TOKEN_URL=/api/v1/oauth/token +ME_URL=/api/v1/users?filter[me]&include="active_groups" -COMPANY_NAME=Stichting Sociƫteit Flux +COMPANY_NAME=Stichting Societeit Flux COMPANY_IBAN=NL68 INGB 0008 1654 20 COMPANY_ADDRESS=Oude Markt 24-3, 7511 GB Enschede COMPANY_WEBSITE=https://societeitflux.nl diff --git a/.github/workflows/cleanup-registry.yml b/.github/workflows/cleanup-registry.yml index 32b82f8df..f7b50d9d2 100644 --- a/.github/workflows/cleanup-registry.yml +++ b/.github/workflows/cleanup-registry.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Delete untagged images - uses: actions/delete-package-versions@0d39a63126868f5eefaa47169615edd3c0f61e20 # v4.1.1 + uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0 with: package-name: ${{ github.event.repository.name }} package-type: container diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 738ed981c..ae51732d9 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -124,6 +124,7 @@ jobs: with: sha: ${{ needs.merge.outputs.sha }} secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} rails_master_key: ${{ secrets.RAILS_MASTER_KEY }} publish_image: diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 4510d3309..df42dd331 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -12,6 +12,9 @@ on: required: false type: string secrets: + codecov_token: + description: Codecov token + required: true rails_master_key: description: The Rails master key required: true @@ -119,5 +122,21 @@ jobs: env: RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} run: | + mkdir coverage docker run -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_HOST=localhost -e \ - RAILS_MASTER_KEY --network=host app bin/ci.sh spec + RAILS_MASTER_KEY --network=host -v "$(pwd)"'/coverage:/app/coverage' app bin/ci.sh spec + + - name: Upload coverage report to Codecov + if: ${{ !cancelled() }} + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 + 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 + with: + name: coverage + path: coverage/ + if-no-files-found: error diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index e36865db1..3d65f8977 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -68,7 +68,7 @@ jobs: - name: Build and push image id: build_push_image - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 with: push: true context: . diff --git a/Gemfile b/Gemfile index a667c3383..1caa202cc 100644 --- a/Gemfile +++ b/Gemfile @@ -21,9 +21,9 @@ gem 'omniauth', '~> 2.0.0' gem 'omniauth-oauth2', '~> 1.7.0' gem 'omniauth-rails_csrf_protection', '~> 1.0' gem 'paper_trail', '~> 14.0.0' -gem 'paranoia', '~> 2.6.0' +gem 'paranoia', '~> 3.0.0' gem 'pg', '~> 1.3.0' -gem 'puma', '~> 6.1.1' +gem 'puma', '~> 6.4.0' gem 'pundit', '~> 2.2.0' gem 'rack-attack', '~> 6.6.0' gem 'rails', '~> 7.0.4', '>= 7.0.4.3' @@ -79,6 +79,7 @@ group :test do gem 'rubocop-rails' gem 'rubocop-rspec' gem 'simplecov', require: false + gem 'simplecov-lcov', '~> 0.8.0', require: false gem 'terminal-notifier-guard' gem 'timecop' end diff --git a/Gemfile.lock b/Gemfile.lock index 1d59c3a6c..f8ccbf2bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,67 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + actioncable (7.0.8.6) + actionpack (= 7.0.8.6) + activesupport (= 7.0.8.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailbox (7.0.8.6) + actionpack (= 7.0.8.6) + activejob (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.3) - actionpack (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailer (7.0.8.6) + actionpack (= 7.0.8.6) + actionview (= 7.0.8.6) + activejob (= 7.0.8.6) + activesupport (= 7.0.8.6) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.8.6) + actionview (= 7.0.8.6) + activesupport (= 7.0.8.6) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.3) - actionpack (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actiontext (7.0.8.6) + actionpack (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + actionview (7.0.8.6) + activesupport (= 7.0.8.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4.3) - activesupport (= 7.0.4.3) + activejob (7.0.8.6) + activesupport (= 7.0.8.6) globalid (>= 0.3.6) - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) - activestorage (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activesupport (= 7.0.4.3) + activemodel (7.0.8.6) + activesupport (= 7.0.8.6) + activerecord (7.0.8.6) + activemodel (= 7.0.8.6) + activesupport (= 7.0.8.6) + activestorage (7.0.8.6) + actionpack (= 7.0.8.6) + activejob (= 7.0.8.6) + activerecord (= 7.0.8.6) + activesupport (= 7.0.8.6) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4.3) + activesupport (7.0.8.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -100,7 +100,7 @@ GEM sidekiq (>= 6.0) coderay (1.1.3) colorize (0.8.1) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.4) connection_pool (2.3.0) consistency_fail (0.3.7) crass (1.0.6) @@ -183,7 +183,7 @@ GEM domain_name (~> 0.5) http-form_data (2.3.0) http_parser.rb (0.8.0) - i18n (1.13.0) + i18n (1.14.6) concurrent-ruby (~> 1.0) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -222,7 +222,7 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) method_source (1.0.0) mime-types (3.4.1) mime-types-data (~> 3.2015) @@ -230,39 +230,35 @@ GEM mina (1.2.4) open4 (~> 1.3.4) rake - mini_mime (1.1.2) - mini_portile2 (2.8.2) + mini_mime (1.1.5) + mini_portile2 (2.8.8) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.18.0) + minitest (5.24.1) mollie-api-ruby (4.7.1) msgpack (1.5.2) multi_json (1.15.0) multi_xml (0.6.0) nenv (0.3.0) - net-imap (0.2.3) + net-imap (0.2.4) digest net-protocol strscan - net-pop (0.1.1) - digest + net-pop (0.1.2) net-protocol - timeout net-protocol (0.1.3) timeout net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) - net-smtp (0.3.1) - digest + net-smtp (0.3.4) net-protocol - timeout net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.5.8) - nokogiri (1.14.3) + nio4r (2.7.4) + nokogiri (1.14.5) mini_portile2 (~> 2.8.0) racc (~> 1.4) - nokogiri (1.14.3-x86_64-linux) + nokogiri (1.14.5-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -289,8 +285,8 @@ GEM activerecord (>= 6.0) request_store (~> 1.4) parallel (1.22.1) - paranoia (2.6.0) - activerecord (>= 5.1, < 7.1) + paranoia (3.0.0) + activerecord (>= 6, < 8.1) parser (3.1.2.0) ast (~> 2.4.1) pg (1.3.5) @@ -303,13 +299,13 @@ GEM pry-rails (0.3.9) pry (>= 0.10.4) public_suffix (4.0.7) - puma (6.1.1) + puma (6.4.3) nio4r (~> 2.0) pundit (2.2.0) activesupport (>= 3.0.0) raabro (1.4.0) racc (1.6.2) - rack (2.2.7) + rack (2.2.10) rack-attack (6.6.1) rack (>= 1.0, < 3) rack-protection (3.0.2) @@ -318,20 +314,20 @@ GEM rack rack-test (2.1.0) rack (>= 1.3) - rails (7.0.4.3) - actioncable (= 7.0.4.3) - actionmailbox (= 7.0.4.3) - actionmailer (= 7.0.4.3) - actionpack (= 7.0.4.3) - actiontext (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activemodel (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rails (7.0.8.6) + actioncable (= 7.0.8.6) + actionmailbox (= 7.0.8.6) + actionmailer (= 7.0.8.6) + actionpack (= 7.0.8.6) + actiontext (= 7.0.8.6) + actionview (= 7.0.8.6) + activejob (= 7.0.8.6) + activemodel (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) bundler (>= 1.15.0) - railties (= 7.0.4.3) + railties (= 7.0.8.6) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -344,9 +340,9 @@ GEM rails-i18n (7.0.3) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + railties (7.0.8.6) + actionpack (= 7.0.8.6) + activesupport (= 7.0.8.6) method_source rake (>= 12.2) thor (~> 1.0) @@ -468,6 +464,7 @@ GEM simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) + simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) slack-notifier (2.4.0) spring (2.1.1) @@ -486,13 +483,13 @@ GEM sshkit (1.21.2) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - strscan (3.0.3) + strscan (3.0.9) terminal-notifier-guard (1.7.0) - thor (1.2.1) + thor (1.2.2) tilt (2.1.0) timecop (0.9.5) timeliness (0.4.5) - timeout (0.3.1) + timeout (0.3.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) @@ -520,13 +517,13 @@ GEM rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) wicked_pdf (2.6.3) activesupport wkhtmltopdf-binary (0.12.6.5) - zeitwerk (2.6.8) + zeitwerk (2.6.18) PLATFORMS ruby @@ -567,11 +564,11 @@ DEPENDENCIES omniauth-oauth2 (~> 1.7.0) omniauth-rails_csrf_protection (~> 1.0) paper_trail (~> 14.0.0) - paranoia (~> 2.6.0) + paranoia (~> 3.0.0) pg (~> 1.3.0) pry-byebug pry-rails - puma (~> 6.1.1) + puma (~> 6.4.0) pundit (~> 2.2.0) rack-attack (~> 6.6.0) rails (~> 7.0.4, >= 7.0.4.3) @@ -593,6 +590,7 @@ DEPENDENCIES sidekiq-scheduler (~> 5.0.2) simple_form (~> 5.1.0) simplecov + simplecov-lcov (~> 0.8.0) slack-notifier (~> 2.4.0) spring spring-commands-rspec @@ -609,4 +607,4 @@ DEPENDENCIES wkhtmltopdf-binary BUNDLED WITH - 2.2.15 + 2.4.14 diff --git a/README.md b/README.md index 2613efb97..aef9c7370 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Alpha SOFIA [![Continuous Integration](https://github.com/csvalpha/sofia/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/csvalpha/sofia/actions/workflows/continuous-integration.yml) [![Continuous Delivery](https://github.com/csvalpha/sofia/actions/workflows/continuous-delivery.yml/badge.svg)](https://github.com/csvalpha/sofia/actions/workflows/continuous-delivery.yml) +[![codecov](https://codecov.io/github/csvalpha/sofia/graph/badge.svg?token=RGR5PARLD5)](https://codecov.io/github/csvalpha/sofia) The source code belonging to Alpha SOFIA. It is a system built with Ruby on Rails with Turbolinks and a little VueJS, used to manage orders in our own bar "Flux". Users authenticate via OAuth API (currently "Alpha AMBER") to see how much credit they got left, or to be able to register new orders and/or payments. @@ -54,7 +55,7 @@ $ EDITOR="code --wait" bundle exec rails credentials:edit In OAuth AMBER (github.com/csvalpha/amber-api), execute the following command (in `rails console`): ```ruby -app = Doorkeeper::Application.create(name: 'SOFIA - Streepsysteem der C.S.V. Alpha', redirect_uri: 'http://localhost:5000/users/auth/amber_oauth2/callback', scopes: 'public tomato') +app = Doorkeeper::Application.create(name: 'SOFIA - Streepsysteem der C.S.V. Alpha', redirect_uri: 'http://localhost:5000/users/auth/amber_oauth2/callback', scopes: 'public sofia') app.uid app.plaintext_secret ``` diff --git a/app/models/payment.rb b/app/models/payment.rb index 4dd231c05..8a5982dec 100644 --- a/app/models/payment.rb +++ b/app/models/payment.rb @@ -33,7 +33,7 @@ def self.create_with_mollie(description, attributes = nil) mollie_payment = Mollie::Payment.create( amount: { value: format('%.2f', amount: attributes[:amount]), currency: 'EUR' }, description: description, - redirect_url: "http://#{Rails.application.config.x.tomato_host}/payments/#{obj.id}/callback" + redirect_url: "http://#{Rails.application.config.x.sofia_host}/payments/#{obj.id}/callback" ) obj.update(mollie_id: mollie_payment.id) diff --git a/app/views/partials/_footer.html.erb b/app/views/partials/_footer.html.erb index 5e2ce47d4..c510d5f3c 100644 --- a/app/views/partials/_footer.html.erb +++ b/app/views/partials/_footer.html.erb @@ -1,8 +1,8 @@