bmath/.github/workflows/ci.yaml

40 lines
1.2 KiB
YAML

name: ci
on:
push:
pull_request:
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz
tar -xf clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz
sudo cp clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04/bin/clang-format /usr/local/bin/
- name: Check clang-format
run: |
set -e
FILES=$(git ls-files | grep -E '\.(cc|hh|hpp|cpp|cxx)$' || true)
if [ -z "$FILES" ]; then exit 0; fi
clang-format --version
for f in $FILES; do
clang-format --style=google --dry-run -Werror "$f"
done
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Release]
steps:
- uses: actions/checkout@v4
- name: Install compiler
run: sudo apt-get update && sudo apt-get install -y g++ cmake
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure