Skip to content

Commit

Permalink
Merge pull request #19 from guardian/move-build-to-gha
Browse files Browse the repository at this point in the history
Migrate build to GHA
  • Loading branch information
rowannekabalan authored Jul 28, 2023
2 parents 5d2be02 + 076c5d4 commit 70562ef
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 11 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build editors-picks-uploader

on:
push:
branches: [ "**" ]
workflow_dispatch: {}

jobs:
editors-picks-uploader:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
checks: write
issues: read

steps:
- uses: actions/checkout@v3

- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 11
cache: sbt

- name: Build and test
env:
SBT_JUNIT_OUTPUT: ./junit-tests
run: sbt 'test;universal:packageBin'

- uses: EnricoMi/publish-unit-test-result-action@v1
if: always() #runs even if there is a test failure
with:
files: junit-tests/*.xml

- uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: eu-west-1
role-to-assume: ${{secrets.GU_RIFF_RAFF_ROLE_ARN}}

- uses: guardian/actions-riff-raff@v2
with:
configPath: riff-raff.yaml
projectName: Content Platforms::editors-picks-uploader-lambda
buildNumberOffset: 71
contentDirectories: |
editors-picks-uploader:
- target/universal/editors-picks-uploader.zip
13 changes: 5 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ scalaVersion := "2.13.10"
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-Xfatal-warnings")
name := "editors-picks-uploader"

lazy val editorsPicksUploader = (project in file(".")).enablePlugins(JavaAppPackaging, RiffRaffArtifact)
lazy val editorsPicksUploader = (project in file(".")).enablePlugins(JavaAppPackaging)

val AwsSdkVersion = "1.12.261"

Expand All @@ -28,14 +28,11 @@ dependencyOverrides ++= Seq(
Universal / topLevelDirectory := None
Universal / packageName := normalizedName.value

riffRaffManifestProjectName := s"Content Platforms::editors-picks-uploader-lambda"
riffRaffPackageName := "editors-picks-uploader"
riffRaffPackageType := (Universal / packageBin).value
riffRaffUploadArtifactBucket := Option("riffraff-artifact")
riffRaffUploadManifestBucket := Option("riffraff-builds")

initialize := {
val _ = initialize.value
assert(sys.props("java.specification.version") == "11",
"Java 11 is required for this project.")
}
}


Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", sys.env.getOrElse("SBT_JUNIT_OUTPUT", "junit"))
5 changes: 2 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")

addSbtPlugin("com.gu" % "sbt-riffraff-artifact" % "1.1.12")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.6")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")

addDependencyTreePlugin

0 comments on commit 70562ef

Please sign in to comment.