name: Generate and upload code coverage on: #On push to common branches, this computes the "bases stats" for PRs push: branches: - main pull_request: workflow_dispatch: jobs: All_Tests: name: All tests runs-on: ubuntu-20.04 strategy: matrix: nim-options: [ "" ] test-program: [ "test" ] steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Environment setup run: | sudo apt-get update sudo apt-get install -y lcov build-essential git curl mkdir coverage - name: Install Nim (stable) run: | mkdir downloads cd downloads curl https://nim-lang.org/choosenim/init.sh -sSf -O chmod +x init.sh ./init.sh -y echo 'export NIMBLE_DIR="${HOME}/.nimble"' >> "${HOME}/.bash_env" echo 'export PATH="${NIMBLE_DIR}/bin:${PATH}"' >> "${HOME}/.bash_env" cd .. - name: Run tests run: | source "${HOME}/.bash_env" nimble -y --verbose ${{ matrix.test-program }} --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage ${{ matrix.nim-options }} cd nimcache; rm *.c; cd .. - name: Generate coverage data run: | lcov --capture --directory nimcache --output-file coverage/coverage.info shopt -s globstar ls $(pwd)/libp2pdht/{*,**/*}.nim lcov --extract coverage/coverage.info $(pwd)/libp2pdht/{*,**/*}.nim --output-file coverage/coverage.f.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: directory: ./coverage/ fail_ci_if_error: true files: ./coverage/coverage.f.info flags: unittests name: codecov-umbrella verbose: true