From 3e50801f236f4abeb1ce2e0352fb35bd0e9e69ef Mon Sep 17 00:00:00 2001 From: Cursor Date: Sun, 15 Nov 2026 20:23:46 +0000 Subject: [PATCH] Build and check package on pull requests Add integration job steps for sdist/wheel build, twine check, and wheel import. Add version consistency lint via scripts/check-version.sh and update AGENTS.md placeholder guidance. Co-authored-by: ProxyMesh AI --- .github/workflows/proxy_integration_tests.yml | 8 ++++++ AGENTS.md | 3 +- scripts/check-version.sh | 28 +++++++++++++++++++ scripts/lint.sh | 8 +----- 4 files changed, 39 insertions(+), 8 deletions(-) create mode 100755 scripts/check-version.sh diff --git a/.github/workflows/proxy_integration_tests.yml b/.github/workflows/proxy_integration_tests.yml index 2d7b554..34a03d5 100644 --- a/.github/workflows/proxy_integration_tests.yml +++ b/.github/workflows/proxy_integration_tests.yml @@ -68,6 +68,14 @@ jobs: python -m pip install --upgrade pip pip install -e ".[urllib3,requests,httpx,aiohttp,pycurl,cloudscraper,autoscraper]" + - name: Build and check the package + run: | + pip install build twine + python -m build + twine check dist/* + pip install --no-deps --force-reinstall dist/*.whl + cd "${RUNNER_TEMP}" && python -c 'import python_proxy_headers' + - name: Require PROXY_URL Actions secret env: PROXY_URL: ${{ secrets.PROXY_URL }} diff --git a/AGENTS.md b/AGENTS.md index ac1c7e5..234ab9d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,6 +49,8 @@ Read `.cursorrules` too (git identity, PR footer rule). calls. Retries: use the repo's retry library, not hand-rolled loops. - Tests: cover the behavior change, reuse existing test layout and fixtures, no giant harnesses when a focused test works. +- Docs and examples use `proxy.example.com` placeholders; see + https://docs.proxymesh.com/. - Use standard linters and tools instead of writing custom checkers, dev servers or check runners. - Shell scripts follow the Google Shell Style Guide (`main`, `set -euo @@ -76,7 +78,6 @@ Read `.cursorrules` too (git identity, PR footer rule). | Scoped permissions, no dangerous triggers | zizmor in `scripts/lint.sh` | | No `${{ }}` in `run:` | zizmor in `scripts/lint.sh` | | Shell scripts pass shellcheck and shfmt | `scripts/lint.sh` (style: review) | -| No real ProxyMesh proxy hostnames | hostname grep in `scripts/lint.sh` | | Python passes ruff | `ruff check` in `scripts/lint.sh` | | Imports at module top, no print | review (PLC0415, T201 planned) | | Actions pinned to full SHAs | zizmor; SHA comment: review | diff --git a/scripts/check-version.sh b/scripts/check-version.sh new file mode 100755 index 0000000..d6f7541 --- /dev/null +++ b/scripts/check-version.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Check that pyproject.toml and docs/conf.py carry the same version, and that +# a release/X.Y.Z branch carries version X.Y.Z. scripts/lint.sh runs this; +# on pull requests the branch comes from GITHUB_HEAD_REF. + +set -euo pipefail + +err() { + echo "$*" >&2 +} + +main() { + cd "$(git rev-parse --show-toplevel)" + local version docs branch + version="$(sed -nE 's/^version = "([^"]+)"$/\1/p' pyproject.toml)" + docs="$(sed -nE "s/^release = '([^']+)'$/\1/p" docs/conf.py)" + branch="${GITHUB_HEAD_REF:-$(git rev-parse --abbrev-ref HEAD)}" + if [[ -z "${version}" || "${docs}" != "${version}" ]]; then + err "pyproject.toml version '${version}' != docs/conf.py release '${docs}'" + exit 1 + fi + if [[ "${branch}" == release/* && "${branch#release/}" != "${version}" ]]; then + err "branch ${branch} != pyproject.toml version ${version}" + exit 1 + fi +} + +main "$@" diff --git a/scripts/lint.sh b/scripts/lint.sh index 6d765df..05a742a 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -17,12 +17,6 @@ check() { "$@" || failed+=("${name}") } -# Fail on real ProxyMesh proxy hosts; docs. and www. are allowed. -check_hostnames() { - ! git grep --untracked -nIoE '[a-z0-9-]+\.proxymesh\.com' | - grep -vE ':(docs|www)\.proxymesh\.com$' -} - main() { export PATH="${HOME}/.local/bin:${PATH}" cd "$(git rev-parse --show-toplevel)" @@ -50,8 +44,8 @@ main() { fi check shellcheck shellcheck "${sh_files[@]}" check shfmt shfmt -d -i 2 -ci "${sh_files[@]}" + check version scripts/check-version.sh check ruff ruff check - check hostnames check_hostnames if ((${#failed[@]} > 0)); then err "lint failed: ${failed[*]}"