CI #49
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: CI | |
on: | |
push: | |
tags: [ "v*.*.*", "v*.*.*-*" ] | |
workflow_dispatch: | |
jobs: | |
download-model: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download tiny ggml model | |
run: | | |
git submodule update --init | |
./download-test-model.sh | |
- name: Artifact debian x86_64 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tiny-ggml-model | |
path: ggml-tiny.bin | |
retention-days: 2 | |
build-lib-debian-x86_64: | |
needs: [download-model] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- name: Docker Setup Buildx | |
uses: docker/[email protected] | |
with: | |
install: true | |
- name: Setup project dir | |
run: | | |
mv ./tiny-ggml-model/ggml-tiny.bin ./ggml-tiny.bin | |
mkdir -p dist | |
- name: Build native library | |
run: | | |
docker build --build-arg="RUN_TESTS=true" -f dockerfile . -t whisperjni_binary:x86_64 --load | |
docker run --platform=amd64 -v $(pwd)/dist:/out whisperjni_binary:x86_64 bash -c "cp src/main/resources/debian-amd64/*.so /out/" | |
- name: Artifact debian x86_64 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: debian-binary-amd64 | |
path: dist/*.so | |
build-lib-debian-arm64: | |
needs: [download-model] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Docker Setup Buildx | |
uses: docker/[email protected] | |
with: | |
install: true | |
- name: Setup project dir | |
run: | | |
mv ./tiny-ggml-model/ggml-tiny.bin ./ggml-tiny.bin | |
mkdir -p dist | |
- name: Build native library | |
run: | | |
docker build -f dockerfile . -t whisperjni_binary:arm64 --platform arm64 --load | |
DOCKER_BUILDKIT=1 docker run --platform=arm64 -v $(pwd)/dist:/out whisperjni_binary:arm64 bash -c "cp src/main/resources/debian-arm64/*.so /out/" | |
- name: Artifact debian arm64 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: debian-binary-arm64 | |
path: dist/*.so | |
build-lib-debian-arm: | |
needs: [download-model] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Docker Setup Buildx | |
uses: docker/[email protected] | |
with: | |
install: true | |
- name: Setup project dir | |
run: | | |
mv ./tiny-ggml-model/ggml-tiny.bin ./ggml-tiny.bin | |
mkdir -p dist | |
- name: Build native library | |
run: | | |
docker build -f dockerfile . -t whisperjni_binary:armv7l --platform arm --load | |
DOCKER_BUILDKIT=1 docker run --platform=arm -v $(pwd)/dist:/out whisperjni_binary:armv7l bash -c "cp src/main/resources/debian-armv7l/*.so /out/" | |
- name: Artifact debian armv7l | |
uses: actions/upload-artifact@v3 | |
with: | |
name: debian-binary-armv7l | |
path: dist/*.so | |
build-lib-windows: | |
needs: [download-model] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
# - name: Set up Maven | |
# uses: stCarolas/[email protected] | |
# with: | |
# maven-version: 3.9.2 | |
- name: Setup project dir | |
run: | | |
# choco upgrade mingw | |
git submodule update --init | |
mv ./tiny-ggml-model/ggml-tiny.bin ./ggml-tiny.bin | |
mkdir dist | |
- name: Build native library | |
shell: powershell | |
run: | | |
.\build_win.ps1 | |
# mvn test | |
mv src\main\resources\win-amd64\*.dll .\dist\ | |
- name: Artifact windows x86_64 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-binary-x86_64 | |
path: dist/*.dll | |
build-lib-macos: | |
needs: [download-model] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
# - name: Set up Maven | |
# uses: stCarolas/[email protected] | |
# with: | |
# maven-version: 3.9.2 | |
- name: Setup project dir | |
run: | | |
export DYLD_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ | |
mkdir -p dist | |
mkdir -p dist_arm64 | |
git submodule update --init | |
mv ./tiny-ggml-model/ggml-tiny.bin ./ggml-tiny.bin | |
- name: Build binary | |
run: | | |
export DYLD_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ | |
./build_macos.sh amd64 | |
./build_macos.sh arm64 | |
# mvn test | |
mv src/main/resources/macos-amd64/*.dylib dist/ | |
mv src/main/resources/macos-arm64/*.dylib dist_arm64/ | |
- name: Artifact macos amd64 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-binary-amd64 | |
path: dist/*.dylib | |
- name: Artifact macos arm64 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-binary-arm64 | |
path: dist_arm64/*.dylib | |
deploy: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build-lib-debian-x86_64,build-lib-debian-arm,build-lib-debian-arm64,build-lib-windows,build-lib-macos] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v3 | |
- name: check tree | |
run: ls -R | |
- name: setup resources | |
run: | | |
mv ./debian-binary-amd64/*.so ./src/main/resources/debian-amd64/ | |
mv ./debian-binary-arm64/*.so ./src/main/resources/debian-arm64/ | |
mv ./debian-binary-armv7l/*.so ./src/main/resources/debian-armv7l/ | |
mv ./windows-binary-x86_64/*.dll ./src/main/resources/win-amd64/ | |
mv ./macos-binary-amd64/*.dylib ./src/main/resources/macos-amd64/ | |
mv ./macos-binary-arm64/*.dylib ./src/main/resources/macos-arm64/ | |
- name: Set up Maven Central Repository | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
server-id: sonatype-nexus-staging | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Deploy with Maven | |
id: deploy | |
run: | | |
mvn -B clean deploy -DskipTests -Pci-cd | |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
WHISPER_VERSION=$(echo "${VERSION%%"-"*}") | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
echo "WHISPER_VERSION=$WHISPER_VERSION" >> $GITHUB_OUTPUT | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
id: create_release | |
with: | |
tag_name: whisper_jni_${{ steps.deploy.outputs.VERSION }} | |
name: WhisperJNI v${{ steps.deploy.outputs.VERSION }} | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
body: A JNI wrapper over whisper.cpp v${{ steps.deploy.outputs.WHISPER_VERSION }} | |
files: | | |
target/whisper-jni-${{ steps.deploy.outputs.VERSION }}.jar | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |