Merge pull request #191 from msmygit/feature/mask_token #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🖥️ CLI Native Image | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- '.github/workflows/cli-native-images.yml' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- '.github/workflows/cli-native-images.yml' | |
jobs: | |
build-jar: | |
name: 'Build JAR package' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: false | |
cache: 'maven' | |
- name: Build with Maven | |
run: 'mvn package -Dmaven.test.skip=true' | |
- name: Temporarily save package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: java-binary | |
path: | | |
${{ github.workspace }}/target/*-shaded.jar | |
retention-days: 30 | |
build-native-image: | |
name: Native image build on ${{ matrix.os }} and Java ${{ matrix.jdk-version }} | |
needs: [ build-jar ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
graalvm-distribution: ['graalvm'] | |
jdk-version: ['21', '17'] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Download application package | |
uses: actions/download-artifact@v4 | |
with: | |
name: java-binary | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: ${{ matrix.graalvm-distribution }} | |
java-version: ${{ matrix.jdk-version }} | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build native image on Linux | |
run: native-image --enable-url-protocols=https --static -H:+ReportExceptionStackTraces -jar astra-cli-*.jar astra-cli-linux | |
if: runner.os == 'Linux' | |
- name: Build native image on Mac OS X | |
run: native-image --enable-url-protocols=https -H:+ReportExceptionStackTraces -jar astra-cli-*.jar astra-cli-macos | |
if: runner.os == 'macOS' | |
- name: Build native image on Windows | |
run: native-image --enable-url-protocols=https -H:+ReportExceptionStackTraces -jar astra-cli-*.jar astra-cli-windows.exe | |
if: runner.os == 'Windows' | |
- name: Temporarily save package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: astra-cli-${{ matrix.os }}-java-${{ matrix.jdk-version }} | |
path: | | |
astra-cli-* | |
!*.txt | |
!*.jar | |
retention-days: 30 |