Skip to content

Commit

Permalink
feat: osx native build
Browse files Browse the repository at this point in the history
  • Loading branch information
jagodevreede committed Nov 6, 2024
1 parent c6a0928 commit 3ea8878
Show file tree
Hide file tree
Showing 12 changed files with 160 additions and 135 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/assemble-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Assemble

on:
workflow_call:
inputs:
project-version:
required: true
type: string

env:
gluon_version: 22.1.0.1-Final

jobs:
assemble:
name: 'Assemble ${{ matrix.os }} ${{ matrix.jdk_arch }}'
strategy:
fail-fast: false
matrix:
os: [ macos-13, windows-latest ]
jdk_arch: [ x86_64, aarch64 ]
exclude:
- os: macos-13
jdk_arch: aarch64
- os: windows-latest
jdk_arch: aarch64
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
runs-on: ${{ matrix.os }}
steps:
- name: "[Windows only] Add msbuild to PATH"
if: startsWith(matrix.os, 'windows')
uses: microsoft/[email protected]
- name: "[Windows only] Visual Studio shell"
if: startsWith(matrix.os, 'windows')
uses: egor-tensin/vs-shell@v1
- name: "[macOS only] Setup Xcode"
uses: maxim-lobanov/setup-xcode@v1
if: startsWith(matrix.os, 'macos')
with:
xcode-version: 'latest-stable'
- name: "Setup Gluon's GraalVM"
uses: gluonhq/setup-graalvm@master
with:
graalvm: ${{ env.gluon_version }}
jdk: 'java17'
arch: ${{ matrix.jdk_arch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4

- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gluon
~/.openjfx
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

- name: Build with Maven
run: ./mvnw -B clean install -DskipTests
- name: Compile native
run: ./mvnw -B gluonfx:compile -f sdkman-ui
- name: Remove windows lib
if: startsWith(matrix.os, 'windows') != true
# TODO remove this for oll other os as well
run: rm sdkman-ui/target/gluonfx/x86_64-darwin/gvm/lib/libjnidispatch.a
- name: Link native
run: ./mvnw -B gluonfx:link -f sdkman-ui
- name: Assemble zip
run: ./mvnw -B org.apache.maven.plugins:maven-assembly-plugin:single@make-zip-${{ matrix.jdk_arch }} -f sdkman-ui

- name: Upload workspace on failure only
if: failure()
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: workspace-files-${{ matrix.os }}-${{ matrix.jdk_arch }}
path: "**/*"

- name: Upload package
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: artifacts-${{ runner.os }}-${{ matrix.jdk_arch }}
path: |
sdkman-ui/target/sdkman-ui-*.zip
19 changes: 4 additions & 15 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.m2/repository
save-always: true
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

- name: Version
Expand All @@ -43,31 +42,21 @@ jobs:
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$(echo $VERSION)" >> $GITHUB_OUTPUT
# assemble-windows:
# needs: [ precheck ]
# if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT REMOVEME')
# #todo switch to main
# uses: jagodevreede/sdkman-ui/.github/workflows/windows-assemble.yml@osx-build
# with:
# project-version: ${{ needs.precheck.outputs.VERSION }}

assemble-osx:
assemble:
needs: [ precheck ]
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT')
#todo switch to main
uses: jagodevreede/sdkman-ui/.github/workflows/osx-assemble.yml@osx-build
uses: jagodevreede/sdkman-ui/.github/workflows/assemble-native.yml@osx-build
with:
project-version: ${{ needs.precheck.outputs.VERSION }}

release:
needs: [ precheck, assemble-osx ]
release-early-access:
needs: [ precheck, assemble ]
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download artifacts
uses: actions/download-artifact@v4
Expand Down
68 changes: 0 additions & 68 deletions .github/workflows/osx-assemble.yml

This file was deleted.

31 changes: 15 additions & 16 deletions .github/workflows/windows-assemble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,33 @@ jobs:
path: |
~/.m2/repository
~/.gluon
save-always: true
~/.openjfx
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

- name: Add msbuild to PATH
if: matrix.os == 'windows-latest'
uses: microsoft/[email protected]
- name: Visual Studio shell
if: matrix.os == 'windows-latest'
uses: egor-tensin/vs-shell@v1
- uses: robinraju/[email protected]
- name: Setup Gluon's GraalVM
uses: gluonhq/setup-graalvm@master
with:
repository: "gluonhq/graal"
tag: "gluon-${{ env.gluon_version }}"
fileName: "*java17-windows-gluon-*.zip"
- name: Extract JDK
run: |
unzip graalvm-svm-java17-windows-gluon-${{ env.gluon_version }}.zip
Rename-Item -path "graalvm-svm-java17-windows-gluon-${{ env.gluon_version }}" jdk
- name: Set env for JAVA_HOME
run: echo "JAVA_HOME=D:\a\sdkman-ui\sdkman-ui\jdk" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set env for GRAALVM_HOME
run: echo "GRAALVM_HOME=D:\a\sdkman-ui\sdkman-ui\jdk" | Out-File -FilePath $env:GITHUB_ENV -Append
graalvm: '22.1.0.1-Final'
jdk: 'java17'
arch: 'x86_64'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build with Maven
run: ./mvnw -B clean install -DskipTests
- name: Build native
run: ./mvnw gluonfx:build -f sdkman-ui
- name: Compile native
run: ./mvnw -B gluonfx:compile -f sdkman-ui
- name: Link native
run: ./mvnw -B gluonfx:link -f sdkman-ui
- name: Assamble zip
run: |
./mvnw org.apache.maven.plugins:maven-assembly-plugin:single@assemble-windows -f sdkman-ui
./mvnw -B org.apache.maven.plugins:maven-assembly-plugin:single@assemble-windows -f sdkman-ui
- name: Upload package
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>io.github.jagodevreede</groupId>
<artifactId>sdkman-ui-root</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion sdkman-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.jagodevreede</groupId>
<artifactId>sdkman-ui-root</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
</parent>

<artifactId>sdkman-api</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions sdkman-bundled-software/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>sdkman-bundled-software</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>io.github.jagodevreede</groupId>
<artifactId>sdkman-ui-root</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
</parent>

<name>sdkman-bundled-software</name>
Expand Down
74 changes: 44 additions & 30 deletions sdkman-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>sdkman-ui</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>io.github.jagodevreede</groupId>
<artifactId>sdkman-ui-root</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
</parent>

<name>sdkman-ui</name>
Expand Down Expand Up @@ -149,36 +149,8 @@
<artifactId>gluonfx-maven-plugin</artifactId>
<configuration>
<mainClass>${main.class}</mainClass>
<graalvmHome>${env.JAVA_HOME}</graalvmHome>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<executions>
<execution>
<id>assemble-windows</id>
<configuration>
<finalName>sdkman-ui-windows_x86_64-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip-windows.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>assemble-osx</id>
<configuration>
<finalName>sdkman-ui-osx_x86_64-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip-osx.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand All @@ -193,6 +165,27 @@
<properties>
<native-image-folder-name>native-image-mac</native-image-folder-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<executions>
<execution>
<id>make-zip-x86_64</id>
<configuration>
<finalName>sdkman-ui-osx_x86_64-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip-osx-x86_64.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>windows</id>
Expand All @@ -204,6 +197,27 @@
<properties>
<native-image-folder-name>native-image-windows</native-image-folder-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<executions>
<execution>
<id>make-zip-x86_64</id>
<configuration>
<finalName>sdkman-ui-windows_x86_64-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip-windows-x86_64.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3ea8878

Please sign in to comment.