Skip to content

feat(health): enhance health check functionality with new metrics and… #11

feat(health): enhance health check functionality with new metrics and…

feat(health): enhance health check functionality with new metrics and… #11

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Verify dependencies
run: go mod verify
- name: Vet
run: go vet ./...
- name: Test
run: go test -race -timeout 60s ./...
- name: Build
run: go build -o /dev/null ./cmd
- name: Check examples (config validation only)
run: |
chmod +x hiddify-health 2>/dev/null || true
go build -o hiddify-health ./cmd
for dir in $(find examples -name "*.json" -not -name "run.json" | xargs -I{} dirname {} | sort -u); do
./hiddify-health check "$dir" || exit 1
done
protocol-test:
name: Protocol health gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install sing-box
run: |
SB_VER=1.13.13
curl -fsSL -o sb.tgz \
"https://github.com/SagerNet/sing-box/releases/download/v${SB_VER}/sing-box-${SB_VER}-linux-amd64.tar.gz"
tar -xzf sb.tgz
sudo install "sing-box-${SB_VER}-linux-amd64/sing-box" /usr/local/bin/sing-box
sing-box version
- name: Install xray
run: |
XR_VER=26.3.27
curl -fsSL -o xray.zip \
"https://github.com/XTLS/Xray-core/releases/download/v${XR_VER}/Xray-linux-64.zip"
unzip -o xray.zip xray
sudo install xray /usr/local/bin/xray
xray version | head -1
- name: Build
run: go build -o hiddify-health ./cmd
- name: Run all protocol tests (JSON gate)
env:
SINGBOX_BIN: /usr/local/bin/sing-box
XRAY_CLIENT_PATH: /usr/local/bin/xray
XRAY_SERVER_PATH: /usr/local/bin/xray
run: |
# Warn-only checks (quic/probe/entropy/load/tls-fp) do not fail the run.
# Exit non-zero only on a real connectivity failure.
./hiddify-health run-all examples/ --json | tee result.json
# Fail the job if the report records any failures.
python3 -c "import json,sys; d=json.load(open('result.json')); sys.exit(1 if d['failed'] else 0)"
- name: Generate HTML report
if: always()
run: ./hiddify-health report --html report.html
- name: Upload report artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: health-report
path: |
report.html
result.json
cross-compile:
name: Cross-compile
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: go build -o /dev/null ./cmd