Update Maven version #70
Workflow file for this run
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: Llama-Java-CI | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
#build linux lib | |
build-linux-lib: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dependencies | |
id: depends | |
run: | | |
sudo apt-get update | |
sudo apt-get install build-essential | |
sudo apt-get install libopenblas-dev | |
sudo apt-get install libopenblas64-dev | |
- name: Checkout project | |
id: checkout_project | |
uses: actions/checkout@v4 | |
- name: Build lib | |
id: build_lib | |
run: | | |
cd llama-java-core | |
/bin/bash build.sh linux | |
- name: Upload lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-libllama | |
path: llama-java-core/llama.cpp/build/llamajava/libllamajava.so | |
#build macos lib | |
build-macos-lib: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout project | |
id: checkout_project | |
uses: actions/checkout@v4 | |
- name: Build lib | |
id: build_lib | |
run: | | |
cd llama-java-core | |
/bin/bash build.sh macos | |
- name: Upload lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-libllama | |
path: llama-java-core/llama.cpp/build/llamajava/libllamajava.dylib | |
- name: Upload metal lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-metallib | |
path: llama-java-core/llama.cpp/default.metallib | |
#build windows lib | |
build-windows-lib: | |
runs-on: windows-latest | |
env: | |
OPENBLAS_VERSION: 0.3.23 | |
BUILD_ARGS: '-DLLAMA_NATIVE=OFF -DLLAMA_CUBLAS=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"' | |
steps: | |
- name: Download OpenBLAS | |
id: get_openblas | |
run: | | |
curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip" | |
curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE" | |
mkdir $env:RUNNER_TEMP/openblas | |
tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas | |
$vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath) | |
$msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim())) | |
$lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe') | |
& $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll | |
- name: Checkout project | |
id: checkout_project | |
uses: actions/checkout@v4 | |
- name: Build lib | |
id: build_lib | |
run: | | |
cd llama-java-core | |
git.exe clone https://github.com/ggerganov/llama.cpp.git | |
if (!(Test-Path -Path "llama.cpp")) { | |
echo "Git clone llama.cpp failed." | |
exit 1 | |
} | |
Copy-Item -Path llamajava/* -Destination llama.cpp/llamajava -Force | |
Copy-Item -Path llamajava/win/* -Destination llama.cpp/llamajava -Force | |
cd llama.cpp | |
$LATEST_TAG=(git.exe describe --tags) | |
echo "=> Llama.cpp latest tag: $LATEST_TAG" | |
git.exe checkout $LATEST_TAG | |
Add-Content CMakeLists.txt "add_subdirectory(llamajava)" | |
echo "=> Checkout llama.cpp $LATEST_TAG finished." | |
mkdir build | |
cd build | |
cmake.exe .. ${env:BUILD_ARGS} | |
cmake.exe --build . --config Release | |
- name: Upload lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-libllama | |
path: llama-java-core/llama.cpp/build/bin/Release/llamajava.dll | |
# maven build & deploy | |
maven-build-deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build-linux-lib | |
- build-macos-lib | |
- build-windows-lib | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Set up Maven Central Repository | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '18' | |
distribution: 'oracle' | |
architecture: 'x64' | |
cache: 'maven' | |
server-id: 'ossrh' | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
gpg-private-key: ${{ secrets.MAVEN_PRIVATE_KEY }} | |
- name: Download linux lib | |
id: download_linux_lib | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux-libllama | |
path: llama-java-core/src/main/resources/linux-x86-64 | |
- name: Download macos lib | |
id: download_macos_lib | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos-libllama | |
path: llama-java-core/src/main/resources/darwin-x86-64 | |
- name: Download macos metallib | |
id: download_macos_metallib | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos-metallib | |
path: llama-java-core/src/main/resources/darwin-x86-64 | |
- name: Download windows lib | |
id: download_windows_lib | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-libllama | |
path: llama-java-core/src/main/resources/win32-x86-64 | |
- name: Show libs | |
id: show_libs | |
run: | | |
ls -l llama-java-core/src/main/resources/* | |
- name: Build WebUI | |
id: build_webui | |
run: | | |
git clone https://github.com/eoctet/Lite-Next-Web.git | |
if [ ! -d "Lite-Next-Web" ]; then | |
echo "Git clone Lite-Next-Web failed." | |
exit 1 | |
fi | |
cd Lite-Next-Web | |
yarn install | |
yarn export | |
ls -l | |
mv out ../octet-chat-app/src/main/resources/static | |
ls -l ../octet-chat-app/src/main/resources/* | |
- name: Build with Maven | |
run: | | |
mvn clean package deploy | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_REPO_NAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_REPO_CODE }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_PRIVATE_KEY_PASS }} | |
- name: Build app | |
id: build_app | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
run: | | |
mkdir -p vendor/octet-chat-app/characters | |
cp octet-chat-app/characters/*.json vendor/octet-chat-app/characters | |
cp octet-chat-app/app_server.sh vendor/octet-chat-app | |
mv octet-chat-app/target/*.jar vendor/octet-chat-app/octet-chat-app.jar | |
cd vendor | |
zip -r octet-chat-app-$TAG_NAME.zip octet-chat-app | |
ls -l * | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: CHANGELOG.md | |
token: ${{ secrets.DEV_TOKEN }} | |
files: | | |
vendor/octet-chat-app-${{ github.ref_name }}.zip |