From 8b0053c7d6ce77dedb3905a054c8123b14700ba3 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 12 Feb 2024 16:09:19 -0800 Subject: [PATCH 1/4] 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 --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf57f3e94..3dafd8cd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,3 +79,31 @@ jobs: files: | core/target/google-java-format* eclipse_plugin/target/google-java-format-eclipse-plugin-*.jar + + build-native-image: + name: "Build GraalVM native-image on ${{ matrix.os }}" + runs-on: ${{ matrix.os }} + needs: build-maven-jars + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - name: "Check out repository" + uses: actions/checkout@v4 + - name: "Set up GraalVM" + uses: graalvm/setup-graalvm@v1 + with: + java-version: "21" + distribution: "graalvm-community" + github-token: ${{ secrets.GITHUB_TOKEN }} + native-image-job-reports: "true" + cache: "maven" + - name: "Native" + run: mvn -Pnative -DskipTests package -pl core -am + - name: "Move outputs" + run: cp core/target/google-java-format google-java-format-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }} + - name: "Upload native-image" + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: gh release upload "v${{ github.event.inputs.version }}" "google-java-format-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}" From fdbcf478737cddd072b0eadbe0d43dd09230c1e0 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Thu, 15 Feb 2024 12:39:24 -0800 Subject: [PATCH 2/4] Update .github/workflows/release.yml Co-authored-by: Michael Vorburger --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3dafd8cd3..0848c869d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,7 +86,7 @@ jobs: needs: build-maven-jars strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: "Check out repository" uses: actions/checkout@v4 From a930ca3ad0c61767b34b5bf89de10ad0ea0210d4 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Thu, 15 Feb 2024 12:55:20 -0800 Subject: [PATCH 3/4] Update release.yml --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0848c869d..e1f94aaa0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,6 +87,8 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + env: + SUFFIX: ${{fromJson('{"ubuntu-latest":"linux-x86_64", "macos-latest":"darwin-arm64", "windows-latest":"windows_x86-64"}')[matrix.os]}} steps: - name: "Check out repository" uses: actions/checkout@v4 @@ -101,9 +103,9 @@ jobs: - name: "Native" run: mvn -Pnative -DskipTests package -pl core -am - name: "Move outputs" - run: cp core/target/google-java-format google-java-format-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }} + run: cp core/target/google-java-format google-java-format-${{ env.SUFFIX }} - name: "Upload native-image" env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} - run: gh release upload "v${{ github.event.inputs.version }}" "google-java-format-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}" + run: gh release upload "v${{ github.event.inputs.version }}" "google-java-format-${{ env.SUFFIX }}" From f0e6fae2af539c08a25f44180ef71b0d877e2338 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 16 Feb 2024 08:25:46 -0800 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Michael Vorburger --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1f94aaa0..36c0eb59d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,7 +88,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] env: - SUFFIX: ${{fromJson('{"ubuntu-latest":"linux-x86_64", "macos-latest":"darwin-arm64", "windows-latest":"windows_x86-64"}')[matrix.os]}} + SUFFIX: ${{fromJson('{"ubuntu-latest":"linux-x86-64", "macos-latest":"darwin-arm64", "windows-latest":"windows-x86-64"}')[matrix.os]}} steps: - name: "Check out repository" uses: actions/checkout@v4 @@ -103,9 +103,9 @@ jobs: - name: "Native" run: mvn -Pnative -DskipTests package -pl core -am - name: "Move outputs" - run: cp core/target/google-java-format google-java-format-${{ env.SUFFIX }} + run: cp core/target/google-java-format google-java-format_${{ env.SUFFIX }} - name: "Upload native-image" env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} - run: gh release upload "v${{ github.event.inputs.version }}" "google-java-format-${{ env.SUFFIX }}" + run: gh release upload "v${{ github.event.inputs.version }}" "google-java-format_${{ env.SUFFIX }}"