Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
lang: ['jvm', 'js', 'native']
lang: ['jvm', 'js', 'wasm', 'native']
java: ['17', '21', '25']
name: Sjsonnet build for ${{ matrix.lang }} on JDK ${{ matrix.java }}
steps:
Expand All @@ -22,6 +22,11 @@ jobs:
distribution: 'zulu'
cache: sbt
- uses: sbt/setup-sbt@v1
- name: Set up Node.js 24
if: ${{ matrix.lang == 'js' || matrix.lang == 'wasm' }}
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Cache Coursier cache
uses: coursier/cache-action@bebeeb0e6f48ebad66d3783946588ecf43114433 # 6.4.8
- name: Check Formatting
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
with:
java-version: 17
distribution: 'zulu'
- name: Set up Node.js 24
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Set up environment variables
run: |
echo "VERSION=$(cat sjsonnet/version)" >> $GITHUB_ENV
Expand All @@ -26,21 +30,24 @@ jobs:
run: ./mill "sjsonnet.jvm[$SCALA_VERSION].__.assembly"
- name: JS Build
run: ./mill "sjsonnet.js[$SCALA_VERSION].fullLinkJS"
- name: WASM Build
run: ./mill "sjsonnet.wasm[$SCALA_VERSION].fullLinkJS"
- name: Playground Build
run: ./mill playground.bundle
- name: Rename Artifacts
run: |
mkdir release
cp ./out/sjsonnet/js/$SCALA_VERSION/fullLinkJS.dest/main.js ./release/sjsonnet-$VERSION.js
cp ./out/sjsonnet/js/$SCALA_VERSION/fullLinkJS.dest/main.js.map ./release/sjsonnet-$VERSION.js.map
cp -r ./out/sjsonnet/wasm/$SCALA_VERSION/fullLinkJS.dest/ ./release/sjsonnet-wasm-$VERSION/
cp ./out/sjsonnet/jvm/$SCALA_VERSION/assembly.dest/out.jar ./release/sjsonnet-$VERSION.jar
cp ./out/sjsonnet/jvm/$SCALA_VERSION/client/assembly.dest/out.jar ./release/sjsonnet-client-$VERSION.jar
cp ./out/sjsonnet/jvm/$SCALA_VERSION/server/assembly.dest/out.jar ./release/sjsonnet-server-$VERSION.jar
cp ./out/playground/bundle.dest/index.html ./release/sjsonnet-playground-$VERSION.html
- uses: actions/upload-artifact@v6
name: Upload Artifacts
with:
name: sjsonnet-${{ env.VERSION }}-jvmjs
name: sjsonnet-${{ env.VERSION }}-jvmjswasm
path: release/*
retention-days: 1
if-no-files-found: error
Expand Down
28 changes: 23 additions & 5 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ object bench extends ScalaModule with JmhModule with ScalafmtModule {
}

object sjsonnet extends VersionFileModule {
object js extends Cross[SjsonnetJsModule](scalaVersions)
trait SjsonnetJsModule extends SjsonnetCrossModule with ScalaJSModule with SjsonnetPublishModule {
trait SjsonnetScalaJSModule
extends SjsonnetCrossModule
with ScalaJSModule
with SjsonnetPublishModule {
def moduleDir = super.moduleDir / os.up
def scalaJSVersion = "1.20.2"
def moduleKind = Task { ModuleKind.CommonJSModule }
val sourceDirs = Seq(
"src",
"src-js",
Expand All @@ -160,8 +161,10 @@ object sjsonnet extends VersionFileModule {
mvn"org.virtuslab::scala-yaml::0.3.0"
)

object test extends ScalaJSTests with CrossTests {
def jsEnvConfig = JsEnvConfig.NodeJs(args = List("--stack-size=" + stackSizekBytes))
def nodeJsArgs: List[String] = List("--stack-size=" + stackSizekBytes)

trait SjsonnetScalaJSTests extends ScalaJSTests with CrossTests {
def jsEnvConfig = JsEnvConfig.NodeJs(args = nodeJsArgs)
def resources = Task.Sources(
this.moduleDir / "resources" / "test_suite",
this.moduleDir / "resources" / "go_test_suite",
Expand Down Expand Up @@ -229,6 +232,21 @@ object sjsonnet extends VersionFileModule {
}
}

object js extends Cross[SjsonnetJsModule](scalaVersions)
trait SjsonnetJsModule extends SjsonnetScalaJSModule {
def moduleKind = Task { ModuleKind.CommonJSModule }
object test extends SjsonnetScalaJSTests
}

object wasm extends Cross[SjsonnetWasmModule](scalaVersions)
trait SjsonnetWasmModule extends SjsonnetScalaJSModule {
def moduleKind = Task { ModuleKind.ESModule }
def moduleSplitStyle = ModuleSplitStyle.FewestModules
def scalaJSExperimentalUseWebAssembly = true
override def nodeJsArgs = super.nodeJsArgs ++ List("--experimental-wasm-exnref")
object test extends SjsonnetScalaJSTests
}

object native extends Cross[SjsonnetNativeModule](scalaVersions)
trait SjsonnetNativeModule
extends SjsonnetCrossModule
Expand Down