From 4700b44909e4c2d965f3bba370072ed8b4730bbf Mon Sep 17 00:00:00 2001 From: crusaderky Date: Tue, 8 Jul 2025 15:33:07 +0100 Subject: [PATCH 1/2] Smoke test --- .github/workflows/pytest.yml | 7 +++++-- .github/workflows/wheels.yml | 8 +++++--- TEMPLATE/__init__.py | 2 +- pyproject.toml | 19 ++++++++++++------- smoke_test.py | 10 ++++++++++ 5 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 smoke_test.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 05610ab..71a6666 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -10,7 +10,7 @@ on: # When this workflow is queued, automatically cancel any previous running # or pending jobs from the same branch concurrency: - group: tests-${{ github.ref }} + group: pytest-${{ github.ref }} cancel-in-progress: true defaults: @@ -18,7 +18,7 @@ defaults: shell: bash -l {0} jobs: - build: + test: name: ${{ matrix.os }} ${{ matrix.environment }} runs-on: ${{ matrix.os }} strategy: @@ -57,6 +57,9 @@ jobs: cache: ${{ matrix.environment != 'upstream' }} locked: ${{ matrix.environment != 'upstream' }} + - name: Smoke test + run: pixi run -e ${{ matrix.environment }} smoke-test + - name: pytest with coverage if: matrix.environment != 'nogil' run: pixi run -e ${{ matrix.environment }} coverage diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e827e0f..6dde413 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -37,9 +37,11 @@ jobs: - name: Install wheel run: pip install dist/*.whl - - name: Test import - working-directory: / - run: python -c "import TEMPLATE; print(TEMPLATE.__version__)" + - name: Smoke test + working-directory: /tmp + run: | + cp ${{ github.workspace }}/smoke_test.py . + python smoke_test.py - uses: actions/upload-artifact@v4 with: diff --git a/TEMPLATE/__init__.py b/TEMPLATE/__init__.py index be01012..d2bd1f0 100644 --- a/TEMPLATE/__init__.py +++ b/TEMPLATE/__init__.py @@ -7,7 +7,7 @@ __version__ = importlib.metadata.version("TEMPLATE") except importlib.metadata.PackageNotFoundError: # pragma: nocover # Local copy, not installed with pip - __version__ = "999" + __version__ = "9999" __all__ = ("__version__", "hello") diff --git a/pyproject.toml b/pyproject.toml index 16e4c2c..74ecdb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -177,6 +177,9 @@ sphinx-lint = "*" install-git-hooks = { cmd = "lefthook install", description = "Install pre-commit hooks" } lint = { cmd = "lefthook run pre-commit --all-files --force", description = "Run all linters" } +[tool.pixi.feature.smoke.tasks] +smoke-test = { cmd = "python smoke_test.py", description = "Test import the library and print essential information" } + [tool.pixi.feature.tests.dependencies] pytest = "*" pytest-cov = "*" @@ -217,8 +220,10 @@ pytest-run-parallel = "*" python = "=3.11" # TODO repeat dependencies here, but use = instead of >= +[tool.pixi.feature.upstream.dependencies] +python = "=3.13" # TODO python 3.14 prereleases? + [tool.pixi.feature.upstream.pypi-dependencies] -# TODO python 3.14 prereleases? # TODO uncomment relevant dependencies # numpy = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" } # pandas = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" } @@ -239,12 +244,12 @@ twine-upload = { depends-on = ["dist"], cmd = "python -m twine upload dist/*" } [tool.pixi.environments] # FIXME use same solve-groups with and without numba -default = { features = ["py313", "docs", "tests", "ipython"], solve-group = "py313" } +default = { features = ["py313", "docs", "smoke", "tests", "ipython"], solve-group = "py313" } dist = { features = ["dist"], no-default-feature = true } lint = { features = ["lint"], no-default-feature = true } docs = { features = ["py313", "docs"], solve-group = "py313" } -mindeps = { features = ["mindeps", "tests"] } -py311 = { features = ["py311", "tests"] } -py313 = { features = ["py313", "tests"], solve-group = "py313" } -nogil = { features = ["nogil", "tests"] } -upstream = { features = ["py313", "upstream", "tests"], no-default-feature = true } +mindeps = { features = ["mindeps", "smoke", "tests"] } +py311 = { features = ["py311", "smoke", "tests"] } +py313 = { features = ["py313", "smoke", "tests"], solve-group = "py313" } +nogil = { features = ["nogil", "smoke", "tests"], no-default-feature = true } +upstream = { features = ["upstream", "smoke", "tests"], no-default-feature = true } diff --git a/smoke_test.py b/smoke_test.py new file mode 100644 index 0000000..bd924a9 --- /dev/null +++ b/smoke_test.py @@ -0,0 +1,10 @@ +"""Test import the library and print essential information""" + +import sys + +import TEMPLATE + +print("Python interpreter:", sys.executable) +print("Python version :", sys.version) +print("Library path :", TEMPLATE.__file__) +print("Library version :", TEMPLATE.__version__) From 7f5dbc55fb665429601dd482d49fa47a6e8180f1 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Tue, 8 Jul 2025 15:34:30 +0100 Subject: [PATCH 2/2] Remove pointless scm version from docs workflow --- .github/workflows/docs.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6e4c724..3864e66 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,9 +16,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch full git history for setuptools_scm - fetch-tags: true # Fetch tags for setuptools_scm - uses: prefix-dev/setup-pixi@v0.8.10 with: