Skip to content

Rename + license

Rename + license #16

Workflow file for this run

name: Build
on:
push:
branches: [master, main]
pull_request:
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
include:
- platform: linux-amd64
runner: ubuntu-24.04
lib: libzvec_c.so
cmake_flags: '-DENABLE_NEHALEM=ON -DCMAKE_BUILD_TYPE=Release'
- platform: linux-arm64
runner: ubuntu-24.04-arm
lib: libzvec_c.so
cmake_flags: '-DCMAKE_BUILD_TYPE=Release'
- platform: macos-arm64
runner: macos-15
lib: libzvec_c.dylib
cmake_flags: '-DCMAKE_BUILD_TYPE=Release'
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout zvec-java
uses: actions/checkout@v4
- name: Setup CMake 3.31
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.31.6'
- name: Setup Java 25
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25'
- name: Parse zvec version
id: version
run: |
ZVEC_VERSION=$(grep '^zvecVersion=' gradle.properties | cut -d= -f2)
echo "zvec_version=$ZVEC_VERSION" >> "$GITHUB_OUTPUT"
- name: Cache zvec
id: cache-zvec
uses: actions/cache@v4
with:
path: zvec
key: zvec-v6-${{ steps.version.outputs.zvec_version }}-${{ matrix.platform }}
- name: Clone zvec
if: steps.cache-zvec.outputs.cache-hit != 'true'
run: |
git clone --recursive \
--branch ${{ steps.version.outputs.zvec_version }} \
--depth 1 \
https://github.com/alibaba/zvec.git
- name: Build zvec C++
if: steps.cache-zvec.outputs.cache-hit != 'true'
run: |
cd zvec
cmake -B build -DBUILD_TOOLS=OFF -DBUILD_PYTHON_BINDINGS=OFF ${{ matrix.cmake_flags }}
cmake --build build -j2
- name: Build C bridge
run: |
cmake -B native/build -S native \
-DZVEC_ROOT=${{ github.workspace }}/zvec \
-DZVEC_BUILD_DIR=${{ github.workspace }}/zvec/build
cmake --build native/build
- name: Run tests
run: ./gradlew :lib-zvec:test -PnativeLibPath=${{ github.workspace }}/native/build
- name: Upload native library
uses: actions/upload-artifact@v4
with:
name: native-${{ matrix.platform }}
path: native/build/${{ matrix.lib }}
build-java:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout zvec-java
uses: actions/checkout@v4
- name: Setup Java 25
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25'
- name: Download all native libraries
uses: actions/download-artifact@v4
with:
path: native-artifacts
- name: Stage native libraries into resources
run: |
mkdir -p lib-zvec/src/main/resources/native/linux-amd64
mkdir -p lib-zvec/src/main/resources/native/linux-arm64
mkdir -p lib-zvec/src/main/resources/native/darwin-arm64
cp native-artifacts/native-linux-amd64/* lib-zvec/src/main/resources/native/linux-amd64/
cp native-artifacts/native-linux-arm64/* lib-zvec/src/main/resources/native/linux-arm64/
cp native-artifacts/native-macos-arm64/* lib-zvec/src/main/resources/native/darwin-arm64/
- name: Build JAR
run: ./gradlew :lib-zvec:jar
- name: Verify JAR contents
run: jar tf lib-zvec/build/libs/*.jar | grep native/
- name: Upload JAR
uses: actions/upload-artifact@v4
with:
name: zvec-java-jar
path: lib-zvec/build/libs/*.jar
- name: Publish release
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[release]')
run: bash publish.sh
env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
AWS_ACCESS_KEY_ID: ${{ secrets.TOWER_CI_AWS_ACCESS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TOWER_CI_AWS_SECRET }}
AWS_DEFAULT_REGION: 'eu-west-1'
PUBLISH_REPO_URL: 's3://maven.seqera.io/releases'
- name: Publish snapshot
if: github.event_name == 'push' && !contains(github.event.head_commit.message, '[release]')
run: SNAPSHOT=true bash publish.sh
env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
AWS_ACCESS_KEY_ID: ${{ secrets.TOWER_CI_AWS_ACCESS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TOWER_CI_AWS_SECRET }}
AWS_DEFAULT_REGION: 'eu-west-1'
PUBLISH_REPO_URL: 's3://maven.seqera.io/snapshots'