2023-03-13 10:42:12 +00:00
|
|
|
name: C
|
2023-01-30 16:37:04 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
2023-04-04 15:29:40 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
working-directory: src
|
|
|
|
|
2023-01-30 16:37:04 +00:00
|
|
|
jobs:
|
2023-03-13 10:42:12 +00:00
|
|
|
tests:
|
2023-03-31 04:39:57 +00:00
|
|
|
runs-on: ${{matrix.os}}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
- windows-latest
|
2023-01-30 16:37:04 +00:00
|
|
|
steps:
|
2023-04-04 15:29:40 +00:00
|
|
|
# Checkout repository and blst submodule.
|
2023-01-30 16:37:04 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
2023-04-04 15:29:40 +00:00
|
|
|
|
|
|
|
# Check formatting.
|
|
|
|
# Only need to check this once.
|
2023-03-13 10:42:12 +00:00
|
|
|
- name: Check formatting
|
2023-03-31 04:39:57 +00:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2023-03-13 10:42:12 +00:00
|
|
|
run: |
|
|
|
|
make format
|
|
|
|
git diff --exit-code
|
2023-04-04 15:29:40 +00:00
|
|
|
|
|
|
|
# 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.
|
2023-03-13 10:42:12 +00:00
|
|
|
- name: Clang Sanitizers
|
2023-03-31 04:39:57 +00:00
|
|
|
if: matrix.os != 'windows-latest'
|
2023-03-28 13:26:51 +00:00
|
|
|
run: make sanitize
|
2023-04-04 15:29:40 +00:00
|
|
|
|
|
|
|
# Run static analyzer.
|
|
|
|
# Doesn't work on Windows.
|
2023-02-11 16:03:35 +00:00
|
|
|
- name: Clang Static Analyzer
|
2023-03-31 04:39:57 +00:00
|
|
|
if: matrix.os != 'windows-latest'
|
2023-03-28 13:26:51 +00:00
|
|
|
run: make analyze
|
2023-04-04 15:29:40 +00:00
|
|
|
|
|
|
|
# Install LLVM for coverage report.
|
|
|
|
# Already installed on macOS.
|
|
|
|
# Doesn't work on Windows.
|
2023-02-01 07:58:52 +00:00
|
|
|
- name: Install LLVM
|
2023-03-31 04:39:57 +00:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2023-02-01 07:58:52 +00:00
|
|
|
uses: egor-tensin/setup-clang@v1
|
2023-04-04 15:29:40 +00:00
|
|
|
|
|
|
|
# Generate the coverage report.
|
|
|
|
# Doesn't work on Windows.
|
2023-02-01 07:58:52 +00:00
|
|
|
- name: Generate coverage report
|
2023-03-31 04:39:57 +00:00
|
|
|
if: matrix.os != 'windows-latest'
|
2023-03-28 13:26:51 +00:00
|
|
|
run: make coverage
|
2023-04-04 15:29:40 +00:00
|
|
|
|
|
|
|
# Upload the coverage report.
|
|
|
|
# Didn't generate it for Windows.
|
2023-02-01 07:58:52 +00:00
|
|
|
- name: Save coverage report
|
2023-03-31 04:39:57 +00:00
|
|
|
if: matrix.os != 'windows-latest'
|
2023-02-01 07:58:52 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: coverage
|
|
|
|
path: src/coverage.html
|