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.
- Backport #1064
  • Loading branch information
jvalkeal committed May 7, 2024
1 parent 477b24b commit 6ab5f60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
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 @@ -79,6 +84,11 @@ jobs:
nickname: linux
name: E2E ${{ matrix.os }}
steps:
- name: macos info
if: runner.os == 'macOS'
shell: bash
run: |
sysctl machdep.cpu
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 the original author or authors.
* Copyright 2022-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,6 +15,8 @@
*/
package org.springframework.shell.gradle;

import java.util.ArrayList;

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

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

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

0 comments on commit 6ab5f60

Please sign in to comment.