Skip to content

Commit

Permalink
Merge pull request #258 from zio/update_libs
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmsamson authored Oct 8, 2024
2 parents 7c4ad8c + b40ef05 commit 32e11a1
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
pull_request:
push:
branches: ['master']
branches: [ 'master' ]
release:
types:
- published
Expand All @@ -14,19 +14,19 @@ jobs:
strategy:
fail-fast: false
matrix:
java: ['[email protected]', 'adopt@1.11']
scala: ['2.12.16', '2.13.8', '3.2.0']
java: [ 'amazon-corretto@1.17' ]
scala: [ '2.12.19', '2.13.14', '3.3.3' ]
steps:
- uses: actions/[email protected]
- uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Lint code
run: sbt check
- name: Run tests
run: sbt ++${{ matrix.scala }}! test
- uses: actions/[email protected]
- uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Lint code
run: sbt check
- name: Run tests
run: sbt ++${{ matrix.scala }}! test

website:
runs-on: ubuntu-20.04
Expand All @@ -44,10 +44,10 @@ jobs:
uses: coursier/cache-action@v6
- name: Check Website Generation
run: sbt compileDocs

publish:
runs-on: ubuntu-20.04
needs: [build, website]
needs: [ build, website ]
if: github.event_name != 'pull_request'
steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
generate-readme:
name: Generate README
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'push') || ((github.event_name == 'release') && (github.event_name == 'published')) }}
if: ${{ (github.event_name == 'push') || ((github.event_name == 'release') && (github.event.action == 'published')) }}
steps:
- name: Git Checkout
uses: actions/[email protected]
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ Each release will contain a zip file ready to be used as a lambda layer) and you

1. Create an AWS Lambda function and choose the runtime where you provide your own bootstrap on Amazon Linux 2

![create-lambda](https://user-images.githubusercontent.com/14280155/164102664-3686e415-20be-4dd9-8979-ea6098a7a4b9.png)
![create-lambda](docs/https://user-images.githubusercontent.com/14280155/164102664-3686e415-20be-4dd9-8979-ea6098a7a4b9.png)
2. Run `sbt GraalVMNativeImage/packageBin`, we'll find the binary present under the `graalvm-native-image` folder:

![binary-located](https://user-images.githubusercontent.com/14280155/164103337-6645dfeb-7fc4-4f7f-9b13-8005b0cddead.png)
![binary-located](docs/https://user-images.githubusercontent.com/14280155/164103337-6645dfeb-7fc4-4f7f-9b13-8005b0cddead.png)

3. Create the following bootstap file (which calls out to the binary) and place it in the same directory alongside the binary:
```bash
Expand All @@ -66,7 +66,7 @@ Each release will contain a zip file ready to be used as a lambda layer) and you
./zio-lambda-example
```

![bootstrap-alongside-native-binary](https://user-images.githubusercontent.com/14280155/164103935-0bf7a6cb-814d-4de1-8fa1-4d0d54fb6e88.png)
![bootstrap-alongside-native-binary](docs/https://user-images.githubusercontent.com/14280155/164103935-0bf7a6cb-814d-4de1-8fa1-4d0d54fb6e88.png)

4. Now we can zip both these files up:
```log
Expand All @@ -77,11 +77,11 @@ Each release will contain a zip file ready to be used as a lambda layer) and you

5. Take `upload.zip` and upload it to AWS Lambda and test your function:

![lambda-ui](https://user-images.githubusercontent.com/14280155/164104747-039ec584-d3e2-4b47-884d-ff88977e2b53.png)
![lambda-ui](docs/https://user-images.githubusercontent.com/14280155/164104747-039ec584-d3e2-4b47-884d-ff88977e2b53.png)

6. Test everything out to make sure everything works:

![test-ui](https://user-images.githubusercontent.com/14280155/164104858-a720ac55-b9bb-47ec-af70-c4bd5eb5bed3.png)
![test-ui](docs/https://user-images.githubusercontent.com/14280155/164104858-a720ac55-b9bb-47ec-af70-c4bd5eb5bed3.png)

## Deployment of native image binary in a Docker container

Expand Down Expand Up @@ -114,13 +114,13 @@ docker push <your-particular-ecr-image-repository>:<your-tag>

Here is an example:

![image-uploaded](https://user-images.githubusercontent.com/14280155/164120591-68a78d19-c56b-4793-96b8-cfe567443063.png)
![image-uploaded](docs/https://user-images.githubusercontent.com/14280155/164120591-68a78d19-c56b-4793-96b8-cfe567443063.png)

Create a Lambda function and choose container image:

![lambda-create-container-image](https://user-images.githubusercontent.com/14280155/164120637-9c827736-26a8-4c65-92d4-2919157bbda6.png)
![lambda-create-container-image](docs/https://user-images.githubusercontent.com/14280155/164120637-9c827736-26a8-4c65-92d4-2919157bbda6.png)

![image](https://user-images.githubusercontent.com/14280155/164120764-2c736a46-29e3-488c-ba6a-e2b69ef51792.png)
![image](docs/https://user-images.githubusercontent.com/14280155/164120764-2c736a46-29e3-488c-ba6a-e2b69ef51792.png)

Please note that because you incur the overhead of your native binary residing within a Docker container, there is more overhead than the other approach of deploying the binary straight to AWS Lambda

Expand Down
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BuildHelper._
import BuildHelper.*

inThisBuild(
List(
Expand Down Expand Up @@ -28,8 +28,8 @@ inThisBuild(
)
)

val zioVersion = "2.0.10"
val zioJsonVersion = "0.4.2"
val zioVersion = "2.1.9"
val zioJsonVersion = "0.7.3"
val awsLambdaJavaTests = "1.1.1"

lazy val root =
Expand Down Expand Up @@ -67,6 +67,7 @@ lazy val zioLambdaEvent = module("zio-lambda-event", "lambda-event")
.settings(buildInfoSettings("zio.lambda.event"))
.settings(
stdSettings("zio-lambda-event"),
scalacOptions -= "-Yretain-trees",
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")),
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-lambda-java-tests" % awsLambdaJavaTests % "test"
Expand All @@ -78,6 +79,7 @@ lazy val zioLambdaResponse = module("zio-lambda-response", "lambda-response")
.settings(buildInfoSettings("zio.lambda.response"))
.settings(
stdSettings("zio-lambda-response"),
scalacOptions -= "-Yretain-trees",
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")),
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-lambda-java-tests" % awsLambdaJavaTests % "test"
Expand Down Expand Up @@ -125,14 +127,12 @@ lazy val docs = project
.in(file("zio-lambda-docs"))
.settings(
moduleName := "zio-lambda-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
libraryDependencies ++= Seq("dev.zio" %% "zio" % zioVersion),
projectName := "ZIO Lambda",
mainModuleName := (zioLambda / moduleName).value,
projectStage := ProjectStage.Development,
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(zioLambda, zioLambdaEvent, zioLambdaResponse),
docsPublishBranch := "master"
docsPublishBranch := "master",
excludeDependencies += "org.scala-lang.modules" % "scala-collection-compat_2.13"
)
.dependsOn(zioLambda, zioLambdaEvent, zioLambdaResponse)
.enablePlugins(WebsitePlugin)
Expand Down
8 changes: 4 additions & 4 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import sbtbuildinfo._
import BuildInfoKeys._

object BuildHelper {
private val Scala212 = "2.12.16"
private val Scala213 = "2.13.8"
private val Scala3 = "3.2.0"
private val KindProjectorVersion = "0.13.2"
private val Scala212 = "2.12.19"
private val Scala213 = "2.13.14"
private val Scala3 = "3.3.3"
private val KindProjectorVersion = "0.13.3"

def buildInfoSettings(packageName: String) =
Seq(
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.8.2
sbt.version = 1.8.3
18 changes: 9 additions & 9 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.8")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.15")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.3.1")
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.4")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.4")
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.10")

resolvers += Resolver.sonatypeRepo("public")

0 comments on commit 32e11a1

Please sign in to comment.