From d7bbd96a55ad8fb55ac4bc024c980170c3a68223 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 19 Jul 2023 11:15:15 -0700 Subject: [PATCH] Add coverage automation Update unit tests to get accurate coverage reports --- .github/workflows/coverage.yml | 44 ++++++++++++++++++++++++++++++++ .github/workflows/unit_tests.yml | 3 ++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000000..4a9f8e8231ab --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,44 @@ +name: Run CodeCov +on: + push: + branches: + - dev + workflow_dispatch: + +jobs: + run: + runs-on: ubuntu-latest + env: + PYTHON: '3.9' + steps: + - uses: actions/checkout@master + - name: Setup Python + uses: actions/setup-python@master + with: + python-version: 3.9 + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt install python3-dev + python -m pip install build wheel + - name: Install repo + run: | + pip install -e .[mycroft,deprecated] + - name: Install test dependencies + run: | + sudo apt install libssl-dev libfann-dev portaudio19-dev libpulse-dev + pip install -r requirements/tests.txt + pip install ./test/unittests/common_query/ovos_tskill_fakewiki + - name: Generate coverage report + run: | + pytest --cov=./ovos_core --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: ./coverage/reports/ + fail_ci_if_error: true + files: ./coverage.xml,!./cache + flags: unittests + name: codecov-umbrella + verbose: true \ No newline at end of file diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 3cc63ae1f664..d28b9129ad53 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -50,7 +50,7 @@ jobs: python -m pip install build wheel - name: Install core repo run: | - pip install .[mycroft,deprecated] + pip install -e .[mycroft,deprecated] - name: Install test dependencies run: | pip install -r requirements/tests.txt @@ -68,6 +68,7 @@ jobs: # or they will overwrite previous invocations' coverage reports # (for an example, see OVOS Skill Manager's workflow) - name: Upload coverage + if: "${{ matrix.python-version == '3.9' }}" env: CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} uses: codecov/codecov-action@v2