Skip to content

Commit

Permalink
improvement: Add artifacts for M1
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Aug 27, 2024
1 parent 9dc4d3c commit 4b984f3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 16 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-12]
os: [ubuntu-latest, windows-latest, macOS-12, macOS-14]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: coursier/setup-action@v1
with:
apps: 'sbt'
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
Expand All @@ -79,7 +82,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-12]
os: [ubuntu-latest, windows-latest, macOS-12, macOS-14]
jdk: ["22.3.0", "17"]

name: Test ${{ matrix.os }} -- ${{ matrix.jdk }}
Expand All @@ -96,6 +99,11 @@ jobs:
with:
jvm: 'temurin:17'
if: matrix.jdk == '17'

- uses: coursier/setup-action@v1
with:
apps: 'sbt'
if: matrix.jdk == '22.3.0'

- uses: coursier/cache-action@v6

Expand Down Expand Up @@ -136,12 +144,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macOS-12, windows-latest]
os: [ubuntu-20.04, macOS-12, macOS-14, windows-latest]
include:
- os: ubuntu-20.04
artifact: bloop-linux
- os: macos-12
artifact: bloop-macos
- os: macos-14
artifact: bloop-macos-m1
- os: windows-latest
artifact: bloop-windows
env:
Expand All @@ -164,6 +174,10 @@ jobs:
native-image-job-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}

- uses: coursier/setup-action@v1
with:
apps: 'sbt'

- name: Publish GraalVM Native artifacts
run: sbt "cli/graalvm-native-image:packageBin"

Expand Down
1 change: 1 addition & 0 deletions frontend/src/main/scala/bloop/util/CrossPlatform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ object CrossPlatform {
val OS: String = System.getProperty("os.name").toLowerCase(Locale.ENGLISH)
val isWindows: Boolean = OS.contains("windows")
val isMac: Boolean = OS.contains("mac")
val isM1: Boolean = sys.props.getOrElse("os.arch", "").toLowerCase(Locale.ROOT) == "aarch64"
}
28 changes: 16 additions & 12 deletions frontend/src/test/scala/bloop/JavaVersionSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import bloop.config.Config
import bloop.logging.RecordingLogger
import bloop.util.TestProject
import bloop.util.TestUtil
import bloop.util.CrossPlatform

object JavaVersionSpec extends bloop.testing.BaseSuite {

Expand Down Expand Up @@ -47,20 +48,23 @@ object JavaVersionSpec extends bloop.testing.BaseSuite {
}
}

test("flag-is-added-correctly") {
checkFlag(Nil)
}
if (!CrossPlatform.isM1) {

test("flag-is-not-added-correctly") {
checkFlag(List("-release", "8"))
checkFlag(List("-release:8"))
}
test("flag-is-added-correctly") {
checkFlag(Nil)
}

test("compiles-with-11") {
checkFlag(Nil, jdkVersion = "11")
}
test("flag-is-not-added-correctly") {
checkFlag(List("-release", "8"))
checkFlag(List("-release:8"))
}

test("compiles-with-11") {
checkFlag(Nil, jdkVersion = "11")
}

test("compiles-with-17") {
checkFlag(Nil, jdkVersion = "17")
test("compiles-with-17") {
checkFlag(Nil, jdkVersion = "17")
}
}
}
8 changes: 7 additions & 1 deletion project/BuildPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,17 @@ object BuildKeys {
baseDir / "bloop-artifacts" / "bloop-linux" / "bloop-linux"
val originBloopMacosBinary =
baseDir / "bloop-artifacts" / "bloop-macos" / "bloop-macos"
val originBloopMacosM1Binary =
baseDir / "bloop-artifacts" / "bloop-macos-m1" / "bloop-macos-m1"
val targetBloopLinuxBinary = releaseTargetDir / "bloop-x86_64-pc-linux"
val targetBloopWindowsBinary = releaseTargetDir / "bloop-x86_64-pc-win32.exe"
val targetBloopMacosBinary = releaseTargetDir / "bloop-x86_64-apple-darwin"
val targetBloopMacosM1Binary = releaseTargetDir / "bloop-aarch64-apple-darwin"

IO.copyFile(originBloopWindowsBinary, targetBloopWindowsBinary)
IO.copyFile(originBloopLinuxBinary, targetBloopLinuxBinary)
IO.copyFile(originBloopMacosBinary, targetBloopMacosBinary)
IO.copyFile(originBloopMacosM1Binary, targetBloopMacosM1Binary)

val originBashCompletions = baseDir / "etc" / "bash-completions"
val originZshCompletions = baseDir / "etc" / "zsh-completions"
Expand All @@ -134,7 +139,8 @@ object BuildKeys {
targetFishCompletions,
targetBloopLinuxBinary,
targetBloopMacosBinary,
targetBloopWindowsBinary
targetBloopWindowsBinary,
targetBloopMacosM1Binary
)
},
createLocalHomebrewFormula := ReleaseUtils.createLocalHomebrewFormula.value,
Expand Down

0 comments on commit 4b984f3

Please sign in to comment.