Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
117 lines
3.0 KiB
YAML
117 lines
3.0 KiB
YAML
name: Validate Reusable
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
validate-worker:
|
|
name: validate-worker
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
|
|
with:
|
|
bun-version: 1.3.12
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Generate Worker types
|
|
run: bun run cf-typegen
|
|
|
|
- name: Type check
|
|
run: bun run typecheck
|
|
|
|
- name: Run Worker tests
|
|
run: bun run test
|
|
|
|
- name: Check generated Worker types
|
|
run: bun run cf-typegen:check
|
|
|
|
- name: Verify Wrangler dry-run build
|
|
run: bunx wrangler deploy --dry-run
|
|
|
|
validate-oci:
|
|
name: validate-oci
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
|
|
with:
|
|
bun-version: 1.3.12
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Build OCI image
|
|
run: docker build -t paseo-relay:ci .
|
|
|
|
- name: Smoke test OCI image
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
cleanup() {
|
|
status=$?
|
|
if [[ $status -ne 0 ]]; then
|
|
docker logs paseo-relay-ci || true
|
|
fi
|
|
docker rm -f paseo-relay-ci >/dev/null 2>&1 || true
|
|
exit $status
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
docker run -d --name paseo-relay-ci -p 8080:8080 paseo-relay:ci >/dev/null
|
|
|
|
for ((attempt = 1; attempt <= 20; attempt += 1)); do
|
|
status="$(curl --silent --show-error --output health.json --write-out '%{http_code}' http://127.0.0.1:8080/health || true)"
|
|
if [[ "$status" == "200" ]]; then
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
test "${status:-}" = "200"
|
|
grep -q '"status":"ok"' health.json
|
|
|
|
python3 - <<'PY'
|
|
import socket
|
|
|
|
request = (
|
|
"GET /ws?role=server&serverId=smoke&v=2 HTTP/1.1\r\n"
|
|
"Host: 127.0.0.1:8080\r\n"
|
|
"Connection: Upgrade\r\n"
|
|
"Upgrade: websocket\r\n"
|
|
"Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==\r\n"
|
|
"Sec-WebSocket-Version: 13\r\n"
|
|
"\r\n"
|
|
)
|
|
|
|
with socket.create_connection(("127.0.0.1", 8080), timeout=5) as conn:
|
|
conn.sendall(request.encode("ascii"))
|
|
response = conn.recv(4096).decode("latin1", "replace")
|
|
|
|
print(response)
|
|
if not response.startswith("HTTP/1.1 101"):
|
|
raise SystemExit("expected HTTP/1.1 101 Switching Protocols")
|
|
PY
|