@@ -87,18 +87,32 @@ jobs:
8787 cache-dependency-glob : " **/pyproject.toml"
8888 cache-suffix : ${{ matrix.uv-resolution }}
8989
90- - name : Run tests with SQLite
91- if : matrix.database == 'sqlite'
92- run : |
93- uv run --all-extras --dev --resolution ${{ matrix.uv-resolution }} -m pytest --sqlalchemy-connect-url="sqlite:///foo.sqlite"
90+ - name : Install the project and dependencies
91+ run : uv sync --all-extras --dev --resolution ${{ matrix.uv-resolution }}
9492
95- - name : Run tests with PostgreSQL
96- if : matrix.database == 'postgres'
93+ - name : Run tests
9794 run : |
98- uv run --all-extras --dev --with psycopg2 --resolution ${{ matrix.uv-resolution }} -m pytest --sqlalchemy-connect-url="postgresql://postgres:postgres@localhost:5432/test_db"
95+ # Install software and run tests
96+ if [ "${{ matrix.database }}" = "postgres" ]; then
97+ export WITH='--with psycopg2-binary'
98+ export DB_URL=postgresql://postgres:postgres@localhost:5432/test_db
99+ elif [ "${{ matrix.database }}" = "mysql" ]; then
100+ export WITH='--with mysqlclient'
101+ # 127.0.0.1 is to persuade mysqlclient to use tcp rather than the domain socket :-/
102+ export DB_URL=mysql://root:mysql@127.0.0.1:3306/test_db
103+ fi
104+ uv run --no-sync $WITH --resolution ${{ matrix.uv-resolution }} -m coverage run -m pytest --sqlalchemy-connect-url=$DB_URL
99105
100- - name : Run tests with MySQL
101- if : matrix.database == 'mysql'
102- # 127.0.0.1 is to persuade mysqlclient to use tcp rather than the domain socket :-/
103- run : |
104- uv run --all-extras --dev --with mysqlclient --resolution ${{ matrix.uv-resolution }} -m pytest --sqlalchemy-connect-url="mysql://root:mysql@127.0.0.1:3306/test_db"
106+ - name : Upload coverage data
107+ uses : actions/upload-artifact@v4
108+ with :
109+ name : coverage-data-${{ matrix.python-version }}-${{ matrix.uv-resolution }}-${{ matrix.database }}
110+ path : .coverage.*
111+ include-hidden-files : true
112+ if-no-files-found : ignore
113+
114+ coverage :
115+ needs : tests
116+ runs-on : ubuntu-latest
117+ steps :
118+ - uses : cjw296/python-action/check-coverage@v1
0 commit comments