Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt scala-native-config-brew, setup ci #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Continuous Integration

on:
pull_request:
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**', '!update/**', '!pr/**']

jobs:
build:
name: Build and Link
strategy:
matrix:
os:
- ubuntu-22.04
- macos-11
- macos-12
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install s2n (ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: /home/linuxbrew/.linuxbrew/bin/brew install s2n

- name: Install s2n (macOS)
if: startsWith(matrix.os, 'macos')
run: brew install s2n

- name: Link
run: sbt nativeLink
3 changes: 3 additions & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-Xms1G
-Xmx4G
-XX:+UseG1GC
22 changes: 3 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ThisBuild / organization := "io.chrisdavenport"
ThisBuild / organizationName := "Christopher Davenport"

enablePlugins(ScalaNativePlugin)
enablePlugins(ScalaNativeBrewedConfigPlugin)

name := "Scala Native Ember Example"

Expand All @@ -15,22 +16,5 @@ libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-circe" % "0.23.16",
)

val isLinux = Option(System.getProperty("os.name")).exists(_.toLowerCase().contains("linux"))
val isMacOs = Option(System.getProperty("os.name")).exists(_.toLowerCase().contains("mac"))
val isArm = Option(System.getProperty("os.arch")).exists(_.toLowerCase().contains("aarch64"))

nativeConfig ~= { c =>
if (isLinux) { // brew-installed s2n
c.withLinkingOptions(c.linkingOptions :+ "-L/home/linuxbrew/.linuxbrew/lib")
} else if (isMacOs) // brew-installed OpenSSL
if(isArm) c.withLinkingOptions(c.linkingOptions :+ "-L/opt/homebrew/opt/openssl@3/lib")
else c.withLinkingOptions(c.linkingOptions :+ "-L/usr/local/opt/openssl@3/lib")
else c
}
envVars ++= {
val ldLibPath =
if (isLinux)
Map("LD_LIBRARY_PATH" -> "/home/linuxbrew/.linuxbrew/lib")
else Map("LD_LIBRARY_PATH" -> "/usr/local/opt/[email protected]/lib")
Map("S2N_DONT_MLOCK" -> "1") ++ ldLibPath
}
nativeBrewFormulas += "s2n"
envVars ++= Map("S2N_DONT_MLOCK" -> "1")
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("com.armanbilge" % "sbt-scala-native-config-brew" % "0.1.1")