From d17e2250b55664b320c8dd4c150c1adf45a749e2 Mon Sep 17 00:00:00 2001 From: ykurochkin Date: Fri, 21 Jan 2022 00:14:57 +0200 Subject: [PATCH 1/4] test --- .github/actions/ci-py-tests/action.yml | 80 ++++++++++++++------------ codecov.yml | 18 ++++++ 2 files changed, 60 insertions(+), 38 deletions(-) create mode 100644 codecov.yml diff --git a/.github/actions/ci-py-tests/action.yml b/.github/actions/ci-py-tests/action.yml index c1f50251d5579..d23e0c4465340 100644 --- a/.github/actions/ci-py-tests/action.yml +++ b/.github/actions/ci-py-tests/action.yml @@ -29,53 +29,57 @@ runs: shell: bash working-directory: ${{ inputs.module-folder }} run: | - virtualenv .venv - source .venv/bin/activate - JSON_CONFIG='{"module": "${{ inputs.module-name }}", "folder": "${{ inputs.module-folder }}", "lang": "py"}' - pip install coverage[toml]~=6.2 - mkdir -p .venv/source-acceptance-test - mkdir -p reports - SAT_DIR=$(git rev-parse --show-toplevel)/airbyte-integrations/bases/source-acceptance-test - PYPROJECT_CONFIG=$(git rev-parse --show-toplevel)/pyproject.toml - git ls-tree -r HEAD --name-only $SAT_DIR | while read src; do cp -f $src .venv/source-acceptance-test; done - pip install build - python -m build .venv/source-acceptance-test - pip install .venv/source-acceptance-test/dist/source_acceptance_test-*.whl - [ -f requirements.txt ] && pip install --quiet -r requirements.txt - pip install .[tests] - coverage run --rcfile=${PYPROJECT_CONFIG} -m pytest ./unit_tests || true - coverage xml --rcfile=${PYPROJECT_CONFIG} -o reports/coverage.xml || true + virtualenv .venv + source .venv/bin/activate + JSON_CONFIG='{"module": "${{ inputs.module-name }}", "folder": "${{ inputs.module-folder }}", "lang": "py"}' + pip install coverage[toml]~=6.2 + mkdir -p .venv/source-acceptance-test + mkdir -p reports + SAT_DIR=$(git rev-parse --show-toplevel)/airbyte-integrations/bases/source-acceptance-test + PYPROJECT_CONFIG=$(git rev-parse --show-toplevel)/pyproject.toml + git ls-tree -r HEAD --name-only $SAT_DIR | while read src; do cp -f $src .venv/source-acceptance-test; done + pip install build + python -m build .venv/source-acceptance-test + pip install .venv/source-acceptance-test/dist/source_acceptance_test-*.whl + [ -f requirements.txt ] && pip install --quiet -r requirements.txt + pip install .[tests] + coverage run --rcfile=${PYPROJECT_CONFIG} -m pytest ./unit_tests || true + coverage xml --rcfile=${PYPROJECT_CONFIG} -o reports/coverage.xml || true - rm -rf .venv - echo "::set-output name=coverage-paths::reports/coverage.xml" + rm -rf .venv + echo "::set-output name=coverage-paths::reports/coverage.xml" + + - name: Upload coverage to Codecov + if: ${{ always() }} + uses: codecov/codecov-action@v2 - name: Build Linter Reports id: build-linter-reports shell: bash working-directory: ${{ inputs.module-folder }} run: | - JSON_CONFIG='{"module": "${{ inputs.module-name }}", "folder": "${{ inputs.module-folder }}", "lang": "py"}' - REPORT_FOLDER=reports - PYPROJECT_CONFIG=$(git rev-parse --show-toplevel)/pyproject.toml + JSON_CONFIG='{"module": "${{ inputs.module-name }}", "folder": "${{ inputs.module-folder }}", "lang": "py"}' + REPORT_FOLDER=reports + PYPROJECT_CONFIG=$(git rev-parse --show-toplevel)/pyproject.toml - # run mypy - pip install lxml~=4.7 mypy~=0.910 . - mypy . --config-file=${PYPROJECT_CONFIG} | tee reports/mypy.log || true + # run mypy + pip install lxml~=4.7 mypy~=0.910 . + mypy . --config-file=${PYPROJECT_CONFIG} | tee reports/mypy.log || true - # run black - pip install black~=21.12b0 - XDG_CACHE_HOME=/dev/null black --config ${PYPROJECT_CONFIG} --diff . | tee reports/black.diff + # run black + pip install black~=21.12b0 + XDG_CACHE_HOME=/dev/null black --config ${PYPROJECT_CONFIG} --diff . | tee reports/black.diff - # run isort - pip install isort~=5.10.1 - cp ${PYPROJECT_CONFIG} ./pyproject.toml - isort --diff . | tee reports/isort.diff + # run isort + pip install isort~=5.10.1 + cp ${PYPROJECT_CONFIG} ./pyproject.toml + isort --diff . | tee reports/isort.diff - # run flake8 - pip install mccabe~=0.6.1 pyproject-flake8~=0.0.1a2 - pflake8 --exit-zero . | grep ^. | tee reports/flake.txt + # run flake8 + pip install mccabe~=0.6.1 pyproject-flake8~=0.0.1a2 + pflake8 --exit-zero . | grep ^. | tee reports/flake.txt - echo "::set-output name=mypy-logs::reports/mypy.log" - echo "::set-output name=black-diff::reports/black.diff" - echo "::set-output name=isort-diff::reports/isort.diff" - echo "::set-output name=flake8-logs::reports/flake.txt" + echo "::set-output name=mypy-logs::reports/mypy.log" + echo "::set-output name=black-diff::reports/black.diff" + echo "::set-output name=isort-diff::reports/isort.diff" + echo "::set-output name=flake8-logs::reports/flake.txt" diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000000..9ab8ce596340d --- /dev/null +++ b/codecov.yml @@ -0,0 +1,18 @@ +codecov: + notify: + require_ci_to_pass: no + +coverage: + status: + patch: + default: + target: 100% + if_no_uploads: error + if_not_found: failure + if_ci_failed: failure + project: + default: + target: 100% + if_no_uploads: error + if_not_found: failure + if_ci_failed: failure From cecd5f622453422cca2c5abf3c5bfc6d30fbf7f9 Mon Sep 17 00:00:00 2001 From: ykurochkin Date: Fri, 21 Jan 2022 00:29:50 +0200 Subject: [PATCH 2/4] t --- .../connectors/source-github/unit_tests/__init__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 airbyte-integrations/connectors/source-github/unit_tests/__init__.py diff --git a/airbyte-integrations/connectors/source-github/unit_tests/__init__.py b/airbyte-integrations/connectors/source-github/unit_tests/__init__.py new file mode 100644 index 0000000000000..46b7376756ec6 --- /dev/null +++ b/airbyte-integrations/connectors/source-github/unit_tests/__init__.py @@ -0,0 +1,3 @@ +# +# Copyright (c) 2021 Airbyte, Inc., all rights reserved. +# From 28b102b1f588244c8527ccef10b32d994f631fa4 Mon Sep 17 00:00:00 2001 From: ykurochkin Date: Fri, 21 Jan 2022 16:05:20 +0200 Subject: [PATCH 3/4] pass --- .../connectors/source-github/unit_tests/__init__.py | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 airbyte-integrations/connectors/source-github/unit_tests/__init__.py diff --git a/airbyte-integrations/connectors/source-github/unit_tests/__init__.py b/airbyte-integrations/connectors/source-github/unit_tests/__init__.py deleted file mode 100644 index 46b7376756ec6..0000000000000 --- a/airbyte-integrations/connectors/source-github/unit_tests/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -# Copyright (c) 2021 Airbyte, Inc., all rights reserved. -# From f5d89ac06001bbae0132239b512dca8fda9a8094 Mon Sep 17 00:00:00 2001 From: ykurochkin Date: Fri, 21 Jan 2022 16:17:48 +0200 Subject: [PATCH 4/4] add init file for github tests --- .../connectors/source-github/unit_tests/__init__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 airbyte-integrations/connectors/source-github/unit_tests/__init__.py diff --git a/airbyte-integrations/connectors/source-github/unit_tests/__init__.py b/airbyte-integrations/connectors/source-github/unit_tests/__init__.py new file mode 100644 index 0000000000000..46b7376756ec6 --- /dev/null +++ b/airbyte-integrations/connectors/source-github/unit_tests/__init__.py @@ -0,0 +1,3 @@ +# +# Copyright (c) 2021 Airbyte, Inc., all rights reserved. +#