Update pom.xml #79
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: | |
jobs: | |
build_bloscjni: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-12 ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '8' | |
cache: 'maven' | |
- name: Prepare resources folder | |
run: mkdir src/main/resources | |
- name: Build c-blosc (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
cd c-blosc | |
mkdir build | |
cd build | |
cmake -G "MinGW Makefiles" .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build . -j8 --config Release | |
- name: Build bloscjni (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: bash | |
run: | | |
cd bloscjni | |
x86_64-w64-mingw32-gcc \ | |
-I"$JAVA_HOME\\include" -I"$JAVA_HOME\\include\\win32" -O3 \ | |
-shared -o ..\\src\\main\\resources\\libbloscjni.dll \ | |
bloscjni.c ..\\c-blosc\\build\\blosc\\libblosc.a | |
- name: Build c-blosc (Mac arm64) | |
if: ${{ matrix.os == 'macos-12' }} | |
run: | | |
cd c-blosc | |
mkdir build-arm64 | |
cd build-arm64 | |
cmake .. \ | |
-DCMAKE_OSX_ARCHITECTURES=arm64 \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ | |
-DDEACTIVATE_AVX2=ON \ | |
-DDEACTIVATE_SSE2=ON \ | |
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | |
-DCMAKE_BUILD_TYPE=Release | |
cmake --build . -j8 --config Release --target blosc_static | |
- name: Build c-blosc (Mac x86_64) | |
if: ${{ matrix.os == 'macos-12' }} | |
run: | | |
cd c-blosc | |
mkdir build-x86_64 | |
cd build-x86_64 | |
cmake .. \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ | |
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | |
-DCMAKE_BUILD_TYPE=Release | |
cmake --build . -j8 --config Release --target blosc_static | |
- name: Build bloscjni (Mac universal) | |
if: ${{ matrix.os == 'macos-12' }} | |
run: | | |
cd bloscjni | |
cc \ | |
-I"$JAVA_HOME/include" -I"$JAVA_HOME/include/darwin" \ | |
--target=arm64-apple-macos10.9 \ | |
-dynamiclib -o ../src/main/resources/libbloscjni-arm64.dylib -O3 \ | |
bloscjni.c ../c-blosc/build-arm64/blosc/libblosc.a | |
cc \ | |
-I"$JAVA_HOME/include" -I"$JAVA_HOME/include/darwin" \ | |
--target=x86_64-apple-macos10.9 \ | |
-dynamiclib -o ../src/main/resources/libbloscjni-x86_64.dylib -O3 \ | |
bloscjni.c ../c-blosc/build-x86_64/blosc/libblosc.a | |
lipo -create \ | |
-output ../src/main/resources/libbloscjni.dylib \ | |
../src/main/resources/libbloscjni-arm64.dylib \ | |
../src/main/resources/libbloscjni-x86_64.dylib | |
rm ../src/main/resources/libbloscjni-*.dylib | |
- name: Build CentOS7 docker (Linux) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
cd bloscjni | |
docker build -t centos7-jdk8 -f Dockerfile.centos7 . | |
- name: Build c-blosc (Linux) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
docker run -i -v$(pwd):/app -w /app/c-blosc centos7-jdk8 bash << EOF | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build . -j8 --config Release | |
EOF | |
- name: Build bloscjni (Linux) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
docker run -i -v$(pwd):/app -w /app centos7-jdk8 bash <<EOF | |
cd bloscjni | |
gcc -I"\$JAVA_HOME/include" -I"\$JAVA_HOME/include/linux" \ | |
-shared -lc -fPIC -o ../src/main/resources/libbloscjni.so -O3 \ | |
bloscjni.c ../c-blosc/build/blosc/libblosc.a | |
EOF | |
- name: Build blosc-java | |
run: mvn compile | |
- name: Test blosc-java | |
run: mvn test | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: bloscjni-${{ matrix.os }} | |
path: src/main/resources | |
build_publish_jar: | |
needs: [ build_bloscjni ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
cache: 'maven' | |
- uses: actions/download-artifact@v3 | |
with: | |
path: src/main/resources | |
- name: Rename JNI dynamic libraries | |
run: mv src/main/resources/*/* src/main/resources | |
- name: Append c-blosc license | |
run: cat c-blosc/LICENSE.txt >> LICENSE.txt | |
- name: Assemble JAR | |
run: mvn package | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: blosc-jar | |
path: target/*.jar | |
- name: Publish to Maven Central | |
env: | |
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }} | |
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
mvn -Prelease deploy jreleaser:deploy -DaltDeploymentRepository=local::file:./target/staging-deploy | |