Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 71 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build_bloscjni:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-12 ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -41,8 +41,14 @@ jobs:
-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-12' }}
if: ${{ matrix.os == 'macos-latest' }}
run: |
cd c-blosc
mkdir build-arm64
Expand All @@ -57,19 +63,20 @@ jobs:
cmake --build . -j8 --config Release --target blosc_static

- name: Build c-blosc (Mac x86_64)
if: ${{ matrix.os == 'macos-12' }}
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-12' }}
if: ${{ matrix.os == 'macos-latest' }}
run: |
cd bloscjni
cc \
Expand Down Expand Up @@ -110,7 +117,7 @@ jobs:
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 \
-shared -lc -fPIC -o ../src/main/resources/libbloscjni-amd64.so -O3 \
bloscjni.c ../c-blosc/build/blosc/libblosc.a
EOF

Expand All @@ -120,13 +127,66 @@ jobs:
- name: Test blosc-java
run: mvn test

- uses: actions/upload-artifact@v3
- 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 ]
needs: [ build_bloscjni, build_bloscjni_linux_arm64 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -138,7 +198,7 @@ jobs:
java-version: '8'
cache: 'maven'

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: src/main/resources

Expand All @@ -151,15 +211,15 @@ jobs:
- name: Assemble JAR
run: mvn package

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
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_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 }}
Expand Down
14 changes: 14 additions & 0 deletions bloscjni/Dockerfile.ubuntu20-arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM arm64v8/ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
openjdk-8-jdk gcc make curl && \
rm -rf /var/lib/apt/lists/*

RUN cd /usr/local/src && \
curl -LO https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2-linux-aarch64.tar.gz && \
tar -xf cmake-3.22.2-linux-aarch64.tar.gz && \
mv cmake-3.22.2-linux-aarch64 /usr/local/cmake

ENV PATH="/usr/local/cmake/bin:$PATH"
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64
2 changes: 1 addition & 1 deletion c-blosc
Submodule c-blosc updated 375 files
18 changes: 7 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.scalableminds</groupId>
<artifactId>blosc-java</artifactId>
<version>0.2-1.21.4</version>
<version>0.3-1.21.6</version>
<inceptionYear>2023</inceptionYear>

<name>blosc-java</name>
Expand Down Expand Up @@ -76,7 +76,7 @@
<plugin>
<groupId>org.jreleaser</groupId>
<artifactId>jreleaser-maven-plugin</artifactId>
<version>1.7.0</version>
<version>1.15.0</version>
<configuration>
<jreleaser>
<signing>
Expand All @@ -85,17 +85,13 @@
</signing>
<deploy>
<maven>
<nexus2>
<maven-central>
<mavenCentral>
<sonatype>
<active>ALWAYS</active>
<url>https://oss.sonatype.org/service/local</url>
<snapshotUrl>https://oss.sonatype.org/content/repositories/snapshots/
</snapshotUrl>
<closeRepository>false</closeRepository>
<releaseRepository>false</releaseRepository>
<url>https://central.sonatype.com/api/v1/publisher</url>
<stagingRepositories>target/staging-deploy</stagingRepositories>
</maven-central>
</nexus2>
</sonatype>
</mavenCentral>
</maven>
</deploy>
</jreleaser>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/scalableminds/bloscjava/Blosc.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ private static File loadLibraryFromJarToTemp() throws IOException {

// attempt to look up the static library in the jar file
String libraryFileName = filePrefix + extension;
// On Linux, select arch-specific library
if (extension.equals(".so")) {
String arch = System.getProperty("os.arch").toLowerCase();
libraryFileName = filePrefix + "-" + arch + extension;
}
is = Blosc.class.getClassLoader().getResourceAsStream(libraryFileName);

if (is == null) {
Expand Down
Loading