Skip to content

Commit

Permalink
Merge branch 'main' into fix-bucket-name-deprecation-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnfish authored Jul 26, 2024
2 parents 5dcbbe2 + fceac7a commit f84fc30
Show file tree
Hide file tree
Showing 24 changed files with 354 additions and 878 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "anghammarad-client-node/" # Location of package manifests
schedule:
interval: "monthly"
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:

# Configuring caching is also recommended.
# See https://github.com/actions/setup-java
- name: Setup Java 11
uses: actions/setup-java@v3
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '21'
distribution: 'corretto'
cache: 'sbt'

Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/sbt-dependency-graph.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Update Dependency Graph for SBT
on:
push:
branches:
- main
workflow_dispatch:
jobs:
dependency-graph:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: scalacenter/sbt-dependency-submission@7ebd561e5280336d3d5b445a59013810ff79325e # v3.0.1
permissions:
contents: write
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java corretto-21.0.3.9.1
6 changes: 6 additions & 0 deletions anghammarad-client-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @guardian/anghammarad

## 1.8.3

### Patch Changes

- b19c952: Update `ws` dependency to 7.5.10

## 1.8.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion anghammarad-client-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@guardian/anghammarad",
"version": "1.8.2",
"version": "1.8.3",
"description": "Notification service for the Guardian's dev teams",
"main": "dist/src/main.js",
"types": "dist/src/main.d.ts",
Expand Down
1,123 changes: 278 additions & 845 deletions anghammarad-client-node/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gu.anghammarad

import com.gu.anghammarad.common.Contacts
import com.gu.anghammarad.models.{Configuration, Contact, Message, Notification}
import com.gu.anghammarad.messages.{Messages, SendMessages}

Expand Down
2 changes: 1 addition & 1 deletion anghammarad/src/main/scala/com/gu/anghammarad/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.amazonaws.auth.profile.ProfileCredentialsProvider
import com.amazonaws.regions.Regions
import com.amazonaws.services.s3.AmazonS3Client
import com.amazonaws.services.s3.model.{GetObjectRequest, S3ObjectInputStream}
import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail

import scala.io.Source
import scala.util.{Success, Try}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gu.anghammarad.messages

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.models.HangoutMessage
import sttp.client3.{HttpURLConnectionBackend, Response, UriContext, basicRequest}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object Messages {
val markdownWithNotice = markdown + anghammaradNotice(notification)
val plaintextWithNotice = plaintext + anghammaradNotice(notification)

val html = mdRenderer.render(mdParser.parse(markdownWithNotice))
val html = mdRenderer.render(mdParser.parse(markdownWithNotice)).replace("\n", "<br>")

EmailMessage(
notification.subject,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.gu.anghammarad.messages

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.Enrichments._
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.models._

import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.gu.anghammarad.serialization

import cats.syntax.either._
import com.amazonaws.services.lambda.runtime.events.SNSEvent
import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.Enrichments._
import com.gu.anghammarad.models._
import io.circe._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ class MessagesTest extends AnyFreeSpec with Matchers with EitherValues {
}

"html" - {
"for all messages" - {
val notification = testNotification("subject", "message line 1\nmessage line 2")

"replaces newlines with <br> tags" in {
emailMessage(notification).html should include("message line 1<br>message line 2")
}
}

"if actions are present" - {
val notification = testNotification("subject", "message", Action("cta1", "url1"), Action("cta2", "url2"))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.Contacts._
import com.gu.anghammarad.common.Contacts._
import com.gu.anghammarad.models._
import com.gu.anghammarad.serialization.Serialization
import com.gu.anghammarad.testutils.TryValues
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

import scala.io.Source
import scala.util.Try


class ContactsTest extends AnyFreeSpec with Matchers with TryValues {
Expand Down
17 changes: 10 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val assemblySettings = Seq(

inThisBuild(Seq(
scalaVersion := "3.4.0",
crossScalaVersions := Seq("2.13.13", scalaVersion.value),
crossScalaVersions := Seq("2.13.14", scalaVersion.value),
scalacOptions ++= Seq(
"-deprecation",
"-Xfatal-warnings",
Expand All @@ -24,10 +24,10 @@ inThisBuild(Seq(
licenses := Seq(License.Apache2),
))

val awsSdkVersion = "1.12.704"
val circeVersion = "0.14.6"
val awsSdkVersion = "1.12.759"
val circeVersion = "0.14.9"
val flexmarkVersion = "0.64.8"
val scalaTestVersion = "3.2.18"
val scalaTestVersion = "3.2.19"
val scalaLoggingVersion = "3.9.5"

//Projects
Expand Down Expand Up @@ -57,6 +57,9 @@ lazy val root = project
lazy val common = project
.settings(
name := "anghammarad-common",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
)
)

lazy val client = project
Expand All @@ -79,21 +82,21 @@ lazy val anghammarad = project
name := "anghammarad",
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0",
"com.amazonaws" % "aws-lambda-java-events" % "3.11.5",
"com.amazonaws" % "aws-lambda-java-events" % "3.12.0",
"com.amazonaws" % "aws-lambda-java-core" % "1.2.3",
"com.amazonaws" % "aws-java-sdk-lambda" % awsSdkVersion,
"com.amazonaws" % "aws-java-sdk-ses" % awsSdkVersion,
"com.amazonaws" % "aws-java-sdk-s3" % awsSdkVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"com.softwaremill.sttp.client3" %% "core" % "3.9.5",
"com.softwaremill.sttp.client3" %% "core" % "3.9.7",
"com.vladsch.flexmark" % "flexmark" % flexmarkVersion,
"com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % flexmarkVersion,
"com.vladsch.flexmark" % "flexmark-ext-tables" % flexmarkVersion,
"com.vladsch.flexmark" % "flexmark-util" % flexmarkVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"ch.qos.logback" % "logback-classic" % "1.5.5",
"ch.qos.logback" % "logback-classic" % "1.5.6",
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
),
assembly / assemblyOutputPath := file("anghammarad/anghammarad.jar"),
Expand Down
2 changes: 1 addition & 1 deletion cloudformation/cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Resources:
- s3:GetObject
Resource: !Sub arn:aws:s3:::${ConfigBucket}/*
Handler: com.gu.anghammarad.Lambda::handleRequest
Runtime: java11
Runtime: java21
MemorySize: 512
Timeout: 30
CodeUri:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import scala.util.{Failure, Try}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.models.{Channel, Contact, Email, EmailAddress, HangoutsChat, HangoutsRoom, Mapping, Message, _}
import com.gu.anghammarad.Targets._
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.common.Targets.{appMatches, awsAccountMatches, githubTeamSlugMatches, includesApp, includesAwsAccount, includesGithubTeamSlug, includesStack, sortMappingsByTargets, stackMatches}
import com.gu.anghammarad.models._

import scala.util.{Success, Try}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.models._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.models._
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers


class TargetsTest extends AnyFreeSpec with Matchers {
import com.gu.anghammarad.Targets._
import com.gu.anghammarad.common.Targets._

"includesAwsAccount" - {
"returns false if AwsAccount is enquired about and not present" in {
Expand Down
2 changes: 1 addition & 1 deletion dev/src/main/scala/com/gu/anghammarad/Main.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gu.anghammarad

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.ArgParser.argParser
import com.gu.anghammarad.models.{EmailAddress, HangoutsRoom, Notification}
import com.gu.anghammarad.serialization.Serialization
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.9
sbt.version=1.10.1
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")

// for publishing the scala client
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.11.0")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.1")

0 comments on commit f84fc30

Please sign in to comment.