- ps-client: the service's client side, moved out of proxy-ctl: calls, configuration edits against the revision read (retried on a concurrent change), log following, and the edits themselves as functions on the configuration (outbounds, subscriptions, rules, zapret, tg-ws-proxy), now unit-tested. proxy-ctl does what it did, through it; a refused log follow is now an error instead of nothing. - ps-gui: proxy-suite, the desktop app on GPUI (gpui-kit 0.8.1); only a first window yet. Not in default-members: plain cargo build/test and the release workflow's tests leave GPUI out. - tools/gui-shot.sh: runs the app on Xvfb with Mesa's software Vulkan and screenshots it, to check the GUI on Linux without a display. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
162 lines
6.6 KiB
YAML
162 lines
6.6 KiB
YAML
name: Windows release
|
|
|
|
# The Windows port (windows/). On a tag windows-v<version> it builds the release zip and
|
|
# publishes it as a Gitea release, with the notes in windows/release-notes/<version>.md. Run
|
|
# by hand, it only builds: the zip is the run's artifact.
|
|
#
|
|
# Two jobs, as upstream's dependency updates: the one that runs fetched code (crates,
|
|
# components, wheels, the Nix closure) holds no token that can write. Only the publishing job
|
|
# sees RELEASE_TOKEN (write:repository), and it runs nothing it fetched: curl and jq on the
|
|
# first job's artifact. Gitea ignores `permissions:`; they are here to say what each job needs.
|
|
on:
|
|
push:
|
|
tags: ["windows-v*"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 150
|
|
env:
|
|
# Single-user Nix without a daemon: the job's container has no init to run one, nor
|
|
# the namespaces a build sandbox needs. Set for the job, so the installer has it too.
|
|
NIX_CONFIG: |
|
|
experimental-features = nix-command flakes
|
|
sandbox = false
|
|
build-users-group =
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
# Full history: the flake is windows/ inside this repository, fetched by Nix as git.
|
|
- name: Check out
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Check the version
|
|
working-directory: windows
|
|
run: |
|
|
set -euo pipefail
|
|
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
|
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
[[ "$GITHUB_REF_NAME" == "windows-v$version" ]] ||
|
|
{ echo "::error::the tag is $GITHUB_REF_NAME, but windows/Cargo.toml says $version"; exit 1; }
|
|
[ -f "release-notes/$version.md" ] ||
|
|
{ echo "::error::no windows/release-notes/$version.md"; exit 1; }
|
|
fi
|
|
echo "Proxy Suite for Windows $version"
|
|
|
|
# Pinned: this installer checks the hash of the Nix it downloads, and is checked here.
|
|
- name: Install Nix
|
|
env:
|
|
NIX_VERSION: 2.34.9
|
|
NIX_INSTALL_SHA256: a03ce2e9eaf4ea1560260b9a93e311dbaf589d28fb5c9318f8d9e768ee6339d8
|
|
run: |
|
|
set -euo pipefail
|
|
# The runner may run as root (no sudo in the image) or as a user with sudo.
|
|
as_root() { if [ "$(id -u)" -eq 0 ]; then "$@"; else sudo "$@"; fi; }
|
|
if ! command -v xz >/dev/null 2>&1; then
|
|
as_root apt-get update -qq
|
|
as_root apt-get install -y -qq xz-utils
|
|
fi
|
|
as_root install -d -m 0755 -o "$(id -u)" -g "$(id -g)" /nix
|
|
tmp=$(mktemp -d)
|
|
curl -sSfL -o "$tmp/install" "https://releases.nixos.org/nix/nix-$NIX_VERSION/install"
|
|
echo "$NIX_INSTALL_SHA256 $tmp/install" | sha256sum -c --quiet
|
|
USER=${USER:-$(id -un)} sh "$tmp/install" --no-daemon --no-modify-profile --no-channel-add
|
|
echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Dev shell and Rust toolchain
|
|
working-directory: windows
|
|
run: nix develop --command rustup toolchain install
|
|
|
|
# The default members: everything the zip carries, not the app (GPUI) yet.
|
|
- name: Test
|
|
working-directory: windows
|
|
run: nix develop --command cargo test --locked
|
|
|
|
- name: Package
|
|
working-directory: windows
|
|
run: nix develop --command tools/package.sh
|
|
|
|
- name: Collect
|
|
working-directory: windows
|
|
run: |
|
|
set -euo pipefail
|
|
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
|
|
mkdir -p ../release
|
|
cp "dist/ProxySuite-$version-windows-x64.zip" "dist/ProxySuite-$version-windows-x64.zip.sha256" ../release/
|
|
if [ -f "release-notes/$version.md" ]; then cp "release-notes/$version.md" ../release/notes.md; fi
|
|
|
|
- name: Upload
|
|
uses: https://github.com/actions/upload-artifact@v4
|
|
with:
|
|
name: windows-release
|
|
path: release/
|
|
if-no-files-found: error
|
|
|
|
publish:
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/windows-v')
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
permissions:
|
|
contents: write
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Download
|
|
uses: https://github.com/actions/download-artifact@v4
|
|
with:
|
|
name: windows-release
|
|
path: release
|
|
|
|
# The release for the tag, made if it is not there yet (a pre-release for a version with
|
|
# a "-"), and its assets, replacing any of the same name, so a rerun is harmless.
|
|
- name: Publish
|
|
env:
|
|
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
TAG: ${{ github.ref_name }}
|
|
SHA: ${{ github.sha }}
|
|
run: |
|
|
set -euo pipefail
|
|
as_root() { if [ "$(id -u)" -eq 0 ]; then "$@"; else sudo "$@"; fi; }
|
|
if ! command -v jq >/dev/null 2>&1; then
|
|
as_root apt-get update -qq
|
|
as_root apt-get install -y -qq jq
|
|
fi
|
|
[ -n "$TOKEN" ] || { echo "::error::the RELEASE_TOKEN secret is not set"; exit 1; }
|
|
api() { curl -sS --fail-with-body -H "Authorization: token $TOKEN" "$@"; }
|
|
version=${TAG#windows-v}
|
|
|
|
code=$(curl -sS -o found.json -w '%{http_code}' -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG")
|
|
case $code in
|
|
200) id=$(jq -r .id found.json) ;;
|
|
404)
|
|
pre=false
|
|
[[ "$version" == *-* ]] && pre=true
|
|
id=$(jq -n --arg tag "$TAG" --arg sha "$SHA" --arg name "Proxy Suite for Windows $version" \
|
|
--rawfile body release/notes.md --argjson pre "$pre" \
|
|
'{tag_name: $tag, target_commitish: $sha, name: $name, body: $body, prerelease: $pre, draft: false}' |
|
|
api -H 'Content-Type: application/json' --data-binary @- "$API/releases" | jq -r .id)
|
|
echo "made the release for $TAG" ;;
|
|
*) echo "::error::looking up the release for $TAG: HTTP $code: $(cat found.json)"; exit 1 ;;
|
|
esac
|
|
|
|
for f in release/*.zip release/*.sha256; do
|
|
name=$(basename "$f")
|
|
for old in $(api "$API/releases/$id/assets" | jq -r --arg n "$name" '.[] | select(.name == $n) | .id'); do
|
|
api -X DELETE "$API/releases/$id/assets/$old" >/dev/null
|
|
done
|
|
api -F "attachment=@$f" "$API/releases/$id/assets?name=$name" >/dev/null
|
|
echo "uploaded $name"
|
|
done
|
|
echo "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$TAG"
|