Add GitHub Workflow #10
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: Github Actions Pipeline | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Run Native LangChain4j Searchbot | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '23-ea' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build with Native Image Maven Plugin | |
run: | | |
mvn --no-transfer-progress -Pnative package | |
./target/searchbot --api-key="${{ secrets.OPENAI_API_KEY }}" "What is JavaDay Lviv?" | |
- name: Build with File Size Optimization | |
run: | | |
native-image \ | |
-Ob \ | |
-jar ./target/searchbot-1.0-jar-with-dependencies.jar \ | |
-H:+AllowDeprecatedBuilderClassesOnImageClasspath \ | |
-o ./target/searchbot-optimized | |
echo "What is JavaDay Lviv?" | |
./target/searchbot --api-key="${{ secrets.OPENAI_API_KEY }}" "What is JavaDay Lviv?" | |
- name: Compare file sizes | |
run: du -h target/searchbot* | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: native-binaries-${{ matrix.os }} | |
path: | | |
target/searchbot* |