|
| 1 | +name: Python Dev Environment Matrix CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + dev-matrix: |
| 14 | + name: Dev Restore & Test (${{ matrix.name }}) |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - name: UV |
| 21 | + manager: uv |
| 22 | + - name: PIP |
| 23 | + manager: pip |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Setup Python 3.14 |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: '3.14' |
| 33 | + |
| 34 | + # ------------------------------------------------------------- |
| 35 | + # 1. Restore do ambiente de desenvolvimento (uv vs pip) |
| 36 | + # ------------------------------------------------------------- |
| 37 | + - name: Setup uv |
| 38 | + if: matrix.manager == 'uv' |
| 39 | + uses: astral-sh/setup-uv@v5 |
| 40 | + with: |
| 41 | + enable-cache: true |
| 42 | + |
| 43 | + - name: Restore Dev Environment (UV) |
| 44 | + if: matrix.manager == 'uv' |
| 45 | + working-directory: source |
| 46 | + run: | |
| 47 | + uv sync --extra dev |
| 48 | +
|
| 49 | + - name: Restore Dev Environment (PIP) |
| 50 | + if: matrix.manager == 'pip' |
| 51 | + working-directory: source |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip |
| 54 | + pip install -e .[dev] |
| 55 | +
|
| 56 | + # ------------------------------------------------------------- |
| 57 | + # 2. Executar testes no ambiente restaurado |
| 58 | + # ------------------------------------------------------------- |
| 59 | + - name: Run Tests (UV) |
| 60 | + if: matrix.manager == 'uv' |
| 61 | + working-directory: source |
| 62 | + run: | |
| 63 | + mkdir -p tests/results |
| 64 | + uv run pytest --cov=src --cov-report=term-missing --cov-report=xml:tests/results/coverage.xml --junitxml=tests/results/pytest.xml |
| 65 | +
|
| 66 | + - name: Run Tests (PIP) |
| 67 | + if: matrix.manager == 'pip' |
| 68 | + working-directory: source |
| 69 | + run: | |
| 70 | + mkdir -p tests/results |
| 71 | + python -m pytest --cov=src --cov-report=term-missing --cov-report=xml:tests/results/coverage.xml --junitxml=tests/results/pytest.xml |
0 commit comments