From 1436a0282ca8f5346520deb946f8276b9e1c8398 Mon Sep 17 00:00:00 2001 From: Willem Pienaar <6728866+woop@users.noreply.github.com> Date: Fri, 14 May 2021 18:07:56 -0700 Subject: [PATCH] Add test coverage and remove MacOS integration tests (#1562) * Add code coverage to unit tests Signed-off-by: Willem Pienaar * Add coverage to PRs Signed-off-by: Willem Pienaar --- .github/workflows/integration_tests.yml | 15 +++++++++++++-- .github/workflows/pr_integration_tests.yml | 15 +++++++++++++-- .github/workflows/unit_tests.yml | 11 +++++++++++ Makefile | 2 +- sdk/python/setup.py | 1 + 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 15be182e86..739ccc3e4b 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -12,7 +12,10 @@ jobs: fail-fast: false matrix: python-version: [ 3.7, 3.8, 3.9 ] - os: [ ubuntu-latest, macOS-latest ] + os: [ ubuntu-latest ] + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.python-version }} steps: - uses: actions/checkout@v2 - name: Setup Python @@ -31,4 +34,12 @@ jobs: - name: Install dependencies run: make install-python-ci-dependencies - name: Test python - run: FEAST_TELEMETRY=False pytest --verbose --color=yes sdk/python/tests --integration + run: FEAST_TELEMETRY=False pytest --cov=./ --cov-report=xml --verbose --color=yes sdk/python/tests --integration + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + files: ./coverage.xml + flags: integrationtests + env_vars: OS,PYTHON + fail_ci_if_error: true + verbose: true \ No newline at end of file diff --git a/.github/workflows/pr_integration_tests.yml b/.github/workflows/pr_integration_tests.yml index cab2d212de..a5d64f89f3 100644 --- a/.github/workflows/pr_integration_tests.yml +++ b/.github/workflows/pr_integration_tests.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: python-version: [ 3.7, 3.8, 3.9 ] - os: [ ubuntu-latest, macOS-latest ] + os: [ ubuntu-latest ] services: redis: image: redis @@ -26,6 +26,9 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.python-version }} steps: - uses: actions/checkout@v2 with: @@ -50,7 +53,15 @@ jobs: - name: Install dependencies run: make install-python-ci-dependencies - name: Test python - run: FEAST_TELEMETRY=False pytest --verbose --color=yes sdk/python/tests --integration + run: FEAST_TELEMETRY=False pytest --cov=./ --cov-report=xml --verbose --color=yes sdk/python/tests --integration env: REDIS_TYPE: REDIS REDIS_CONNECTION_STRING: redis:6379,db=0 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + files: ./coverage.xml + flags: integrationtests + env_vars: OS,PYTHON + fail_ci_if_error: true + verbose: true diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index afa1b5043c..95ba983064 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -9,6 +9,9 @@ jobs: matrix: python-version: [ 3.7, 3.8, 3.9 ] os: [ ubuntu-latest, macOS-latest] + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.python-version }} steps: - uses: actions/checkout@v2 - name: Setup Python @@ -20,6 +23,14 @@ jobs: run: make install-python-ci-dependencies - name: Test Python run: make test-python + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + files: ./coverage.xml + flags: unittests + env_vars: OS,PYTHON + fail_ci_if_error: true + verbose: true unit-test-go: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 3c3e6e1b24..e1911a9315 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ install-python: python -m pip install -e sdk/python -U --use-deprecated=legacy-resolver test-python: - FEAST_TELEMETRY=False pytest --verbose --color=yes sdk/python/tests + FEAST_TELEMETRY=False pytest --cov=./ --cov-report=xml --verbose --color=yes sdk/python/tests format-python: # Sort diff --git a/sdk/python/setup.py b/sdk/python/setup.py index dd600c826d..de001ba344 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -81,6 +81,7 @@ "gcsfs", "urllib3>=1.25.4", "pytest==6.0.0", + "pytest-cov", "pytest-lazy-fixture==0.6.3", "pytest-timeout==1.4.2", "pytest-ordering==0.6.*",