manage to build a Babashka uberjar with bb uberjar #8
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: 'CI/CD' | |
on: | |
pull_request: | |
push: | |
branches: | |
- canary | |
- main | |
env: | |
APP_ID: fosdem-dl | |
APP_VERSION: 0.1.0-RC.1 | |
GRAALVM_VERSION: 23.0.0 | |
HEAP_SIZE_AT_BUILD_TIME: '-R:MaxHeapSize=1024m' | |
JAVA_VERSION: 21 | |
OPTIMIZATION_LEVEL: '-O2' | |
jobs: | |
linux: | |
name: Build (Linux) | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v4 | |
- name: 🔧 Setup GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
check-for-updates: true | |
distribution: graalvm-community | |
java-version: ${{ env.JAVA_VERSION }} | |
native-image-job-reports: true | |
native-image-pr-reports: true | |
version: ${{ env.GRAALVM_VERSION }} | |
- name: 🔧 Setup Babashka | |
uses: DeLaGuardo/[email protected] | |
with: | |
bb: 'latest' | |
# This action uses the GitHub CLI. | |
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-github-cli-in-workflows | |
- name: ⬇️ Download com.github.jackdbd/pod-jackdbd-jsoup | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
POD_JACKDBD_JSOUP_VERSION: 0.3.0 | |
run: ./download_pod_jackdbd_jsoup.sh | |
- name: 🔍 Run all tests | |
run: bb test_runner.clj | |
# https://github.com/liquidz/babashka-test-action/ | |
# - name: Run babashka-test-action | |
# uses: liquidz/babashka-test-action@v1 | |
# with: | |
# source-paths: 'src' | |
# test-paths: 'test' | |
# test-file-pattern: '_test.clj$' | |
- name: 📦 Build a Babashka uberjar | |
run: bb build:bb-uber | |
- name: 📦 Build a regular uberjar | |
run: bb build:uber | |
- name: 📦 Compile uberjar to x86_64-linux binary with GraalVM native-image | |
run: ./script/compile.sh | |
macos: | |
name: Build (macOS) | |
runs-on: macos-latest | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v4 | |
- name: ⬇️ Download uberjar | |
run: echo "TODO download uberjar" | |
- name: 🔧 Setup GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
check-for-updates: true | |
distribution: graalvm-community | |
java-version: ${{ env.JAVA_VERSION }} | |
native-image-job-reports: true | |
native-image-pr-reports: true | |
version: ${{ env.GRAALVM_VERSION }} | |
- name: 📦 Compile uberjar to AArch64-macOS binary with GraalVM native-image | |
run: | | |
native-image \ | |
-jar ${{ env.APP_ID }}-${{ env.APP_VERSION }}-standalone.jar \ | |
'-H:ReflectionConfigurationFiles=reflection.json' \ | |
'-H:+ReportExceptionStackTraces' \ | |
'-J-Dclojure.compiler.direct-linking=true' \ | |
${{ env.HEAP_SIZE_AT_BUILD_TIME }} \ | |
${{ env.OPTIMIZATION_LEVEL }} \ | |
'-march=armv8-a' \ | |
'--initialize-at-build-time' \ | |
'--native-image-info' \ | |
'--no-fallback' \ | |
'--report-unsupported-elements-at-runtime' |