Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
erinesullivan committed Jun 17, 2024
2 parents 32f8525 + 9fd39a5 commit 45cb029
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 42 deletions.
14 changes: 14 additions & 0 deletions .github/update_dependencies_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Overview

Monthly dependency updates for Account

## NPM

```
NPM_SUMMARY
```
## Bundler

```
BUNDLER_SUMMARY
```
90 changes: 90 additions & 0 deletions .github/workflows/update-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Update dependencies

on:
workflow_dispatch:
schedule:
- cron: '0 8 1 * *' #8AM first of the month


jobs:
update:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.cpr.outputs.pull-request-head-sha }}
steps:
- uses: actions/checkout@v4
- name: Create .env file
run: cat env.* > .env
- name: Load .env file
uses: xom9ikk/dotenv@v2
- name: Set up Ruby 3.3
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
env:
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: ${{ secrets.GITHUB_TOKEN }}
- name: Get gems to update
continue-on-error: true
run: bundle outdated > /tmp/bundle_summary.txt
- name: clean up bundle_summary.txt
run: |
sed -i -n '/^Gem\s.*Current/,$p' /tmp/bundle_summary.txt
cat /tmp/bundle_summary.txt
- name: Update bundler
run: bundle update --bundler
- name: Update gems
run: bundle update
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: get npm summary
continue-on-error: true
run: |
npm install
npm outdated > /tmp/npm_summary.txt
- name: cat pr body
run: cat /tmp/npm_summary.txt
- name: Update node dependencies
run: |
npx -p npm-check-updates ncu -u
npm install
npm list
- name: Run tests
run: bundle exec rspec
- name: generate pr body
run: |
sed $'/BUNDLER_SUMMARY/{r /tmp/bundle_summary.txt\nd}' .github/update_dependencies_template.md > /tmp/pr_body_first.md
sed $'/NPM_SUMMARY/{r /tmp/npm_summary.txt\nd}' /tmp/pr_body_first.md > /tmp/pr_body.md
- name: Get PR title
run: echo "PR_TITLE=$(date +'%B %Y') dependency updates" >> $GITHUB_ENV
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
commit-message: "Update dependencies"
title: ${{ env.PR_TITLE }}
body-path: /tmp/pr_body.md
assignees: niquerio, erinesullivan

build-unstable:
needs: update
name: Build unstable ${{ needs.update.outputs.sha }}
uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1
with:
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ needs.update.outputs.sha}}
dockerfile: Dockerfile
secrets: inherit

deploy-unstable:
needs: build-unstable
name: Deploy to workshop
uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1
with:
image: ${{ needs.build-unstable.outputs.image }}
file: environments/account/workshop/web-image.txt
CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }}
CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }}
secrets: inherit

3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ gem "omniauth"
gem "omniauth_openid_connect"
gem "redcarpet"
gem "rackup"
# needed for when we go to ruby 3.3, but we aren't there yet
gem "canister"
gem "semantic_logger"
gem "csv" # included here because httparty uses it and ought to require it

