/ .github / workflows / c-tests.yml
c-tests.yml
 1  name: C
 2  on:
 3    push:
 4      branches:
 5        - main
 6    pull_request:
 7      branches:
 8        - main
 9  
10  defaults:
11    run:
12      shell: bash
13      working-directory: src
14  
15  jobs:
16    tests:
17      runs-on: ${{matrix.os}}
18      strategy:
19        matrix:
20          os:
21            - ubuntu-latest
22            - macos-latest
23            - windows-latest
24      steps:
25        # Checkout repository and blst submodule.
26        - uses: actions/checkout@v3
27          with:
28            submodules: recursive
29  
30        # Check formatting.
31        # Only need to check this once.
32        - name: Check formatting
33          if: matrix.os == 'ubuntu-latest'
34          run: |
35            make format
36            git diff --exit-code
37  
38        # Build and test.
39        - name: Build
40          run: make test_c_kzg_4844
41        - name: Test
42          run: make test
43  
44        # Run sanitizers.
45        # Doesn't work on Windows.
46        - name: Clang Sanitizers
47          if: matrix.os != 'windows-latest'
48          run: make sanitize
49  
50        # Run static analyzer.
51        # Doesn't work on Windows.
52        - name: Clang Static Analyzer
53          if: matrix.os != 'windows-latest'
54          run: make analyze
55  
56        # Install LLVM for coverage report.
57        # Already installed on macOS.
58        # Doesn't work on Windows.
59        - name: Install LLVM
60          if: matrix.os == 'ubuntu-latest'
61          uses: egor-tensin/setup-clang@v1
62  
63        # Generate the coverage report.
64        # Doesn't work on Windows.
65        - name: Generate coverage report
66          if: matrix.os != 'windows-latest'
67          run: make coverage
68  
69        # Upload the coverage report.
70        # Didn't generate it for Windows.
71        - name: Save coverage report
72          if: matrix.os != 'windows-latest'
73          uses: actions/upload-artifact@v3
74          with:
75            name: coverage
76            path: src/coverage.html