diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bc676bb..a84ca91 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,6 +9,14 @@ updates: schedule: interval: "daily" + # For `ci/latest/requirements.txt`, used in unit-test-latest.yml + - package-ecosystem: "pip" + directory: "/ci/latest" + schedule: + interval: "daily" + + # Note: `ci/minimum/requirements.txt` is not updated by Dependabot. + # - package-ecosystem: "github-actions" directory: "/" diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml index 9fc8256..4602166 100644 --- a/.github/workflows/type-check.yml +++ b/.github/workflows/type-check.yml @@ -3,10 +3,10 @@ name: Check static types on: push: branches: - - "**" + - main pull_request: branches: - - "**" + - main jobs: run: diff --git a/.github/workflows/unit-test-latest.yml b/.github/workflows/unit-test-latest.yml new file mode 100644 index 0000000..085b085 --- /dev/null +++ b/.github/workflows/unit-test-latest.yml @@ -0,0 +1,48 @@ +name: Run unit tests with latest dependency versions +# This workflow runs the unit tests with the latest versions of the +# dependencies listed in `pyproject.toml`. The latest versions are specified in +# `ci/latest/requirements.txt`. The `requirements.txt` file is updated by +# Dependabot. + +on: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: unit-test-latest-${{ github.head_ref }} + cancel-in-progress: true + +env: + PYTHONUNBUFFERED: "1" + FORCE_COLOR: "1" + +jobs: + run: + name: Python ${{ matrix.python-version }} on Linux + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install packages + run: | + pip install --upgrade pip + pip install -e '.[tests]' + pip install -r ci/latest/requirements.txt + pip list + + - name: Run tests + run: pytest -vv --cov --cov-report=xml diff --git a/.github/workflows/unit-test-min.yml b/.github/workflows/unit-test-min.yml new file mode 100644 index 0000000..d07d7bf --- /dev/null +++ b/.github/workflows/unit-test-min.yml @@ -0,0 +1,52 @@ +name: Run unit tests with oldest dependency versions +# This workflow runs the unit tests with the oldest versions of the +# dependencies listed in `pyproject.toml`. The oldest versions are specified in +# `ci/minimum/requirements.txt`. The `requirements.txt` file is needs to +# be manually updated to be aligned with `pyproject.toml`. +# +# In the future, `pip` might be able to install the minimum versions in +# `pyproject.toml` directly as disscussed in an open issue: +# https://github.com/pypa/pip/issues/8085 + +on: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: unit-test-min-${{ github.head_ref }} + cancel-in-progress: true + +env: + PYTHONUNBUFFERED: "1" + FORCE_COLOR: "1" + +jobs: + run: + name: Python ${{ matrix.python-version }} on Linux + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install packages + run: | + pip install --upgrade pip + pip install -e '.[tests]' + pip install -r ci/minimum/requirements.txt + pip list + + - name: Run tests + run: pytest -vv --cov --cov-report=xml diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 12c2921..5a032f7 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -3,10 +3,10 @@ name: Run unit tests on: push: branches: - - "**" + - main pull_request: branches: - - "**" + - main concurrency: group: unit-test-${{ github.head_ref }} diff --git a/ci/latest/requirements.txt b/ci/latest/requirements.txt new file mode 100644 index 0000000..7dce3b5 --- /dev/null +++ b/ci/latest/requirements.txt @@ -0,0 +1,10 @@ +# The exact requirements of the latest versions of the dependencies. This file +# is used in a GitHub Actions workflow to test the compatibility with the +# latest versions of the dependencies. This file is monitored by Dependabot. +nextline-graphql==0.7.8 +httpx==0.26.0 +pytest-asyncio==0.23.0 +pytest-cov==4.1.0 +pytest-timeout==2.2.0 +pytest==7.4.0 +respx==0.20.0 diff --git a/ci/minimum/requirements.txt b/ci/minimum/requirements.txt new file mode 100644 index 0000000..de6fc09 --- /dev/null +++ b/ci/minimum/requirements.txt @@ -0,0 +1,11 @@ +# The exact requirements of the oldest supported versions of the dependencies. +# This file is used in a GitHub Actions workflow to test the compatibility. +# This file needs to be manually updated to be consistent with +# `pyproject.toml`. +nextline-graphql==0.7.8 +httpx==0.26.0 +pytest-asyncio==0.23.0 +pytest-cov==4.1.0 +pytest-timeout==2.2.0 +pytest==7.4.0 +respx==0.20.0