Add apt-get update (#29) #152
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: [push, pull_request, fork] | |
jobs: | |
build: | |
runs-on: ${{matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
shared: [ON, OFF] | |
exclude: | |
# CMake don't copy DLLs to exe output, skip for now | |
- os: windows-latest | |
shared: ON | |
env: | |
BUILD_SHARED_LIBS: ${{matrix.shared}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: lukka/get-cmake@latest | |
- name: Build | |
run: | | |
cmake --preset Release | |
cmake --build --parallel --preset Release | |
- name: Test | |
working-directory: build | |
run: ctest -C Release --output-on-failure | |
- name: Post Test | |
run: git diff --exit-code | |
memcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: lukka/get-cmake@latest | |
- name: Build | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y valgrind | |
cmake --preset Debug | |
cmake --build --parallel --preset Debug | |
- name: Test | |
working-directory: build | |
run: | | |
ctest -T memcheck --overwrite MemoryCheckCommandOptions="--leak-check=full --show-leak-kinds=all --error-exitcode=100" | |
awk 'FNR==1 {print "\n\n\n\n\n\t", FILENAME, "\n"}{print}' Testing/Temporary/MemoryChecker.*.log | |
- name: Post Test | |
run: git diff --exit-code | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: lukka/get-cmake@latest | |
- name: Build | |
run: | | |
cmake --preset Debug -DBUILD_COVERAGE=ON | |
cmake --build --parallel --preset Debug | |
- name: Test | |
working-directory: build | |
run: ctest -T test -T coverage | |
- name: Post Test | |
run: git diff --exit-code | |
- uses: codecov/codecov-action@v2 | |
fuzz: | |
runs-on: ubuntu-latest | |
container: aflplusplus/aflplusplus | |
env: | |
AFL_SKIP_CPUFREQ: 1 | |
steps: | |
- run: mkdir /src && cd /src | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
apt-get update | |
apt-get install -y python3-pip | |
apt-get install -y rename | |
pip install cmake | |
- name: Build | |
run: | | |
cmake --preset Release -DCMAKE_C_COMPILER=afl-cc -DCMAKE_CXX_COMPILER=afl-c++ | |
cmake --build --parallel --preset Release | |
- name: Fuzz | |
# Fuzz for 60 seconds, until we fix the bugs we have | |
# Fuuz only pcapng files for now | |
run: | | |
mkdir input | |
cp pcaps/*.pcapng input | |
afl-fuzz -V 600 -i input -o output -e pcapng -- build/tests/test_packets_dump @@ /dev/null | |
afl-stat.sh output/default | |
cat output/default/fuzzer_stats | |
ls output/default/crashes | |
ls output/default/hangs | |
# Remove special chars from file names | |
- run: | | |
rename 's/:/_/g' output/default/crashes/* | |
rename 's/:/_/g' output/default/hangs/* | |
rename 's/$/.pcapng/g' output/default/crashes/* | |
rename 's/$/.pcapng/g' output/default/hangs/* | |
- name: Check | |
# Remove non-empty dirs, if they are not empry rmdir will fail | |
run: | | |
rmdir output/default/crashes | |
rmdir output/default/hangs | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: fuzz | |
retention-days: 7 | |
path: | | |
output/default/crashes/* | |
output/default/hangs/* |