Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .github/workflows/proxy_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 |
Expand Down
28 changes: 28 additions & 0 deletions scripts/check-version.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
8 changes: 1 addition & 7 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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[*]}"
Expand Down