diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae61bcf..eac073a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,39 +5,29 @@ on: push: branches: - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: test: + name: Test supported Python versions runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] - fail-fast: false - defaults: run: shell: bash - steps: - uses: actions/checkout@v5 - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/cache@v5 - id: cache + - name: Set up uv + uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7 with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test - - name: Install Flit - if: steps.cache.outputs.cache-hit != 'true' - run: bash dev/setup.sh -# - name: Lint -# run: | -# pre-commit run --all-files - - name: Run tests - run: bash dev/test_python.sh - - name: Test installation + enable-cache: true + - name: Run compatibility tests + run: uv run --with "nox[uv]==2026.7.11" bash dev/test_all.sh + - name: Test installation on primary Python run: | - pip install -e . - python -c 'import lightdash_client; print(lightdash_client.__version__)' + uv venv --python 3.12 + uv pip install -e . + uv run python -c 'import lightdash_client; print(lightdash_client.__version__)' diff --git a/Makefile b/Makefile index c47033d..c29b89c 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,13 @@ lint: test: bash ./dev/test_python.sh +# Run the complete supported-Python suite through the same entrypoint as CI. +.PHONY: test-all +test-all: + uv run --with "nox[uv]==2026.7.11" bash ./dev/test_all.sh + # Build the package -build: clean lint test +build: clean lint test-all flit build clean: diff --git a/dev/test_all.sh b/dev/test_all.sh new file mode 100644 index 0000000..6e42f98 --- /dev/null +++ b/dev/test_all.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(dirname "${SCRIPT_DIR}")" +cd "${REPO_ROOT}" + +exec nox --tags ci "$@" diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..9022795 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,19 @@ +"""Nox sessions for supported Python versions.""" + +from __future__ import annotations + +import nox + +PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"] + +nox.options.default_venv_backend = "uv" +nox.options.download_python = "auto" +nox.options.reuse_venv = "yes" + + +@nox.session(python=PYTHON_VERSIONS, tags=["ci"]) +def tests(session: nox.Session) -> None: + """Run the Flit-based test suite in an isolated uv-backed environment.""" + session.install("pip", "flit==3.9.0") + session.run("flit", "install", "--deps", "develop", "--symlink") + session.run("bash", "dev/test_python.sh", external=True)