Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 45 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,59 @@ jobs:
run: uv run slotscheck -m advanced_alchemy.config -m advanced_alchemy.repository -m advanced_alchemy.service -m advanced_alchemy.extensions -m advanced_alchemy.base -m advanced_alchemy.types -m advanced_alchemy.operations

test:
name: "test (${{ matrix.python-version }}"
name: "${{ matrix.python-version }} [${{ matrix.pytest-select }}]"
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
pytest-select:
- "not oracle and not pg"
- "pg"
- "oracle"
uses: ./.github/workflows/test.yml
with:
coverage: ${{ matrix.python-version == '3.13' }}
coverage: ${{ matrix.python-version == '3.13'}}
python-version: ${{ matrix.python-version }}
pytest-select: ${{ matrix.pytest-select }}
process_coverage:
name: merge-coverage-files
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: uv python install 3.13

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: coverage-data
pattern: coverage-data-*
merge-multiple: true

- name: Combine coverage files
run: |
uv venv
uv pip install coverage covdefaults
uv run python -m coverage combine coverage-data/
uv run python -m coverage xml -i

- name: Fix coverage file name
run: sed -i "s/home\/runner\/work\/advanced-alchemy\/advanced-alchemy/github\/workspace/g" coverage.xml

- name: Upload fixed coverage file
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml
sonar:
needs:
- test
- validate
- process_coverage
if: github.event.pull_request.head.repo.fork == false && github.repository_owner == 'litestar-org'
runs-on: ubuntu-latest
steps:
Expand All @@ -125,8 +165,7 @@ jobs:

codecov:
needs:
- test
- validate
- process_coverage
runs-on: ubuntu-latest
permissions:
security-events: write
Expand All @@ -143,15 +182,6 @@ jobs:
path: coverage.xml
merge-multiple: true

# - name: Combine coverage files
# run: |
# python -Im pip install coverage covdefaults
# python -Im coverage combine
# python -Im coverage xml -i

# - name: Fix coverage file name
# run: sed -i "s/home\/runner\/work\/advanced-alchemy\/advanced-alchemy/github\/workspace/g" coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
required: false
type: number
default: 60
pytest-select:
required: true
type: string

jobs:
test:
Expand Down Expand Up @@ -61,14 +64,25 @@ jobs:

- name: Test
if: ${{ !inputs.coverage }}
run: uv run pytest --dist "loadgroup" -m "" tests -n 2
run: uv run pytest --dist "loadgroup" -m "" -k "${{ inputs.pytest-select }}" tests -n 2

- name: Test with coverage
if: ${{ inputs.coverage }}
run: uv run pytest tests --dist "loadgroup" -m "" --cov=advanced_alchemy --cov-report=xml -n 2
run: uv run pytest tests --dist "loadgroup" -m "" --cov=advanced_alchemy -k "${{ inputs.pytest-select }}" --cov-report=xml -n 2

- uses: rlespinasse/slugify-value@v1.x
id: slugify-value
if: ${{ inputs.coverage }}
with:
key: pytest_select_slug
value: ${{ inputs.pytest-select }}

- name: Rename coverage file
if: ${{ inputs.coverage }}
run: mv .coverage coverage-data-${{ steps.slugify-value.outputs.slug }}.dat

- uses: actions/upload-artifact@v4
if: ${{ inputs.coverage }}
with:
name: coverage-xml
path: coverage.xml
name: coverage-data-${{ steps.slugify-value.outputs.slug }}
path: coverage-data-${{ steps.slugify-value.outputs.slug }}.dat
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ dev = [
{ include-group = "spanner" },
{ include-group = "cockroachdb" },
{ include-group = "postgres" },
"pytest-cdist>=0.3.1",
]
doc = [
"auto-pytabs[sphinx]>=0.5.0",
Expand Down Expand Up @@ -139,6 +140,7 @@ test = [
"pydantic-extra-types",
"rich-click",
"coverage>=7.6.1",
"covdefaults",
"pytest>=7.4.4",
"pytest-asyncio>=0.23.8",
"pytest-cov>=5.0.0",
Expand Down
30 changes: 30 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading