xfy b5c3c0954f
Some checks failed
CI / Test (push) Failing after 23s
CI / Build (push) Has been skipped
fix: address repository review issues
Security:
- Enforce client_max_body_size in HTTP/2 and HTTP/3 adapters before buffering
- Use trusted-proxy-aware client IP extraction for access control and rate limiting
- Include Host and Vary headers in proxy cache key to prevent cache poisoning
- Harden static file path traversal check with filepath.Clean + prefix validation
- Honor proxy_ssl config for WebSocket upstream TLS

Proxy/handler bugs:
- Decrement WebSocket connection count immediately on return (not deferred in retry loop)
- Remove ineffective headersPool
- Coalesce concurrent background cache refreshes with singleflight

Dev/build:
- Fix Makefile run and test-config targets
- Remove broken wget healthcheck from docker-compose
- Add missing integration build tags
- Fix go vet warnings in tests

CI:
- Run golangci-lint and integration tests in Gitea Actions

Refs: docs/superpowers/plans/2026-06-17-fix-review-issues.md
2026-06-17 11:17:53 +08:00

81 lines
2.2 KiB
YAML

name: CI
on:
push:
branches: [master]
tags: ["v*"]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go and run checks
run: |
export PATH="/usr/local/go/bin:$(go env GOPATH 2>/dev/null || echo /root/go)/bin:$PATH"
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
if ! command -v go &>/dev/null; then
curl -sL "https://mirrors.aliyun.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xzf -
fi
export GOPROXY=https://goproxy.cn,direct
echo "=== Go Version ==="
go version
echo "=== Check Formatting ==="
go install mvdan.cc/gofumpt@latest
output=$(gofumpt -l .)
if [ -n "$output" ]; then
echo "Files need formatting:"
echo "$output"
exit 1
fi
echo "Formatting OK"
echo "=== Go Vet ==="
go vet ./...
echo "Vet OK"
echo "=== Unit Tests ==="
go test -race -count=1 ./internal/...
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
- name: Lint
run: |
export PATH="$(go env GOPATH)/bin:$PATH"
golangci-lint run ./...
- name: Integration Tests
run: go test -race -tags=integration -count=1 ./internal/integration/...
build:
name: Build
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go and build
run: |
export PATH="/usr/local/go/bin:$PATH"
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
if ! command -v go &>/dev/null; then
curl -sL "https://mirrors.aliyun.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xzf -
fi
export GOPROXY=https://goproxy.cn,direct
make build
./bin/lolly --help