|
| 1 | +name: bughunt uv global apply probe |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: ['bughunt/uv/**'] |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | +jobs: |
| 8 | + probe: |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + matrix: |
| 12 | + include: |
| 13 | + - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, ext: tar.gz } |
| 14 | + - { os: macos-latest, target: aarch64-apple-darwin, ext: tar.gz } |
| 15 | + - { os: windows-latest, target: x86_64-pc-windows-msvc, ext: zip } |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + timeout-minutes: 45 |
| 18 | + defaults: |
| 19 | + run: |
| 20 | + shell: bash |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 23 | + with: |
| 24 | + persist-credentials: false |
| 25 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 26 | + with: |
| 27 | + python-version: '3.12' |
| 28 | + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 |
| 29 | + with: |
| 30 | + key: bughunt-uv |
| 31 | + save-if: false |
| 32 | + - run: cargo build --release -p socket-patch-cli |
| 33 | + - name: probe |
| 34 | + env: |
| 35 | + TARGET: ${{ matrix.target }} |
| 36 | + EXT: ${{ matrix.ext }} |
| 37 | + run: | |
| 38 | + - name: probe |
| 39 | + env: |
| 40 | + TARGET: ${{ matrix.target }} |
| 41 | + EXT: ${{ matrix.ext }} |
| 42 | + run: | |
| 43 | + set -u |
| 44 | + W="$RUNNER_TEMP/w"; mkdir -p "$W" |
| 45 | + SP="$PWD/target/release/socket-patch" |
| 46 | + PY="$(python -c 'import sys;print(sys.executable)')" |
| 47 | + UUID=725a5343-52ec-4290-b7ce-e1cec55878e1 |
| 48 | + unset SOCKET_API_TOKEN || true |
| 49 | + for V in 0.5.31 0.9.5; do |
| 50 | + D="$W/uv-$V"; mkdir -p "$D" |
| 51 | + curl -sSLf -o "$D/uv.$EXT" "https://github.com/astral-sh/uv/releases/download/$V/uv-$TARGET.$EXT" |
| 52 | + if [ "$EXT" = zip ]; then (cd "$D" && unzip -q -o uv.zip); else tar -xzf "$D/uv.$EXT" -C "$D"; fi |
| 53 | + UV="$(find "$D" -type f \( -name uv -o -name uv.exe \) | head -1)" |
| 54 | + for lane in default custom; do |
| 55 | + echo "::group::uv $V lane $lane" |
| 56 | + if [ "$lane" = custom ]; then export UV_TOOL_DIR="$W/custom tools $V"; export UV_TOOL_BIN_DIR="$W/cbin-$V"; else unset UV_TOOL_DIR UV_TOOL_BIN_DIR || true; fi |
| 57 | + TD="$("$UV" tool dir)"; echo "uv tool dir: $TD" |
| 58 | + "$UV" tool uninstall pycowsay >/dev/null 2>&1 || true |
| 59 | + "$UV" tool install --python "$PY" --with pydantic-ai==0.0.36 pycowsay > "$W/inst.log" 2>&1 || { echo "install failed"; tail -5 "$W/inst.log"; } |
| 60 | + PKG="$(find "$TD" -type d -name pydantic_ai -path '*site-packages*' | head -1)" |
| 61 | + echo "pydantic_ai at: $PKG" |
| 62 | + rm -rf "$W/before" && cp -R "$PKG" "$W/before" |
| 63 | + P="$W/proj-$V-$lane"; rm -rf "$P"; mkdir -p "$P"; cd "$P" |
| 64 | + "$SP" scan -g --ecosystems pypi --json > s.json 2>s.err; echo "scan -g exit $?" |
| 65 | + python -c "import json;d=json.load(open('s.json'));print('scan -g packages with patches:',[p['purl'] for p in d.get('packages',[]) if 'pydantic-ai@' in p['purl']])" |
| 66 | + "$SP" get "$UUID" -g --json > g.json 2>g.err; rc=$? |
| 67 | + python -c "import json;d=json.load(open('g.json'));print('get -g status:',d.get('status'),'applied:',d.get('applied'),'found:',d.get('found'))" 2>/dev/null || { echo "get json:"; head -c 800 g.json; head -5 g.err; } |
| 68 | + echo "get -g exit $rc; files changed vs pristine: $(diff -rq "$W/before" "$PKG" | wc -l)" |
| 69 | + "$SP" vex -g --json > v.json 2>v.err; echo "vex -g exit $?; statements: $(python -c "import json;d=json.load(open('v.json'));print(len(d.get('statements',d.get('vex',{}).get('statements',[]))))" 2>/dev/null)" |
| 70 | + "$SP" rollback -g --json > r.json 2>r.err; echo "rollback -g exit $?; diff after rollback: $(diff -rq "$W/before" "$PKG" | wc -l)" |
| 71 | + echo "RESULT os=$RUNNER_OS uv=$V lane=$lane get_rc=$rc" |
| 72 | + cd "$GITHUB_WORKSPACE" |
| 73 | + "$UV" tool uninstall pycowsay >/dev/null 2>&1 || true |
| 74 | + echo "::endgroup::" |
| 75 | + done |
| 76 | + done |
| 77 | + - name: root-owned prefix (linux) |
| 78 | + if: runner.os == 'Linux' |
| 79 | + run: | |
| 80 | + set -u |
| 81 | + SP="$PWD/target/release/socket-patch"; unset SOCKET_API_TOKEN || true |
| 82 | + G=/opt/rootprefix |
| 83 | + sudo mkdir -p $G && sudo "$(command -v python)" -m pip install -q --target $G pydantic-ai==0.0.36 >/dev/null 2>&1; sudo chmod -R a-w,a+rX $G |
| 84 | + mkdir -p "$RUNNER_TEMP/rp" && cd "$RUNNER_TEMP/rp" |
| 85 | + "$SP" get 725a5343-52ec-4290-b7ce-e1cec55878e1 -g --global-prefix $G --json > g.json 2>g.err; echo "get root-owned exit $?"; head -c 1500 g.json; echo; head -5 g.err |
0 commit comments