Skip to content

Agregando coverage

Agregando coverage #2

name: Integration Tests
on:
push:
branches: [ master, test ]
pull_request:
branches: [ master ]
jobs:
integration-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: varios/21/integration
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: testdb
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: varios/21/integration/requirements.txt
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run integration tests with coverage
run: |
pytest --cov=. --cov-report=xml --cov-report=term-missing -v
coverage-badge -o coverage.svg
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
file: ./varios/21/integration/coverage.xml
flags: integration
name: integration-tests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Store coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: varios/21/integration/coverage.xml
- name: Store coverage badge
uses: actions/upload-artifact@v4
with:
name: coverage-badge
path: varios/21/integration/coverage.svg
- name: Commit coverage badge
if: github.ref == 'refs/heads/master'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add coverage.svg
git commit -m "Update coverage badge" || echo "No changes to commit"
git push