c-kzg-4844/.github/workflows/c-tests.yml

101 lines
2.6 KiB
YAML

name: C
on:
push:
branches:
- main
pull_request:
branches:
- main
defaults:
run:
shell: bash
working-directory: src
jobs:
tests:
runs-on: ${{matrix.os}}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
# Checkout repository and blst submodule.
- uses: actions/checkout@v3
with:
submodules: recursive
# Check formatting.
# Only need to check this once.
- name: Check formatting
if: matrix.os == 'ubuntu-latest'
run: |
make format
git diff --exit-code
# Build and test with minimal preset.
- name: Build (minimal)
run: |
export FIELD_ELEMENTS_PER_BLOB=4
make clean && make test_c_kzg_4844
unset FIELD_ELEMENTS_PER_BLOB
- name: Save test binary (minimal)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: test_minimal_${{matrix.os}}
path: src/test_c_kzg_4844.exe
- name: Test (minimal)
run: make test
# Build and test with mainnet preset.
- name: Build (mainnet)
run: |
export FIELD_ELEMENTS_PER_BLOB=4096
make clean && make test_c_kzg_4844
unset FIELD_ELEMENTS_PER_BLOB
- name: Save test binary (mainnet)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: test_mainnet_${{matrix.os}}
path: src/test_c_kzg_4844.exe
- name: Test (mainnet)
run: make test
# Run sanitizers.
# Doesn't work on Windows.
- name: Clang Sanitizers
if: matrix.os != 'windows-latest'
run: make sanitize
# Run static analyzer.
# Doesn't work on Windows.
- name: Clang Static Analyzer
if: matrix.os != 'windows-latest'
run: make analyze
# Install LLVM for coverage report.
# Already installed on macOS.
# Doesn't work on Windows.
- name: Install LLVM
if: matrix.os == 'ubuntu-latest'
uses: egor-tensin/setup-clang@v1
# Generate the coverage report.
# Doesn't work on Windows.
- name: Generate coverage report
if: matrix.os != 'windows-latest'
run: make coverage
# Upload the coverage report.
# Didn't generate it for Windows.
- name: Save coverage report
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: coverage
path: src/coverage.html