Skip to content

Commit

Permalink
Merge branch 'main' into update/non_aws
Browse files Browse the repository at this point in the history
  • Loading branch information
aracho1 authored Apr 24, 2024
2 parents e1117ad + d666691 commit 33a2aaa
Show file tree
Hide file tree
Showing 26 changed files with 1,856 additions and 1,576 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci-mobile-save-for-later-user-deletion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ jobs:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v1
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
aws-region: eu-west-1
- name: Set up JDK 8
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
java-version: 21
distribution: corretto
cache: sbt

- name: Create artifacts
run: sbt "project mobile-save-for-later-user-deletion" assembly
- name: Run Tests & Create Artifacts
run: sbt "project mobile-save-for-later-user-deletion" test assembly

- name: RiffRaff upload artifacts and upload cfn
uses: guardian/actions-riff-raff@v2
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci-mobile-save-for-later.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ jobs:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v1
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
aws-region: eu-west-1
- name: Set up JDK 8
uses: actions/setup-java@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
java-version: 21
distribution: corretto
cache: sbt

- name: Create artifacts
run: sbt "project mobile-save-for-later" assembly
- name: Run Tests and Create Artifacts
run: sbt "project mobile-save-for-later" test assembly

- name: Build CDK
working-directory: ./cdk
Expand All @@ -41,4 +41,4 @@ jobs:
- cdk/cdk.out/MobileSaveForLater-CODE.template.json
- cdk/cdk.out/MobileSaveForLater-PROD.template.json
mobile-save-for-later:
- mobile-save-for-later/target/scala-2.12/mobile-save-for-later.jar
- mobile-save-for-later/target/scala-2.12/mobile-save-for-later.jar
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ Try(mapper.readValue[List[SavedArticle]](json)) match {
*NB: I found that when a user record has 350+ articles the resultant string in too long for idea to handle.
## Testing the Apps on CODE
## Testing the Apps on CODE and running Locally
[Save For Later App](docs/testing/save-for-later.md)
[User Deletion App](docs/testing/user-deletion.md)
16 changes: 8 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import scala.collection.immutable

val testAndCompileDependencies: String = "test->test;compile->compile"

ThisBuild / libraryDependencySchemes +=
"org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always // due to Identity using lift-json

def projectMaker(projectName: String) = Project(projectName, file(projectName))
.enablePlugins(RiffRaffArtifact)
.settings(
Expand All @@ -17,6 +20,7 @@ def projectMaker(projectName: String) = Project(projectName, file(projectName))
.dependsOn(common % "compile->compile")
.aggregate(common)

ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
def commonAssemblySettings(module: String): immutable.Seq[Def.Setting[_]] =
commonSettings ++ List(
assemblyJarName := s"${name.value}.jar",
Expand All @@ -27,17 +31,14 @@ def commonAssemblySettings(module: String): immutable.Seq[Def.Setting[_]] =

val commonSettings: immutable.Seq[Def.Setting[_]] = List(
fork := true, // was hitting deadlock, fxxund similar complaints online, disabling concurrency helps: https://github.com/sbt/sbt/issues/3022, https://github.com/mockito/mockito/issues/1067
resolvers ++= Seq(
Resolver.sonatypeRepo("releases")
),
resolvers ++= Resolver.sonatypeOssRepos("releases"),
libraryDependencies ++= Seq(
awsLambda,
awsDynamo,
awsLambdaLog,
awsJavaSdk,
jackson,
jacksonDataFormat,
jacksonJdk8DataType,
jacksonJsrDataType,
log4j,
commonsIo,
Expand All @@ -48,10 +49,9 @@ val commonSettings: immutable.Seq[Def.Setting[_]] = List(
specsScalaCheck,
specsMock
),
assembly / assemblyMergeStrategy := {
ThisBuild / assemblyMergeStrategy := {
case "META-INF/MANIFEST.MF" => MergeStrategy.discard
case "META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat" =>
new MergeFilesStrategy
case PathList(ps @ _*) if ps.last equalsIgnoreCase "Log4j2Plugins.dat" => sbtassembly.Log4j2MergeStrategy.plugincache
case _ => MergeStrategy.first
},
dependencyOverrides ++= Seq(
Expand All @@ -67,7 +67,7 @@ val commonSettings: immutable.Seq[Def.Setting[_]] = List(
"-deprecation",
"-encoding",
"UTF-8",
"-target:jvm-1.8",
"-release:21",
"-Ypartial-unification",
"-Ywarn-dead-code"
)
Expand Down
45 changes: 36 additions & 9 deletions cdk/lib/__snapshots__/mobile-save-for-later.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ Object {
},
},
},
"Metadata": Object {
"gu:cdk:constructs": Array [
"GuDistributionBucketParameter",
"GuLambdaFunction",
"GuLambdaFunction",
"GuApiGatewayWithLambdaByPath",
],
"gu:cdk:version": "TEST",
},
"Outputs": Object {
"RestApiEndpoint0551178A": Object {
"Value": Object {
Expand Down Expand Up @@ -168,6 +177,7 @@ Object {
"Type": "AWS::ApiGateway::RestApi",
},
"RestApiAccount7C83CF5A": Object {
"DeletionPolicy": "Retain",
"DependsOn": Array [
"RestApi0C43BF4B",
],
Expand All @@ -180,8 +190,10 @@ Object {
},
},
"Type": "AWS::ApiGateway::Account",
"UpdateReplacePolicy": "Retain",
},
"RestApiCloudWatchRoleE3ED6605": Object {
"DeletionPolicy": "Retain",
"Properties": Object {
"AssumeRolePolicyDocument": Object {
"Statement": Array [
Expand Down Expand Up @@ -229,6 +241,7 @@ Object {
],
},
"Type": "AWS::IAM::Role",
"UpdateReplacePolicy": "Retain",
},
"RestApiDeployment180EC5035ed39622d7840f196ed35b5345f76c92": Object {
"DependsOn": Array [
Expand Down Expand Up @@ -750,7 +763,7 @@ Object {
"Arn",
],
},
"Runtime": "java8",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down Expand Up @@ -869,7 +882,7 @@ Object {
Object {
"Ref": "DistributionBucketName",
},
"/*",
"/mobile/CODE/mobile-save-for-later/mobile-save-for-later.jar",
],
],
},
Expand Down Expand Up @@ -980,7 +993,7 @@ Object {
"Arn",
],
},
"Runtime": "java8",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down Expand Up @@ -1099,7 +1112,7 @@ Object {
Object {
"Ref": "DistributionBucketName",
},
"/*",
"/mobile/CODE/mobile-save-for-later/mobile-save-for-later.jar",
],
],
},
Expand Down Expand Up @@ -1198,6 +1211,16 @@ Object {
},
},
},
"Metadata": Object {
"gu:cdk:constructs": Array [
"GuDistributionBucketParameter",
"GuLambdaFunction",
"GuLambdaFunction",
"GuApiGatewayWithLambdaByPath",
"GuApiGateway5xxPercentageAlarm",
],
"gu:cdk:version": "TEST",
},
"Outputs": Object {
"RestApiEndpoint0551178A": Object {
"Value": Object {
Expand Down Expand Up @@ -1309,7 +1332,7 @@ Object {
},
],
"AlarmDescription": "mobile-save-for-later exceeded 1% error rate",
"AlarmName": "High 5XX error % from mobile-save-for-later (ApiGateway) in PROD",
"AlarmName": "High 5XX error percentage from mobile-save-for-later (ApiGateway) in PROD",
"ComparisonOperator": "GreaterThanThreshold",
"EvaluationPeriods": 1,
"Metrics": Array [
Expand Down Expand Up @@ -1420,6 +1443,7 @@ Object {
"Type": "AWS::ApiGateway::RestApi",
},
"RestApiAccount7C83CF5A": Object {
"DeletionPolicy": "Retain",
"DependsOn": Array [
"RestApi0C43BF4B",
],
Expand All @@ -1432,8 +1456,10 @@ Object {
},
},
"Type": "AWS::ApiGateway::Account",
"UpdateReplacePolicy": "Retain",
},
"RestApiCloudWatchRoleE3ED6605": Object {
"DeletionPolicy": "Retain",
"Properties": Object {
"AssumeRolePolicyDocument": Object {
"Statement": Array [
Expand Down Expand Up @@ -1481,6 +1507,7 @@ Object {
],
},
"Type": "AWS::IAM::Role",
"UpdateReplacePolicy": "Retain",
},
"RestApiDeployment180EC503a9713084f6e42c3174f3f6569d53b59c": Object {
"DependsOn": Array [
Expand Down Expand Up @@ -2002,7 +2029,7 @@ Object {
"Arn",
],
},
"Runtime": "java8",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down Expand Up @@ -2121,7 +2148,7 @@ Object {
Object {
"Ref": "DistributionBucketName",
},
"/*",
"/mobile/PROD/mobile-save-for-later/mobile-save-for-later.jar",
],
],
},
Expand Down Expand Up @@ -2232,7 +2259,7 @@ Object {
"Arn",
],
},
"Runtime": "java8",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down Expand Up @@ -2351,7 +2378,7 @@ Object {
Object {
"Ref": "DistributionBucketName",
},
"/*",
"/mobile/PROD/mobile-save-for-later/mobile-save-for-later.jar",
],
],
},
Expand Down
2 changes: 1 addition & 1 deletion cdk/lib/mobile-save-for-later.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class MobileSaveForLater extends GuStack {
const app = "mobile-save-for-later";

const commonLambdaProps = {
runtime: Runtime.JAVA_8, // We should upgrade to Java 11 in a future PR
runtime: Runtime.JAVA_21,
app,
fileName: `${app}.jar`,
};
Expand Down
Loading

0 comments on commit 33a2aaa

Please sign in to comment.