From 96ed9fbe85de18bbb13dfe8cf16e79fe9c5c0906 Mon Sep 17 00:00:00 2001 From: Giovanni Petrantoni <7008900+sinkingsugar@users.noreply.github.com> Date: Tue, 10 Nov 2020 17:16:39 +0900 Subject: [PATCH] start by building with codecov on (linux) (#424) * start by building with codecov on (linux) * travis coverage builds * wip * wip * wip * wip * codecov.io integration * merge multiple coverage * improve nimble codecov * fileExists * wip codecov CI refactor * add nimble install * wip * fix path * wip * add lcov command * try bump ubuntu... * wip * add genhtml to debug * wip * wip * fix lcov extract * wip * wip * try again exporting coverage htmls * make artifacts unique * another attempt * fix env var * restore regular travis and nimble file --- .github/workflows/codecov.yml | 116 ++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/codecov.yml 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 }} + + +