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