a27f13d657
- Build and push fastsync-ci:v8 with lcov, valgrind, clang baked in - Remove all apt-get install steps from CI (v8 has them pre-installed) - Fix chunk.c use_metadata=true OOB: add remaining_size guard before metadata_from_buf reads past the buffer. The bug allowed network-facing chunk_deserialize to heap-buffer-overflow on crafted inputs. - Also guard against unsigned underflow on remaining_size - sizeof(int)
114 lines
3.1 KiB
YAML
114 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
container: gitea.tap-tap.win/taptap/fastsync-ci:v8
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: clang-format check
|
|
run: find src/ tests/ -name '*.c' -o -name '*.h' | xargs clang-format --dry-run --Werror
|
|
|
|
- name: cppcheck
|
|
run: cppcheck --enable=warning,style,performance,portability --suppress=missingIncludeSystem --error-exitcode=1 --inline-suppr src/ tests/
|
|
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
container: gitea.tap-tap.win/taptap/fastsync-ci:v8
|
|
needs: lint
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure
|
|
run: cmake -B build -S . -DSTRICT_WARNINGS=ON
|
|
|
|
- name: Build
|
|
run: cmake --build build -j$(nproc)
|
|
|
|
- name: Unit Tests
|
|
run: ctest --test-dir build --output-on-failure -j$(nproc)
|
|
|
|
- name: Integration Tests
|
|
run: python3 -m pytest tests/integration/ -v --tb=short
|
|
|
|
sanitizers:
|
|
runs-on: ubuntu-latest
|
|
container: gitea.tap-tap.win/taptap/fastsync-ci:v8
|
|
needs: lint
|
|
strategy:
|
|
matrix:
|
|
sanitizer: [address, undefined]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure
|
|
run: cmake -B build-${{ matrix.sanitizer }} -S . -DSANITIZER=${{ matrix.sanitizer }}
|
|
|
|
- name: Build
|
|
run: cmake --build build-${{ matrix.sanitizer }} -j$(nproc)
|
|
|
|
- name: Unit Tests
|
|
run: ctest --test-dir build-${{ matrix.sanitizer }} --output-on-failure
|
|
|
|
fuzz-build:
|
|
runs-on: ubuntu-latest
|
|
container: gitea.tap-tap.win/taptap/fastsync-ci:v8
|
|
needs: lint
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure (clang + fuzz)
|
|
run: CC=clang CXX=clang++ cmake -B build-fuzz -S . -DENABLE_FUZZ=ON
|
|
|
|
- name: Build fuzz targets
|
|
run: cmake --build build-fuzz -j$(nproc)
|
|
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
container: gitea.tap-tap.win/taptap/fastsync-ci:v8
|
|
needs: lint
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure
|
|
run: cmake -B build -S . -DENABLE_COVERAGE=ON -DSTRICT_WARNINGS=ON
|
|
|
|
- name: Build
|
|
run: cmake --build build -j$(nproc)
|
|
|
|
- name: Unit Tests
|
|
run: ctest --test-dir build --output-on-failure
|
|
|
|
- name: Coverage Report
|
|
run: |
|
|
lcov --capture --directory build --output-file coverage.info --branch-coverage
|
|
lcov --remove coverage.info '/usr/*' '*/tests/*' '*/_deps/*' --output-file coverage.info --branch-coverage --ignore-errors unused
|
|
lcov --list coverage.info
|
|
|
|
valgrind:
|
|
runs-on: ubuntu-latest
|
|
container: gitea.tap-tap.win/taptap/fastsync-ci:v8
|
|
needs: lint
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure
|
|
run: cmake -B build -S . -DSTRICT_WARNINGS=ON
|
|
|
|
- name: Build
|
|
run: cmake --build build -j$(nproc)
|
|
|
|
- name: Valgrind Memcheck
|
|
run: valgrind --leak-check=full --show-leak-kinds=definite --error-exitcode=1 ./build/tests
|
|
env:
|
|
FASTSYNC_UNDER_VALGRIND: "1"
|