Merge pull request #3 from scalableminds/ubuntu-arm64 #88
This file contains hidden or 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-latest ] | |
| 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: Install CMake 3.x (Mac) | |
| if: ${{ matrix.os == 'macos-latest' }} | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: "~3" | |
| - name: Build c-blosc (Mac arm64) | |
| if: ${{ matrix.os == 'macos-latest' }} | |
| 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-latest' }} | |
| run: | | |
| cd c-blosc | |
| mkdir build-x86_64 | |
| cd build-x86_64 | |
| cmake .. \ | |
| -DCMAKE_OSX_ARCHITECTURES=x86_64 \ | |
| -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-latest' }} | |
| 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-amd64.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@v4 | |
| with: | |
| name: bloscjni-${{ matrix.os }} | |
| path: src/main/resources | |
| build_bloscjni_linux_arm64: | |
| runs-on: ubuntu-24.04-arm | |
| 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 ubuntu20 arm64 docker | |
| run: | | |
| cd bloscjni | |
| docker build -t ubuntu20-arm64-jdk8 -f Dockerfile.ubuntu20-arm64 . | |
| - name: Build c-blosc (Linux arm64) | |
| run: | | |
| docker run -i -v$(pwd):/app -w /app/c-blosc ubuntu20-arm64-jdk8 bash << EOF | |
| mkdir build | |
| cd build | |
| cmake .. \ | |
| -DDEACTIVATE_AVX2=ON \ | |
| -DDEACTIVATE_SSE2=ON \ | |
| -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| cmake --build . -j8 --config Release | |
| EOF | |
| - name: Build bloscjni (Linux arm64) | |
| run: | | |
| docker run -i -v$(pwd):/app -w /app ubuntu20-arm64-jdk8 bash <<EOF | |
| cd bloscjni | |
| gcc -I"\$JAVA_HOME/include" -I"\$JAVA_HOME/include/linux" \ | |
| -shared -lc -fPIC -o ../src/main/resources/libbloscjni-aarch64.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@v4 | |
| with: | |
| name: bloscjni-linux-arm64 | |
| path: src/main/resources | |
| build_publish_jar: | |
| needs: [ build_bloscjni, build_bloscjni_linux_arm64 ] | |
| 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@v4 | |
| 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@v4 | |
| with: | |
| name: blosc-jar | |
| path: target/*.jar | |
| - name: Publish to Maven Central | |
| env: | |
| JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_SONATYPE_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }} | |
| 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 | |