Repository navigation
Roda o CI numa matriz de Python (3.12 e 3.13) #21
Workflow file for this run
This file contains hidden or 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: API Tests | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| schedule: | |
| - cron: '0 6 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.12', '3.13'] | |
| steps: | |
| - name: Checkout código | |
| uses: actions/checkout@v7 | |
| - name: Configurar Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Instalar dependências | |
| run: | | |
| pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Checar tipos | |
| run: mypy . | |
| - name: Lint | |
| run: ruff check . | |
| - name: Verificar formatação | |
| run: ruff format --check . | |
| - name: Auditar dependências | |
| run: pip-audit | |
| - name: Rodar testes | |
| run: pytest | |
| # Cobertura, relatório HTML e Pages só precisam de uma versão do Python | |
| # gerando o artifact — rodar pras duas duplicaria o upload à toa. | |
| - name: Enviar cobertura para o Codecov | |
| if: always() && matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| files: reports/coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| - name: Publicar relatório HTML | |
| if: always() && matrix.python-version == '3.12' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pytest-report | |
| path: reports/report.html | |
| retention-days: 15 | |
| - name: Preparar página do GitHub Pages | |
| if: matrix.python-version == '3.12' && github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| run: | | |
| mkdir -p pages | |
| cp reports/report.html pages/index.html | |
| - name: Empacotar artifact do GitHub Pages | |
| if: matrix.python-version == '3.12' && github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: pages | |
| deploy-pages: | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Publicar no GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |