Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/scripts/smoke_wheel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""Install one wheel in a fresh environment and exercise its CLI and extension."""
from pathlib import Path
import os
import subprocess
import sys
import tempfile
import venv


SMOKE = """
import json
from pathlib import Path
import sys

import nnnotes
from nnnotes import _deck, deckdata

assert Path(nnnotes.__file__).resolve().is_relative_to(Path(sys.prefix).resolve())
assert Path(_deck.__file__).resolve().is_relative_to(Path(sys.prefix).resolve())
info = _deck.info()
data = {
"format": info["dataFormat"],
"master": {name: {"columns": [], "rows": []} for name, _ in deckdata.TABLES},
"charts": [],
}
stats = json.loads(_deck.chart_stats(json.dumps(data), workers=1, aptitude=False))
assert stats["format"] == info["format"]
assert stats["charts"] == []
print(f"nnnotes {nnnotes.__version__}: {info['name']} {info['version']}")
"""


def main(directory: str) -> None:
wheel, = Path(directory).resolve().glob("*.whl")
with tempfile.TemporaryDirectory(prefix="nnnotes-wheel-") as directory:
root = Path(directory)
environment = root / "venv"
venv.EnvBuilder(with_pip=True).create(environment)
scripts = environment / ("Scripts" if os.name == "nt" else "bin")
python = scripts / ("python.exe" if os.name == "nt" else "python")
subprocess.run([python, "-I", "-m", "pip", "install", str(wheel)], cwd=root, check=True)
subprocess.run([python, "-I", "-c", SMOKE], cwd=root, check=True)
subprocess.run([scripts / ("nnnotes.exe" if os.name == "nt" else "nnnotes"), "--help"],
cwd=root, check=True)


if __name__ == "__main__":
main(sys.argv[1])
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ on:
pull_request:
# the Deck model workflow dispatches CI on the pull request it opens
workflow_dispatch:
workflow_call:

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
exit 1
fi

quality:
needs: check
uses: ./.github/workflows/ci.yml

# one abi3 wheel (CPython 3.11 and later) per platform with the extension module nnnotes._deck, and the sdist
wheels:
needs: check
Expand All @@ -50,6 +54,8 @@ jobs:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: --release --locked --out dist
- name: Test the installed wheel
run: python .github/scripts/smoke_wheel.py dist
- uses: actions/upload-artifact@v7
with:
name: wheel-${{ matrix.os }}-${{ matrix.target }}
Expand All @@ -72,7 +78,7 @@ jobs:
if-no-files-found: error

build:
needs: [wheels, sdist]
needs: [quality, wheels, sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
Expand Down
Loading