Skip to content

Commit 142449b

Browse files
authored
Make package and Docker previews opt-in (#287)
* Make package previews opt-in * Fix Dockerfile smoke build mode * Document contributing and preview workflows * Harden opt-in preview publishing
1 parent ebdc3e4 commit 142449b

8 files changed

Lines changed: 495 additions & 115 deletions

File tree

.github/actions/setup-docker/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ description: >-
55
preview, and stable workflows.
66
77
inputs:
8+
enable-qemu:
9+
description: "Set up QEMU for multi-platform builds"
10+
required: false
11+
default: "true"
812
dockerhub-username:
913
description: "Docker Hub username (pass from secrets)"
1014
required: true
@@ -16,6 +20,7 @@ runs:
1620
using: "composite"
1721
steps:
1822
- uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
23+
if: inputs.enable-qemu == 'true'
1924
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
2025
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
2126
with:

.github/workflows/dependency-review.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,10 @@ jobs:
571571
persist-credentials: false
572572

573573
- name: Build the Dockerfile (no push)
574-
run: docker build --pull -t socket-python-cli:dependabot-smoke .
574+
run: >-
575+
docker build --pull
576+
--build-arg USE_LOCAL_INSTALL=true
577+
-t socket-python-cli:dependabot-smoke .
575578
576579
workflow-notice:
577580
needs: inspect
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Package Check
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: package-check-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
package-check:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
steps:
21+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22+
with:
23+
fetch-depth: 1
24+
persist-credentials: false
25+
26+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
27+
with:
28+
python-version: "3.12"
29+
30+
- name: Install build tooling
31+
uses: ./.github/actions/setup-hatch
32+
33+
- name: Install distribution validator
34+
run: python -m pip install "twine>=4.0.0"
35+
36+
- name: Build distributions
37+
run: hatch build
38+
39+
- name: Validate distributions
40+
run: python -m twine check dist/*
41+
42+
- name: Install and inspect wheel without resolving dependencies
43+
run: |
44+
python -m venv "$RUNNER_TEMP/package-check"
45+
"$RUNNER_TEMP/package-check/bin/pip" install --no-deps dist/*.whl
46+
"$RUNNER_TEMP/package-check/bin/python" - <<'PY'
47+
import compileall
48+
import importlib.metadata
49+
import pathlib
50+
import sysconfig
51+
52+
distribution = importlib.metadata.distribution("socketsecurity")
53+
entry_points = {entry_point.name for entry_point in distribution.entry_points}
54+
assert "socketcli" in entry_points
55+
package = pathlib.Path(sysconfig.get_paths()["purelib"]) / "socketsecurity"
56+
assert compileall.compile_dir(package, quiet=1)
57+
print("wheel metadata and bytecode smoke OK", distribution.version)
58+
PY
59+
60+
- name: Upload distributions
61+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
62+
with:
63+
name: socketsecurity-${{ github.sha }}
64+
path: dist/*
65+
if-no-files-found: error
66+
retention-days: 14

0 commit comments

Comments
 (0)