Skip to content

Commit 9851a39

Browse files
committed
Generate native-image binaries for google-java-format
And include them in release artifacts. I tested this on my fork of the repo, and have a demo here: https://github.com/cushon/google-java-format/releases When downloading the artifacts from the releases page they don't have the executable bit set, and my Mac blocks them because they aren't signed. That can be worked around with the following, but isn't ideal: ``` chmod a+rx google-java-format-darwin sudo xattr -r -d com.apple.quarantine google-java-format-darwin ``` Progress towards #868
1 parent b9b41fa commit 9851a39

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,31 @@ jobs:
7979
files: |
8080
core/target/google-java-format*
8181
eclipse_plugin/target/google-java-format-eclipse-plugin-*.jar
82+
83+
build-native-image:
84+
name: "Build GraalVM native-image on ${{ matrix.os }}"
85+
runs-on: ${{ matrix.os }}
86+
needs: build-maven-jars
87+
strategy:
88+
matrix:
89+
os: [ubuntu-latest, macos-latest]
90+
steps:
91+
- name: "Check out repository"
92+
uses: actions/checkout@v4
93+
- name: "Set up GraalVM"
94+
uses: graalvm/setup-graalvm@v1
95+
with:
96+
java-version: "21"
97+
distribution: "graalvm-community"
98+
github-token: ${{ secrets.GITHUB_TOKEN }}
99+
native-image-job-reports: "true"
100+
cache: "maven"
101+
- name: "Native"
102+
run: mvn -Pnative -DskipTests package -pl core -am
103+
- name: "Move outputs"
104+
run: cp core/target/google-java-format google-java-format-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}
105+
- name: "Upload native-image"
106+
env:
107+
GH_TOKEN: ${{ github.token }}
108+
GH_REPO: ${{ github.repository }}
109+
run: gh release upload "v${{ github.event.inputs.version }}" "google-java-format-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}"

0 commit comments

Comments
 (0)