Skip to content

Rename the license and reword the README #2

Rename the license and reword the README

Rename the license and reword the README #2

name: CMake Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macos-13 ]
build_type: [ Debug, Release ]
c_compiler: [ gcc, clang ]
include:
- os: macos-13
c_compiler: gcc
cpp_compiler: g++-13
env:
- LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
- CPPFLAGS="-I/usr/local/opt/llvm/include"
- LD_LIBRARY_PATH="/usr/local/opt/llvm/lib"
- DYLD_LIBRARY_PATH="/usr/local/opt/llvm/lib"
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++-13
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++-17
# Don't include the following configurations in the matrix
exclude:
- os: macos-13
c_compiler: clang # LLVM Clang17+ required, and building it from the source will take longer
steps:
# Install dependencies: cmake, ninja, gcc, libgcrypt, openssl, readline, and libsodium
- name: Install Dependencies
if: matrix.os == 'macos-13'
run: |
brew update
brew install cmake ninja gcc libgcrypt openssl@3 readline libsodium
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
- name: Install Dependencies
if: matrix.os == 'ubuntu-latest'
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository -y "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/ppa
sudo apt update
sudo apt install -y cmake ninja-build gcc-13 g++-13 clang-17 lldb-17 lld-17 libc++-17-dev libc++abi-17-dev libomp-17-dev libgcrypt20 openssl libreadline8 libsodium23 libsodium-dev
# Install BLAKE3
- name: Build BLAKE3
run: |
git clone https://github.com/BLAKE3-team/BLAKE3.git
cd BLAKE3/c
cmake -B build -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -G Ninja
sudo cmake --build build --config Release --target install -j 4
- uses: actions/checkout@v3
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }} -G Ninja
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j 4
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration
run: ctest --build-config ${{ matrix.build_type }}