Skip to content

Commit

Permalink
Force compatibility machine target
Browse files Browse the repository at this point in the history
- We're mostly getting issues with macos runners
  where -march=compatibility looks to work better
  but is not automatically set depending which
  cpu arch is in use.
  • Loading branch information
jvalkeal committed May 7, 2024
1 parent 2b18de0 commit cbc0632
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,25 @@ jobs:
fail-fast: false
matrix:
include:
- nickname: win
os: windows-2022
graal: latest
musl: false
# - nickname: win
# os: windows-2022
# graal: latest
# musl: false
- nickname: macos
os: macos-12
graal: latest
musl: false
- nickname: linux
os: ubuntu-22.04
graal: latest
musl: true
# - nickname: linux
# os: ubuntu-22.04
# graal: latest
# musl: true
name: Compile ${{ matrix.nickname }}
steps:
- name: macos info
if: runner.os == 'macOS'
shell: bash
run: |
sysctl machdep.cpu
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
Expand Down Expand Up @@ -65,18 +70,18 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2022
nickname: win
# - os: windows-2022
# nickname: win
# - os: windows-2019
# nickname: win
- os: macos-12
nickname: macos
- os: macos-11
nickname: macos
- os: ubuntu-22.04
nickname: linux
- os: ubuntu-20.04
nickname: linux
# - os: ubuntu-22.04
# nickname: linux
# - os: ubuntu-20.04
# nickname: linux
name: E2E ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -101,6 +106,11 @@ jobs:
with:
name: spring-shell-samples-${{ matrix.nickname }}
path: spring-shell-samples
- name: macos info
if: runner.os == 'macOS'
shell: bash
run: |
sysctl machdep.cpu
- name: fix artifacts
if: runner.os != 'Windows'
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.graalvm.buildtools.gradle.NativeImagePlugin;
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension;
import org.graalvm.buildtools.gradle.dsl.NativeImageOptions;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPlugin;
Expand Down Expand Up @@ -74,10 +75,12 @@ private void customizeNative(Project project) {

private void configureGraalVmExtension(Project project) {
GraalVMExtension extension = project.getExtensions().getByType(GraalVMExtension.class);
NativeImageOptions options = extension.getBinaries().getByName(NativeImagePlugin.NATIVE_MAIN_EXTENSION);
if (isEnabled(project, MUSL)) {
extension.getBinaries().getByName(NativeImagePlugin.NATIVE_MAIN_EXTENSION).buildArgs("--static",
"--libc=musl");
options.buildArgs("--static","--libc=musl");
}
// force compatibility as detection i.e. in macos runners is flaky
options.buildArgs("-march=compatibility");
}

private boolean isEnabled(Project project, String property) {
Expand Down

0 comments on commit cbc0632

Please sign in to comment.