diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..817ce122f --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,116 @@ +name: nim-libp2p codecov builds + +on: [push, pull_request] + +jobs: + GossipSub: + runs-on: ubuntu-20.04 + strategy: + matrix: + nim-options: [ + "", + "-d:libp2p_pubsub_anonymize=true -d:libp2p_pubsub_sign=false -d:libp2p_pubsub_verify=false", + "-d:libp2p_pubsub_sign=true -d:libp2p_pubsub_verify=true", + "-d:fallback_gossipsub_10", + "-d:fallback_gossipsub_10 -d:libp2p_pubsub_anonymize=true -d:libp2p_pubsub_sign=false -d:libp2p_pubsub_verify=false", + "-d:fallback_gossipsub_10 -d:libp2p_pubsub_sign=true -d:libp2p_pubsub_verify=true" + ] + test-program: [ + "tests/pubsub/testpubsub", + "tests/pubsub/testgossipinternal", + "tests/pubsub/testgossipinternal10" + ] + steps: + - uses: actions/checkout@v2 + - name: Run + run: | + sudo apt-get update + sudo apt-get install -y lcov build-essential git curl + mkdir coverage + curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh + env MAKE="make -j${NPROC}" bash build_nim.sh Nim csources dist/nimble NimBinaries + export PATH="$PATH:$PWD/Nim/bin" + nimble install -y --depsOnly + export NIM_OPTIONS="--opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --warning[CaseTransition]:off --warning[ObservableStores]:off --warning[LockLevel]:off --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage ${{ matrix.options }}" + nim c $NIM_OPTIONS -r ${{ matrix.test-program }} + cd nimcache; rm *.c; cd .. + lcov --capture --directory nimcache --output-file coverage/coverage.info + lcov --extract coverage/coverage.info `pwd`/libp2p/* `pwd`/libp2p/**/* `pwd`/libp2p/**/**/* --output-file coverage/coverage.f.info + genhtml coverage/coverage.f.info --output-directory coverage/output-$GITHUB_RUN_ID + bash <(curl -s https://codecov.io/bash) -f coverage/coverage.f.info || echo "Codecov did not collect coverage reports" + - uses: actions/upload-artifact@master + with: + name: coverage + path: coverage/output-${{ env.GITHUB_RUN_ID }} + + Tests: + runs-on: ubuntu-20.04 + strategy: + matrix: + nim-options: [ + "" + ] + test-program: [ + "tests/testnative", + ] + steps: + - uses: actions/checkout@v2 + - name: Run + run: | + sudo apt-get update + sudo apt-get install -y lcov build-essential git curl + mkdir coverage + curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh + env MAKE="make -j${NPROC}" bash build_nim.sh Nim csources dist/nimble NimBinaries + export PATH="$PATH:$PWD/Nim/bin" + nimble install -y --depsOnly + export NIM_OPTIONS="--opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --warning[CaseTransition]:off --warning[ObservableStores]:off --warning[LockLevel]:off --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage ${{ matrix.options }}" + nim c $NIM_OPTIONS -r ${{ matrix.test-program }} + cd nimcache; rm *.c; cd .. + lcov --capture --directory nimcache --output-file coverage/coverage.info + lcov --extract coverage/coverage.info `pwd`/libp2p/* `pwd`/libp2p/**/* `pwd`/libp2p/**/**/* --output-file coverage/coverage.f.info + genhtml coverage/coverage.f.info --output-directory coverage/output-$GITHUB_RUN_ID + bash <(curl -s https://codecov.io/bash) -f coverage/coverage.f.info || echo "Codecov did not collect coverage reports" + - uses: actions/upload-artifact@master + with: + name: coverage + path: coverage/output-${{ env.GITHUB_RUN_ID }} + + Filter: + runs-on: ubuntu-20.04 + strategy: + matrix: + nim-options: [ + "", + "-d:libp2p_pki_schemes=secp256k1", + "-d:libp2p_pki_schemes=secp256k1;ed25519", + "-d:libp2p_pki_schemes=secp256k1;ed25519;ecnist", + ] + test-program: [ + "tests/testpkifilter", + ] + steps: + - uses: actions/checkout@v2 + - name: Run + run: | + sudo apt-get update + sudo apt-get install -y lcov build-essential git curl + mkdir coverage + curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh + env MAKE="make -j${NPROC}" bash build_nim.sh Nim csources dist/nimble NimBinaries + export PATH="$PATH:$PWD/Nim/bin" + nimble install -y --depsOnly + export NIM_OPTIONS="--opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --warning[CaseTransition]:off --warning[ObservableStores]:off --warning[LockLevel]:off --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage ${{ matrix.options }}" + nim c $NIM_OPTIONS -r ${{ matrix.test-program }} + cd nimcache; rm *.c; cd .. + lcov --capture --directory nimcache --output-file coverage/coverage.info + lcov --extract coverage/coverage.info `pwd`/libp2p/* `pwd`/libp2p/**/* `pwd`/libp2p/**/**/* --output-file coverage/coverage.f.info + genhtml coverage/coverage.f.info --output-directory coverage/output-$GITHUB_RUN_ID + bash <(curl -s https://codecov.io/bash) -f coverage/coverage.f.info || echo "Codecov did not collect coverage reports" + - uses: actions/upload-artifact@master + with: + name: coverage + path: coverage/output-${{ env.GITHUB_RUN_ID }} + + +