From 8ec3a2beb49af2d4953808169e8d9c1a373c2b12 Mon Sep 17 00:00:00 2001 From: Brian Pepple Date: Wed, 27 Oct 2021 22:12:09 -0400 Subject: [PATCH] Add github action for codecov --- marvelous/.github/workflows/codecov.yml | 67 +++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 marvelous/.github/workflows/codecov.yml diff --git a/marvelous/.github/workflows/codecov.yml b/marvelous/.github/workflows/codecov.yml new file mode 100644 index 0000000..d4b0485 --- /dev/null +++ b/marvelous/.github/workflows/codecov.yml @@ -0,0 +1,67 @@ +name: Codecov +on: [push] +jobs: + run: + strategy: + fail-fast: false + matrix: + python-version: + - 3.9 + os: + - ubuntu-latest + runs-on: ${{ matrix.os }} + steps: + #---------------------------------------------- + # check-out repo and set-up python + #---------------------------------------------- + - uses: actions/checkout@master + - name: Setup Python + uses: actions/setup-python@master + with: + python-version: ${{ matrix.python-version }} + #---------------------------------------------- + # ----- install & configure poetry ----- + #---------------------------------------------- + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: 1.1.11 + virtualenvs-create: true + virtualenvs-in-project: true + #---------------------------------------------- + # load cached venv if cache exists + #---------------------------------------------- + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2 + with: + path: .venv + key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} + #---------------------------------------------- + # install dependencies if cache does not exist + #---------------------------------------------- + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + #---------------------------------------------- + # install your root project, if required + #---------------------------------------------- + - name: Install library + run: poetry install --no-interaction + #---------------------------------------------- + # run pytest and upload results + #---------------------------------------------- + - name: Generate coverage report + run: | + poetry run pytest --cov=./ --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + directory: ./coverage/reports/ + env_vars: OS,PYTHON + fail_ci_if_error: true + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + path_to_write_report: ./coverage/codecov_report.txt + verbose: true