@@ -3,20 +3,42 @@ name: CI (build & import)
33on :
44 workflow_dispatch :
55
6+ # Least-privilege token by default
7+ permissions :
8+ contents : read
9+
610jobs :
711 build-smoke :
812 runs-on : ubuntu-latest
13+
914 steps :
10- - uses : actions/checkout@v4
15+ - name : Harden runner
16+ uses : step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
17+ with :
18+ egress-policy : audit
19+
20+ - name : Checkout
21+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
1122
12- - uses : actions/setup-python@v6
23+ - name : Set up Python
24+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
1325 with :
1426 python-version : " 3.12"
1527
28+ # Use pipx to avoid un-hashed pip installs in workflows
29+ - name : Install pipx + build tool (pinned)
30+ run : |
31+ set -euxo pipefail
32+ sudo apt-get update
33+ sudo apt-get install -y pipx
34+ pipx ensurepath
35+ echo "$HOME/.local/bin" >> "$GITHUB_PATH"
36+ # build provides the "pyproject-build" console script
37+ pipx install build==1.2.2
38+
1639 - name : Build wheel
1740 run : |
18- python -m pip install -U pip build setuptools wheel
19- python -m build
41+ pyproject-build -o dist
2042
2143 - name : Inspect wheel has package files
2244 run : |
@@ -30,10 +52,12 @@ jobs:
3052 assert len(names) > 0, "Wheel missing decision_security/*"
3153 PY
3254
33- - name : Install & import smoke
55+ - name : Import smoke from wheel (no install)
3456 run : |
35- python -m pip install dist/*.whl
3657 python - <<'PY'
58+ import glob, sys
59+ whl = glob.glob("dist/*.whl")[0]
60+ sys.path.insert(0, whl) # allow import from wheel zip
3761 from decision_security.synth import sample
3862 print("Smoke OK:", sample("poisson", 5, lam=1.0))
39- PY
63+ PY
0 commit comments