Skip to content

Commit 2a9570d

Browse files
committed
Add workflow to build C-Blosc2 binaries
Output will be used by the soon-to-be created libblosc2-native jar, which is part of #1447
1 parent d3ca229 commit 2a9570d

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.github/workflows/libblosc2.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: C-Blosc2 build using CMake on multiple platforms
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
12+
matrix:
13+
build_env: [
14+
{os: ubuntu-24.04, c_compiler: gcc, lib: 'blosc/libblosc2.so', jna_id: 'linux-x86-64'},
15+
{os: ubuntu-24.04-arm, c_compiler: gcc, lib: 'blosc/libblosc2.so', jna_id: 'linux-aarch64'},
16+
{os: windows-2022, c_compiler: cl, lib: 'blosc\\Release\\libblosc2.dll', jna_id: 'win32-x86-64'},
17+
{os: windows-11-arm, c_compiler: cl, lib: 'blosc\\Release\\libblosc2.dll', jna_id: 'win32-aarch64'},
18+
{os: macos-14, c_compiler: clang, lib: 'blosc/libblosc2.dylib', jna_id: 'darwin-aarch64'},
19+
{os: macos-15-intel, c_compiler: clang, lib: 'blosc/libblosc2.dylib', jna_id: 'darwin-x86-64'},
20+
]
21+
build_type: [Release]
22+
23+
runs-on: ${{ matrix.build_env.os }}
24+
25+
steps:
26+
- name: Set shared values
27+
id: strings
28+
shell: bash
29+
run: |
30+
echo "build-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
31+
32+
- uses: actions/checkout@v4
33+
with:
34+
repository: 'Blosc/c-blosc2'
35+
ref: "v2.22.0"
36+
37+
- name: Configure CMake
38+
run: >
39+
cmake -B ${{ steps.strings.outputs.build-dir }}
40+
-DCMAKE_C_COMPILER=${{ matrix.build_env.c_compiler }}
41+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
42+
-S ${{ github.workspace }}
43+
44+
- name: Build
45+
run: cmake --build ${{ steps.strings.outputs.build-dir }} --config ${{ matrix.build_type }}
46+
47+
- name: Test
48+
working-directory: ${{ steps.strings.outputs.build-dir }}
49+
run: ctest --build-config ${{ matrix.build_type }}
50+
51+
- name: Prepare ${{ matrix.build_env.jna_id }} library for archive
52+
shell: bash
53+
working-directory: ${{ steps.strings.outputs.build-dir }}
54+
run: |
55+
mkdir resources
56+
mkdir resources/${{ matrix.build_env.jna_id }}
57+
cp ../LICENSE.txt resources/${{ matrix.build_env.jna_id }}/libblosc2-LICENSE.txt
58+
cp -r ../LICENSES resources/${{ matrix.build_env.jna_id }}/
59+
cp -L ${{ matrix.build_env.lib }} resources/${{ matrix.build_env.jna_id }}
60+
61+
- name: Upload ${{ matrix.build_env.jna_id }} artifact
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: libblosc2-${{ matrix.build_env.jna_id }}
65+
path: ${{ steps.strings.outputs.build-dir }}/resources
66+
67+
merge:
68+
needs: build
69+
70+
runs-on: ubuntu-latest
71+
72+
steps:
73+
- uses: actions/download-artifact@v4
74+
with:
75+
pattern: libblosc2-*
76+
path: native/resources/
77+
merge-multiple: true
78+
79+
- name: Display contents of the combined native artifact
80+
run: find native/ -type f -exec ls -lh {} \;
81+
82+
- name: Upload merged artifact
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: libblosc2-native-2.22.0-${{ github.sha }}
86+
path: native/

0 commit comments

Comments
 (0)