@@ -303,34 +303,119 @@ jobs:
303303 cmake --build c/build --target blake3-example
304304
305305 # Currently only on x86.
306- pkg_config_c_tests :
307- name : pkg-config C tests TBB =${{ matrix.use_tbb }} BUILD_SHARED_LIBS =${{ matrix.shared_libs }} STDLIB =${{ matrix.stdlib }}
306+ packaging-cmake :
307+ name : CMake packaging tests - tbb =${{ matrix.use_tbb }} shared =${{ matrix.shared_libs }} os=${{ matrix.os }} cc=${{ matrix.toolchain.cc }} stdlib =${{ matrix.stdlib }}
308308 runs-on : ubuntu-latest
309309 strategy :
310310 fail-fast : false
311311 matrix :
312- use_tbb : ["OFF", "ON"]
313- shared_libs : ["OFF", "ON"]
314- stdlib : ["libc++", "libstdc++"]
312+ use_tbb : [OFF, ON]
313+ shared_libs : [OFF, ON]
314+ os : [ubuntu-latest, macOS-latest]
315+ stdlib : [libc++, libstdc++]
316+ toolchain : [
317+ { cc: clang, cxx: clang++ },
318+ { cc: gcc, cxx: g++ }
319+ ]
320+ exclude :
321+ - toolchain : { cc: gcc, cxx: g++ }
322+ os : macOS-latest
323+ - toolchain : { cc: gcc, cxx: g++ }
324+ stdlib : libc++
325+ env :
326+ CC : ${{ matrix.toolchain.cc }}
327+ CXX : ${{ matrix.toolchain.cxx }}
328+ CXXFLAGS : ${{ matrix.stdlib == 'libc++' && '-stdlib=libc++' || '' }}
315329 steps :
316330 - uses : actions/checkout@v4
317- - name : update packages
331+ - name : install dependencies
318332 run : |
319333 sudo apt-get update
320334 sudo apt-get install ninja-build libtbb-dev libtbb12
321- ${{ matrix.stdlib != 'libc++' || 'sudo apt-get install libc++-dev libc++abi-dev' }}
322- - name : configure cmake
335+ - name : install dependencies (libc++)
336+ if : matrix.stdlib == 'libc++'
337+ run : sudo apt-get install libc++-dev libc++abi-dev
338+ - name : configure libblake3
339+ run : cmake --fresh -S c -B c/build -G Ninja -DCMAKE_VERBOSE_MAKEFILE=1 "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target" "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}" "-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}" -DBLAKE3_EXAMPLES=0
340+ - name : build libblake3
341+ run : cmake --build c/build --target install
342+ - name : configure blake3-examples
343+ run : cmake --fresh -S c/examples -B c/examples/build -G Ninja -DCMAKE_VERBOSE_MAKEFILE=1 "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/examples/target" "-DBLAKE3_DIR=${{ github.workspace }}/target/lib/cmake/blake3"
344+ - name : build blake3 examples
345+ run : cmake --build c/examples/build --target install
346+ - name : configure environment
347+ run : |
348+ echo "LD_LIBRARY_PATH=${{ github.workspace }}/target/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
349+ echo "PKG_CONFIG_PATH=${{ github.workspace }}/target/lib/pkgconfig" >> $GITHUB_ENV
350+ - name : test blake3-example
351+ run : |
352+ [ -f "${{ github.workspace }}/examples/target/bin/blake3-example" ]
353+ [ $(echo -n IETF | "${{ github.workspace }}/examples/target/bin/blake3-example") = "83a2de1ee6f4e6ab686889248f4ec0cf4cc5709446a682ffd1cbb4d6165181e2" ]
354+ - name : test blake3-example-tbb
355+ if : matrix.use_tbb == 'ON'
356+ run : |
357+ [ -f "${{ github.workspace }}/examples/target/bin/blake3-example-tbb" ]
358+ echo -n IETF > example-input
359+ [ $("${{ github.workspace }}/examples/target/bin/blake3-example-tbb" ./example-input) = "83a2de1ee6f4e6ab686889248f4ec0cf4cc5709446a682ffd1cbb4d6165181e2" ]
360+
361+ # Currently only on x86.
362+ packaging-pkg_config :
363+ name : pkg-config packaging tests - tbb=${{ matrix.use_tbb }} shared=${{ matrix.shared_libs }} os=${{ matrix.os }} cc=${{ matrix.toolchain.cc }} stdlib=${{ matrix.stdlib }}
364+ runs-on : ubuntu-latest
365+ strategy :
366+ fail-fast : false
367+ matrix :
368+ use_tbb : [OFF, ON]
369+ shared_libs : [OFF, ON]
370+ os : [ubuntu-latest, macOS-latest]
371+ stdlib : [libc++, libstdc++]
372+ toolchain : [
373+ { cc: clang, cxx: clang++ },
374+ { cc: gcc, cxx: g++ }
375+ ]
376+ exclude :
377+ - toolchain : { cc: gcc, cxx: g++ }
378+ os : macOS-latest
379+ - toolchain : { cc: gcc, cxx: g++ }
380+ stdlib : libc++
381+ env :
382+ CC : ${{ matrix.toolchain.cc }}
383+ CXX : ${{ matrix.toolchain.cxx }}
384+ CXXFLAGS : ${{ matrix.stdlib == 'libc++' && '-stdlib=libc++' || '' }}
385+ steps :
386+ - uses : actions/checkout@v4
387+ - name : install dependencies
388+ run : |
389+ sudo apt-get update
390+ sudo apt-get install ninja-build libtbb-dev libtbb12
391+ - name : install dependencies (libc++)
392+ if : matrix.stdlib == 'libc++'
393+ run : sudo apt-get install libc++-dev libc++abi-dev
394+ - name : configure libblake3
395+ run : cmake --fresh -S c -B c/build -G Ninja -DCMAKE_VERBOSE_MAKEFILE=1 "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target" "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}" "-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}" -DBLAKE3_EXAMPLES=0
396+ - name : build libblake3
397+ run : cmake --build c/build --target install
398+ - name : configure environment
399+ run : |
400+ echo "LD_LIBRARY_PATH=${{ github.workspace }}/target/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
401+ echo "PKG_CONFIG_PATH=${{ github.workspace }}/target/lib/pkgconfig" >> $GITHUB_ENV
402+ - name : create bin directory
403+ run : mkdir -p ${{ github.workspace }}/target/bin
404+ - name : compile blake3-example
405+ run : gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example c/examples/example.c $(pkg-config --cflags --libs libblake3)
406+ - name : compile blake3-example-tbb
407+ if : matrix.use_tbb == 'ON'
408+ run : gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example-tbb c/examples/example_tbb.c $(pkg-config --cflags --libs libblake3)
409+ - name : test blake3-example
410+ run : |
411+ [ -f "${{ github.workspace }}/target/bin/blake3-example" ]
412+ [ $(echo -n IETF | "${{ github.workspace }}/target/bin/blake3-example") = "83a2de1ee6f4e6ab686889248f4ec0cf4cc5709446a682ffd1cbb4d6165181e2" ]
413+ - name : test blake3-example-tbb
414+ if : matrix.use_tbb == 'ON'
323415 run : |
324- export CXXFLAGS=${{ matrix.stdlib == 'libc++' && '-stdlib=libc++' || '' }}
325- export CC=${{ matrix.stdlib == 'libc++' && 'clang' || 'gcc' }}
326- export CXX=${{ matrix.stdlib == 'libc++' && 'clang++' || 'g++' }}
327- cmake --fresh -S c -B c/build -G Ninja -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}" "-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}" -DCMAKE_VERBOSE_MAKEFILE=1
328- - run : cmake --build c/build --target install
329- - run : mkdir -p ${{ github.workspace }}/target/bin
330- - run : echo "PKG_CONFIG_PATH=${{ github.workspace }}/target/lib/pkgconfig" >> $GITHUB_ENV
331- - run : gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example c/example.c $(pkg-config --cflags --libs libblake3)
332- - if : matrix.use_tbb == 'ON'
333- run : gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example-tbb c/example_tbb.c $(pkg-config --cflags --libs libblake3)
416+ [ -f "${{ github.workspace }}/target/bin/blake3-example-tbb" ]
417+ echo -n IETF > example-input
418+ [ $("${{ github.workspace }}/target/bin/blake3-example-tbb" ./example-input) = "83a2de1ee6f4e6ab686889248f4ec0cf4cc5709446a682ffd1cbb4d6165181e2" ]
334419
335420 # Note that this jobs builds AArch64 binaries from an x86_64 host.
336421 build_apple_silicon :
0 commit comments