|
37 | 37 | - name: Build |
38 | 38 | run: go build ./... |
39 | 39 |
|
| 40 | + - name: Gateway-only smoke |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + set -euo pipefail |
| 44 | +
|
| 45 | + socket_path="/tmp/neocode-gateway-${RANDOM}.sock" |
| 46 | + http_port="$((18080 + RANDOM % 1000))" |
| 47 | + http_addr="127.0.0.1:${http_port}" |
| 48 | + gateway_bin="/tmp/neocode-gateway" |
| 49 | + gateway_log="/tmp/neocode-gateway.log" |
| 50 | +
|
| 51 | + go build -o "${gateway_bin}" ./cmd/neocode-gateway |
| 52 | + "${gateway_bin}" --listen "${socket_path}" --http-listen "${http_addr}" --log-level info >"${gateway_log}" 2>&1 & |
| 53 | + gateway_pid=$! |
| 54 | +
|
| 55 | + cleanup() { |
| 56 | + if kill -0 "${gateway_pid}" >/dev/null 2>&1; then |
| 57 | + kill "${gateway_pid}" || true |
| 58 | + wait "${gateway_pid}" || true |
| 59 | + fi |
| 60 | + rm -f "${socket_path}" "${gateway_bin}" /tmp/gateway-healthz.json /tmp/gateway-rpc.json |
| 61 | + } |
| 62 | + trap cleanup EXIT |
| 63 | +
|
| 64 | + for _ in $(seq 1 60); do |
| 65 | + if curl -fsS "http://${http_addr}/healthz" > /tmp/gateway-healthz.json; then |
| 66 | + break |
| 67 | + fi |
| 68 | + sleep 0.2 |
| 69 | + done |
| 70 | + test -s /tmp/gateway-healthz.json |
| 71 | +
|
| 72 | + rpc_status="$(curl -sS -o /tmp/gateway-rpc.json -w "%{http_code}" \ |
| 73 | + -X POST "http://${http_addr}/rpc" \ |
| 74 | + -H "Content-Type: application/json" \ |
| 75 | + -d '{"jsonrpc":"2.0","id":"smoke-1","method":"gateway.ping","params":{}}')" |
| 76 | + if [[ "${rpc_status}" != "401" ]]; then |
| 77 | + echo "unexpected /rpc status: ${rpc_status}" >&2 |
| 78 | + cat /tmp/gateway-rpc.json >&2 |
| 79 | + cat "${gateway_log}" >&2 || true |
| 80 | + exit 1 |
| 81 | + fi |
| 82 | + grep -q '"gateway_code":"unauthorized"' /tmp/gateway-rpc.json |
| 83 | +
|
40 | 84 | - name: Test with coverage |
41 | 85 | run: go test ./... -covermode=atomic -coverprofile=coverage.out |
42 | 86 |
|
| 87 | + - name: Install script dry-run regression (bash) |
| 88 | + shell: bash |
| 89 | + env: |
| 90 | + NEOCODE_INSTALL_LATEST_TAG: v0.0.0-test |
| 91 | + run: | |
| 92 | + set -euo pipefail |
| 93 | +
|
| 94 | + full_output="$(bash ./scripts/install.sh --flavor full --dry-run)" |
| 95 | + gateway_output="$(bash ./scripts/install.sh --flavor gateway --dry-run)" |
| 96 | +
|
| 97 | + echo "${full_output}" | grep -Eq '^asset=neocode_(Linux|Darwin)_(x86_64|arm64)\.tar\.gz$' |
| 98 | + echo "${gateway_output}" | grep -Eq '^asset=neocode-gateway_(Linux|Darwin)_(x86_64|arm64)\.tar\.gz$' |
| 99 | + echo "${full_output}" | grep -Eq '^download_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/neocode_(Linux|Darwin)_(x86_64|arm64)\.tar\.gz$' |
| 100 | + echo "${gateway_output}" | grep -Eq '^download_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/neocode-gateway_(Linux|Darwin)_(x86_64|arm64)\.tar\.gz$' |
| 101 | + echo "${full_output}" | grep -Eq '^checksum_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/checksums\.txt$' |
| 102 | + echo "${gateway_output}" | grep -Eq '^checksum_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/checksums\.txt$' |
| 103 | +
|
| 104 | + - name: Install script dry-run regression (PowerShell) |
| 105 | + shell: pwsh |
| 106 | + env: |
| 107 | + NEOCODE_INSTALL_LATEST_TAG: v0.0.0-test |
| 108 | + run: | |
| 109 | + $fullLines = & ./scripts/install.ps1 -Flavor full -DryRun |
| 110 | + $gatewayLines = & ./scripts/install.ps1 -Flavor gateway -DryRun |
| 111 | +
|
| 112 | + $fullAsset = ($fullLines | Where-Object { $_ -like 'asset=*' } | Select-Object -First 1) |
| 113 | + $gatewayAsset = ($gatewayLines | Where-Object { $_ -like 'asset=*' } | Select-Object -First 1) |
| 114 | + $fullDownload = ($fullLines | Where-Object { $_ -like 'download_url=*' } | Select-Object -First 1) |
| 115 | + $gatewayDownload = ($gatewayLines | Where-Object { $_ -like 'download_url=*' } | Select-Object -First 1) |
| 116 | + $fullChecksum = ($fullLines | Where-Object { $_ -like 'checksum_url=*' } | Select-Object -First 1) |
| 117 | + $gatewayChecksum = ($gatewayLines | Where-Object { $_ -like 'checksum_url=*' } | Select-Object -First 1) |
| 118 | +
|
| 119 | + if ($fullAsset -notmatch '^asset=neocode_Windows_(x86_64|arm64)\.zip$') { throw "Unexpected full asset line: $fullAsset" } |
| 120 | + if ($gatewayAsset -notmatch '^asset=neocode-gateway_Windows_(x86_64|arm64)\.zip$') { throw "Unexpected gateway asset line: $gatewayAsset" } |
| 121 | + if ($fullDownload -notmatch '^download_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/neocode_Windows_(x86_64|arm64)\.zip$') { throw "Unexpected full download URL: $fullDownload" } |
| 122 | + if ($gatewayDownload -notmatch '^download_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/neocode-gateway_Windows_(x86_64|arm64)\.zip$') { throw "Unexpected gateway download URL: $gatewayDownload" } |
| 123 | + if ($fullChecksum -notmatch '^checksum_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/checksums\.txt$') { throw "Unexpected full checksum URL: $fullChecksum" } |
| 124 | + if ($gatewayChecksum -notmatch '^checksum_url=https://github.com/1024XEngineer/neo-code/releases/download/.+/checksums\.txt$') { throw "Unexpected gateway checksum URL: $gatewayChecksum" } |
| 125 | +
|
43 | 126 | - name: Upload coverage to Codecov |
44 | 127 | continue-on-error: true |
45 | 128 | uses: codecov/codecov-action@v5 |
|
0 commit comments