From 91ab2bf3ea9ee7ef455fd9062f1895c900ea00f6 Mon Sep 17 00:00:00 2001 From: Jongbin Jung Date: Sat, 5 Oct 2024 14:00:48 -0700 Subject: [PATCH] Use local lcov for PRs and codecov for push to master (#413) --- .github/workflows/coverage-lint-pr.yml | 45 ++++++++++++++++++++++++++ .github/workflows/coverage-lint.yml | 2 -- .gitignore | 1 + 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/coverage-lint-pr.yml diff --git a/.github/workflows/coverage-lint-pr.yml b/.github/workflows/coverage-lint-pr.yml new file mode 100644 index 00000000..eb689e30 --- /dev/null +++ b/.github/workflows/coverage-lint-pr.yml @@ -0,0 +1,45 @@ +name: pr-coverage-lint + +on: + pull_request: + branches: ['*'] + +jobs: + tests: + name: Coverage and Lint + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4.1.1 + with: + submodules: recursive + + - uses: actions/setup-python@v5.0.0 + with: + python-version: 3.11 + + - name: Install from source + run: | + pip install --upgrade pip setuptools wheel + pip install .[test] + + - name: Lint + run: flake8 src/h3 tests + + - name: Pylint + # As a test for visibility of API bindings, we want to ensure that pylint has no + # `import-error` warnings for h3 imports. + run: pylint --disable=all --enable=import-error tests/ + + - name: Coverage + run: | + pip install cython + cythonize tests/test_cython/cython_example.pyx + pytest --cov-report=lcov + + - name: Report coverage + uses: romeovs/lcov-reporter-action@v0.3.1 + with: + filter-changed-files: true + github-token: ${{ secrets.GITHUB_TOKEN }} + lcov-file: ./coverage.lcov diff --git a/.github/workflows/coverage-lint.yml b/.github/workflows/coverage-lint.yml index 08021693..72ef8ead 100644 --- a/.github/workflows/coverage-lint.yml +++ b/.github/workflows/coverage-lint.yml @@ -3,8 +3,6 @@ name: coverage-lint on: push: branches: [master] - pull_request: - branches: ['*'] jobs: tests: diff --git a/.gitignore b/.gitignore index 8b6903ba..2f658733 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ pip-log.txt # Unit test / coverage reports .coverage coverage.xml +coverage.lcov .tox nosetests.xml .noseids