Repository navigation
Bump astral-sh/setup-uv from 10.2.0 to 10.3.0 #97
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 | |
| # O "uv sync --locked" de cada job já instala tudo a partir do uv.lock; com | |
| # UV_NO_SYNC, os "uv run" seguintes usam esse ambiente sem tentar ajustá-lo. | |
| env: | |
| UV_NO_SYNC: '1' | |
| jobs: | |
| # Checagens que não dependem da API pública: tipos, lint, formatação, | |
| # dependências vulneráveis e testes unitários (com requests-mock, sem rede). | |
| # Rodam em segundos e, se falharem, a integração nem chega a rodar. | |
| unit: | |
| 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: Instalar uv e Python | |
| uses: astral-sh/setup-uv@v10.3.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| # --locked: instala exatamente o que está no uv.lock e falha se o lock | |
| # estiver desatualizado em relação ao pyproject.toml. | |
| - name: Instalar dependências | |
| run: uv sync --locked --extra dev | |
| - name: Checar tipos | |
| run: uv run mypy . | |
| - name: Lint | |
| run: uv run ruff check . | |
| - name: Verificar formatação | |
| run: uv run ruff format --check . | |
| - name: Auditar dependências | |
| run: uv run pip-audit --skip-editable | |
| - name: Rodar testes unitários | |
| run: uv run pytest tests/unit --no-cov | |
| # Suíte completa contra a restful-booker. Roda também os unitários de novo | |
| # (custam milissegundos) para que o relatório e a cobertura continuem | |
| # cobrindo o projeto inteiro. Uma falha aqui com o job unit verde indica | |
| # problema na API pública ou num cenário, não no código dos clients. | |
| integration: | |
| needs: unit | |
| 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: Instalar uv e Python | |
| uses: astral-sh/setup-uv@v10.3.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| # --locked: instala exatamente o que está no uv.lock e falha se o lock | |
| # estiver desatualizado em relação ao pyproject.toml. | |
| - name: Instalar dependências | |
| run: uv sync --locked --extra dev | |
| - name: Rodar testes | |
| run: uv 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: integration | |
| 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 |