Fix skip of diff-cover #486
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request_target: | |
branches: [main] | |
jobs: | |
ci-approval: | |
if: ${{ github.event_name == 'pull_request_target' && github.actor != 'dependabot[bot]' }} | |
environment: testing | |
runs-on: ubuntu-latest | |
steps: | |
- name: Log | |
run: echo 'Running tests was approved' | |
ci-pre-commit: | |
needs: [ci-approval] | |
# run this job if it was approved by ci-approval or ci-approval was skipped and we are in a push event | |
# or dependabot created the PR | |
if: ${{ success() || ( needs.ci-approval.result == 'skipped' && ( github.event_name == 'push' || github.actor == 'dependabot[bot]' ) ) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install project | |
run: pip install -e .[dev,test,alembic] | |
- name: run pre-commit | |
run: pre-commit run --all | |
ci-test: | |
needs: [ci-approval] | |
# run this job if we have a PR and it was approved by ci-approval or ci-approval was skipped and dependabot created the PR | |
if: >- | |
${{ | |
github.event_name == 'pull_request_target' && | |
( success() || ( needs.ci-approval.result == 'skipped' && github.actor == 'dependabot[bot]' ) ) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
sqlalchemy-version: [1.4.*, 2.0.*] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install project | |
run: pip install -e .[test,alembic] | |
- name: Install sqlalchemy | |
run: pip install sqlalchemy==${{ matrix.sqlalchemy-version }} | |
- name: run tests (with coverage) | |
run: | | |
PYTEST_DBURI=$(python -m test.ci_setup setup ${{ secrets.TEST_DBURI }}) | |
echo "::add-mask::$PYTEST_DBURI" | |
export PYTEST_ADDOPTS="--dburi $PYTEST_DBURI" | |
pytest -v --cov sqlalchemy_hana --cov-report html --cov-report xml test/ | |
python test/ci_setup.py teardown ${{ secrets.TEST_DBURI }} $PYTEST_DBURI | |
- name: run diff-cover | |
if: ${{ matrix.sqlalchemy-version == '2.0.*' }} | |
run: diff-cover --config-file pyproject.toml coverage.xml |