From 41b76e3d494f4b3e08165c8edafaf1d683956fcd Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Tue, 5 Apr 2022 11:18:17 +0200 Subject: [PATCH 1/3] Cross-compile things to support multiple Scala.js versions --- .github/workflows/launchers.yml | 33 +++++++++++++++++++++++++-------- build.sc | 13 ++++++++----- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/.github/workflows/launchers.yml b/.github/workflows/launchers.yml index 11bc93e..5a01c91 100644 --- a/.github/workflows/launchers.yml +++ b/.github/workflows/launchers.yml @@ -13,6 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-2016, macos-latest] + scalaJsVersion: ["1.9.0"] steps: - uses: actions/checkout@v2 with: @@ -23,16 +24,20 @@ jobs: with: jvm: 8 - run: | - ./mill -i "native.writeNativeImageScript" generate.sh "" && \ + ./mill -i "native[$scalaJsVersion].writeNativeImageScript" generate.sh "" && \ ./generate.sh && \ - ./mill -i "native.copyToArtifacts" artifacts/ + ./mill -i "native[$scalaJsVersion].copyToArtifacts" artifacts/ if: runner.os != 'Windows' + env: + scalaJsVersion: ${{ matrix.scalaJsVersion }} - run: | - @call ./mill.bat -i "native.writeNativeImageScript" generate.bat "" + @call ./mill.bat -i "native[%scalaJsVersion%].writeNativeImageScript" generate.bat "" @call generate.bat - @call ./mill.bat -i "native.copyToArtifacts" artifacts/ + @call ./mill.bat -i "native[%scalaJsVersion%].copyToArtifacts" artifacts/ shell: cmd if: runner.os == 'Windows' + env: + scalaJsVersion: ${{ matrix.scalaJsVersion }} - uses: actions/upload-artifact@v2.2.4 with: name: launcher-${{ matrix.os }} @@ -46,6 +51,10 @@ jobs: generate-static-launcher: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + scalaJsVersion: ["1.9.0"] steps: - uses: actions/checkout@v2 with: @@ -56,9 +65,11 @@ jobs: with: jvm: 8 - run: | - ./mill -i "native-static.writeNativeImageScript" generate.sh "" && \ + ./mill -i "native-static[$scalaJsVersion].writeNativeImageScript" generate.sh "" && \ ./generate.sh && \ - ./mill -i "native-static.copyToArtifacts" artifacts/ + ./mill -i "native-static[$scalaJsVersion].copyToArtifacts" artifacts/ + env: + scalaJsVersion: ${{ matrix.scalaJsVersion }} - uses: actions/upload-artifact@v2.2.4 with: name: launcher-${{ matrix.os }}-static @@ -72,6 +83,10 @@ jobs: generate-mostly-static-launcher: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + scalaJsVersion: ["1.9.0"] steps: - uses: actions/checkout@v2 with: @@ -82,9 +97,11 @@ jobs: with: jvm: 8 - run: | - ./mill -i "native-mostly-static.writeNativeImageScript" generate.sh "" && \ + ./mill -i "native-mostly-static[$scalaJsVersion].writeNativeImageScript" generate.sh "" && \ ./generate.sh && \ - ./mill -i "native-mostly-static.copyToArtifacts" artifacts/ + ./mill -i "native-mostly-static[$scalaJsVersion].copyToArtifacts" artifacts/ + env: + scalaJsVersion: ${{ matrix.scalaJsVersion }} - uses: actions/upload-artifact@v2.2.4 with: name: launcher-${{ matrix.os }}-mostly-static diff --git a/build.sc b/build.sc index dcf6789..6cf8b63 100644 --- a/build.sc +++ b/build.sc @@ -9,10 +9,11 @@ import mill._ import mill.scalalib._ def scalaJsCliVersion = "1.1.1-sc1" +def scalaJsVersions = Seq("1.9.0") -trait ScalaJsCliNativeImage extends ScalaModule with NativeImage { +class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule with NativeImage { def scalaVersion = "2.13.8" - def scalaJsVersion = "1.9.0" + def scalaJsVersion = scalaJsVersion0 def nativeImageClassPath = T{ runClasspath() @@ -44,11 +45,11 @@ trait ScalaJsCliNativeImage extends ScalaModule with NativeImage { } } -object native extends ScalaJsCliNativeImage +object native extends Cross[ScalaJsCliNativeImage](scalaJsVersions: _*) def csDockerVersion = "2.1.0-M5-18-gfebf9838c" -object `native-static` extends ScalaJsCliNativeImage { +class ScalaJsCliStaticNativeImage(scalaJsVersion0: String) extends ScalaJsCliNativeImage(scalaJsVersion0) { def nameSuffix = "-static" def buildHelperImage = T { os.proc("docker", "build", "-t", "scala-cli-base-musl:latest", ".") @@ -69,8 +70,9 @@ object `native-static` extends ScalaJsCliNativeImage { super.writeNativeImageScript(scriptDest, imageDest)() } } +object `native-static` extends Cross[ScalaJsCliStaticNativeImage](scalaJsVersions: _*) -object `native-mostly-static` extends ScalaJsCliNativeImage { +class ScalaJsCliMostlyStaticNativeImage(scalaJsVersion0: String) extends ScalaJsCliNativeImage(scalaJsVersion0) { def nameSuffix = "-mostly-static" def nativeImageDockerParams = Some( NativeImage.linuxMostlyStaticParams( @@ -79,6 +81,7 @@ object `native-mostly-static` extends ScalaJsCliNativeImage { ) ) } +object `native-mostly-static` extends Cross[ScalaJsCliMostlyStaticNativeImage](scalaJsVersions: _*) def publishVersion = T{ From 1d4697d05053ca9bc2fa2800e03892efde18254c Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Tue, 5 Apr 2022 11:18:46 +0200 Subject: [PATCH 2/3] Add Scala.js 1.10.0 support --- .github/workflows/launchers.yml | 6 +++--- build.sc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/launchers.yml b/.github/workflows/launchers.yml index 5a01c91..29a3a16 100644 --- a/.github/workflows/launchers.yml +++ b/.github/workflows/launchers.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-2016, macos-latest] - scalaJsVersion: ["1.9.0"] + scalaJsVersion: ["1.9.0", "1.10.0"] steps: - uses: actions/checkout@v2 with: @@ -54,7 +54,7 @@ jobs: strategy: fail-fast: false matrix: - scalaJsVersion: ["1.9.0"] + scalaJsVersion: ["1.9.0", "1.10.0"] steps: - uses: actions/checkout@v2 with: @@ -86,7 +86,7 @@ jobs: strategy: fail-fast: false matrix: - scalaJsVersion: ["1.9.0"] + scalaJsVersion: ["1.9.0", "1.10.0"] steps: - uses: actions/checkout@v2 with: diff --git a/build.sc b/build.sc index 6cf8b63..0b836d8 100644 --- a/build.sc +++ b/build.sc @@ -9,7 +9,7 @@ import mill._ import mill.scalalib._ def scalaJsCliVersion = "1.1.1-sc1" -def scalaJsVersions = Seq("1.9.0") +def scalaJsVersions = Seq("1.9.0", "1.10.0") class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule with NativeImage { def scalaVersion = "2.13.8" From e399739a0f2ff3b299835a49427b4eb18b1e670f Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Tue, 5 Apr 2022 11:21:02 +0200 Subject: [PATCH 3/3] Build Windows binaries on windows-latest workers --- .github/workflows/launchers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/launchers.yml b/.github/workflows/launchers.yml index 29a3a16..8a89907 100644 --- a/.github/workflows/launchers.yml +++ b/.github/workflows/launchers.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-2016, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] scalaJsVersion: ["1.9.0", "1.10.0"] steps: - uses: actions/checkout@v2