|
| 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