Skip to content

Commit

Permalink
Move more tests to nox
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick91 committed Jul 8, 2023
1 parent abe72ba commit 639e4df
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 80 deletions.
83 changes: 3 additions & 80 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ jobs:
~/.cache/pip
~/.nox
.nox
key: ${{ runner.os }}-nox-${{ matrix.session }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/noxfile.py') }}
key:
${{ runner.os }}-nox-${{ matrix.session }}-${{
hashFiles('**/poetry.lock') }}-${{ hashFiles('**/noxfile.py') }}
restore-keys: |
${{ runner.os }}-nox-${{ matrix.session }}-
${{ runner.os }}-nox-
Expand Down Expand Up @@ -93,82 +95,3 @@ jobs:
token: c0eec83c-17c8-4e8a-adf9-a34e4c22ef6a
fail_ci_if_error: true
verbose: true

starlette-unit-tests:
strategy:
matrix:
starlette: ["0.23.1", "0.24.0", "0.25.0", "0.26.1"]

name: Starlette ${{ matrix.starlette }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- run: pipx install poetry
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: "3.10"
cache: "poetry"

- run: poetry env use python3.10
- run: poetry install
if: steps.setup-python.outputs.cache-hit != 'true'

- name: Install starlette ${{ matrix.starlette }}
run: poetry run pip install starlette==${{ matrix.starlette }}

- name: Install fastapi less than 0.92.0
run: poetry run pip install "fastapi<0.92.0"
if: ${{ matrix.starlette == '0.23.1' || matrix.starlette == '0.24.0' }}

- name: Install fastapi 0.92.0
run: poetry run pip install "fastapi==0.92.0"
if: ${{ matrix.starlette == '0.25.0' }}

- name: pytest
run:
poetry run pytest --cov=strawberry --cov-append --cov-report=xml -n
auto --showlocals -vv -m starlette

if: ${{ always() }}
- uses: codecov/codecov-action@v3
if: ${{ always() }}
with:
token: c0eec83c-17c8-4e8a-adf9-a34e4c22ef6a
fail_ci_if_error: true
verbose: true

starlite-unit-tests:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- run: pipx install poetry
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"

- run: poetry env use ${{ matrix.python-version }}
- run: poetry install
if: steps.setup-python.outputs.cache-hit != 'true'

- name: pytest
run: poetry run coverage run -m pytest --showlocals -vv -m starlite

- name: coverage xml
run: poetry run coverage xml -i
if: ${{ always() }}
- uses: codecov/codecov-action@v3
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
39 changes: 39 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,42 @@ def test_django(session: Session, django: str) -> None:
"-m",
"django",
)


@session(python=["3.11"])
@nox.parametrize("starlette", ["0.28.0", "0.27.0", "0.26.1"])
def test_starlette(session: Session, starlette: str) -> None:
session.run_always("poetry", "install", external=True)

session._session.install(f"starlette=={starlette}") # type: ignore

session.run(
"pytest",
"--cov=strawberry",
"--cov-append",
"--cov-report=xml",
"-n",
"auto",
"--showlocals",
"-vv",
"-m",
"starlette",
)


@session(python=["3.11"])
def test_litestar(session: Session) -> None:
session.run_always("poetry", "install", external=True)

session.run(
"pytest",
"--cov=strawberry",
"--cov-append",
"--cov-report=xml",
"-n",
"auto",
"--showlocals",
"-vv",
"-m",
"starlite",
)

0 comments on commit 639e4df

Please sign in to comment.