-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (147 loc) · 5.42 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
on:
push:
jobs:
build_bloscjni:
strategy:
matrix:
os: [ ubuntu, windows, macos ]
runs-on: ${{ matrix.os }}-latest
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' }}
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' }}
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' }}
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' }}
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' }}
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' }}
run: |
cd bloscjni
docker build -t centos7-jdk8 -f Dockerfile.centos7 .
- name: Build c-blosc (Linux)
if: ${{ matrix.os == 'ubuntu' }}
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' }}
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