# In order to get rspec to work for ruby 3.1. Maybe later see if it's still necessary
Expand Down
73 changes: 40 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activesupport (7.1.3.2)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -26,17 +26,18 @@ GEM
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
aes_key_wrap (1.1.0)
anyway_config (2.6.3)
anyway_config (2.6.4)
ruby-next-core (~> 1.0)
ast (2.4.2)
attr_required (1.0.2)
base64 (0.2.0)
bigdecimal (3.1.7)
bigdecimal (3.1.8)
bindata (2.5.0)
byebug (11.1.3)
canister (0.9.2)
climate_control (1.2.0)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.1)
connection_pool (2.4.1)
crack (1.0.0)
bigdecimal
Expand All @@ -49,7 +50,7 @@ GEM
dry-initializer (3.1.1)
email_validator (2.2.4)
activemodel
faraday (2.9.0)
faraday (2.9.1)
faraday-net_http (>= 2.0, < 3.2)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
Expand All @@ -61,9 +62,9 @@ GEM
csv
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.7.1)
json (2.7.2)
json-jwt (1.16.6)
activesupport (>= 4.2)
aes_key_wrap
Expand All @@ -80,18 +81,18 @@ GEM
net-imap
net-pop
net-smtp
method_source (1.0.0)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.22.3)
minitest (5.23.1)
multi_json (1.15.0)
multi_xml (0.7.0)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
mutex_m (0.2.0)
net-http (0.4.1)
uri
net-imap (0.4.10)
net-imap (0.4.12)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -100,7 +101,7 @@ GEM
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.1)
nio4r (2.7.3)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 2.2.3)
Expand All @@ -122,7 +123,7 @@ GEM
validate_url
webfinger (~> 2.0)
parallel (1.24.0)
parser (3.3.0.5)
parser (3.3.2.0)
ast (~> 2.4.1)
racc
prometheus-client (4.2.2)
Expand All @@ -135,8 +136,8 @@ GEM
public_suffix (5.0.5)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (3.0.10)
racc (1.8.0)
rack (3.0.11)
rack-oauth2 (2.2.1)
activesupport
attr_required
Expand All @@ -156,8 +157,9 @@ GEM
webrick (~> 1.8)
rainbow (3.1.1)
redcarpet (3.6.0)
regexp_parser (2.9.0)
rexml (3.2.6)
regexp_parser (2.9.2)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand All @@ -167,11 +169,11 @@ GEM
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.62.1)
rubocop (1.63.5)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -182,14 +184,16 @@ GEM
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-performance (1.20.2)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-next-core (1.0.2)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-next-core (1.0.3)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
semantic_logger (4.15.0)
concurrent-ruby (~> 1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -210,18 +214,19 @@ GEM
tilt (~> 2.0)
sinatra-flash (0.3.0)
sinatra (>= 1.0.0)
standard (1.35.1)
standard (1.36.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.62.0)
rubocop (~> 1.63.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.3)
standard-performance (~> 1.4)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.3.1)
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.20.2)
rubocop-performance (~> 1.21.0)
strscan (3.1.0)
swd (2.0.3)
activesupport (>= 3)
attr_required (>= 0.0.5)
Expand All @@ -241,7 +246,7 @@ GEM
activesupport
faraday (~> 2.0)
faraday-follow_redirects
webmock (3.23.0)
webmock (3.23.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -266,6 +271,7 @@ PLATFORMS
DEPENDENCIES
addressable
alma_rest_client!
canister
climate_control
csv
httparty
Expand All @@ -280,6 +286,7 @@ DEPENDENCIES
rackup
redcarpet
rspec
semantic_logger
simplecov
sinatra
sinatra-contrib
Expand All @@ -291,4 +298,4 @@ DEPENDENCIES
yabeda-puma-plugin

BUNDLED WITH
2.5.7
2.5.11
2 changes: 2 additions & 0 deletions account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Monkey patch for omniauth_openid_connect -> openid_connect -> webfinger -> httpclient SSL errors
# require_relative "./lib/monkey_httpclient"

require_relative "lib/services"

require_relative "lib/entities/entities"
require_relative "lib/entities/pages"
require_relative "lib/entities/empty_state"
Expand Down
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ services:
- .:/app
- gem_cache:/gems
env_file:
- .env
- env.development
- .env

nelnet-test:
build: ./nelnet_test/.
Expand Down
11 changes: 10 additions & 1 deletion lib/routes/fines_and_fees.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@
post "/pay" do
fines = Fines.for(uniqname: session[:uniqname])
total_sum = fines.total_sum.to_f
# 2024-06-06 This messages mrio when there's a fine to make it easier to determine if the fines bug is still happening.
begin
HTTParty.post(S.slack_url, headers: {"Content-type" => "application/json"}, body: {text: "Someone started a fine payment attempt in account"}.to_json)
rescue
S.logger.error("Couldn't send slack message")
end

amount = (params["pay_in_full"] == "true") ? total_sum : params["partial_amount"].to_f
if amount <= total_sum
nelnet = Nelnet.new(amount_due: amount.to_currency)
session["order_number"] = nelnet.orderNumber
session["order_number"] = nelnet.order_number
S.logger.info("Fee payment attempt: order_number: #{nelnet.order_number}")
redirect nelnet.url
else
flash[:error] = "You don't need to overpay!!!"
Expand All @@ -31,6 +39,7 @@
flash.now[:success] = "Fines successfully paid"
else
flash.now[:error] = receipt.message
S.logger.error(receipt.message)
end
erb :"fines-and-fees/receipt", locals: {receipt: receipt}
rescue
Expand Down
20 changes: 20 additions & 0 deletions lib/services.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require "canister"
require "semantic_logger"

Services = Canister.new
S = Services

S.register(:log_stream) do
$stdout.sync = true
$stdout
end

S.register(:logger) do
SemanticLogger["account"]
end

S.register(:slack_url) do
ENV["SLACK_URL"] || "https://hooks.slack.com/services/WHATEVERELSE"
end

SemanticLogger.add_appender(io: S.log_stream, level: :info) unless ENV["APP_ENV"] == "test"
Loading

0 comments on commit 45cb029

Please sign in to comment.