perf(ci): pre-install all tools in pre-commit Docker image
- Move Go 1.25.3 installation to Dockerfile - Pre-install protobuf plugins and golangci-lint in image - Set environment variables in Dockerfile - Remove runtime installation steps from pre-commit script - Significantly improves pre-commit check performance
This commit is contained in:
@@ -30,32 +30,10 @@ docker run --rm \
|
||||
-w /workspace \
|
||||
"$IMAGE_NAME:latest" \
|
||||
sh -c "
|
||||
echo '📦 Installing Go 1.25.3 and required tools...'
|
||||
apk add --no-cache protobuf protobuf-dev bash git wget tar make || exit 1
|
||||
|
||||
# Install Go 1.25.3
|
||||
cd /tmp && \
|
||||
wget -q https://go.dev/dl/go1.25.3.linux-amd64.tar.gz && \
|
||||
tar -C /usr/local -xzf go1.25.3.linux-amd64.tar.gz && \
|
||||
rm go1.25.3.linux-amd64.tar.gz || exit 1
|
||||
|
||||
export PATH=/usr/local/go/bin:\$PATH:/root/go/bin
|
||||
export GOROOT=/usr/local/go
|
||||
export GOPATH=/root/go
|
||||
|
||||
echo '📥 Installing Go protobuf plugins...'
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest || exit 1
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest || exit 1
|
||||
|
||||
echo '📥 Installing golangci-lint...'
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /root/go/bin || exit 1
|
||||
|
||||
echo '📋 Running make fmt-check...'
|
||||
cd /workspace && make fmt-check || exit 1
|
||||
make fmt-check || exit 1
|
||||
|
||||
echo '🔍 Running make lint...'
|
||||
export CGO_ENABLED=1
|
||||
export GOFLAGS=-buildvcs=false
|
||||
make lint || exit 1
|
||||
|
||||
echo '🧪 Running make test...'
|
||||
|
||||
Reference in New Issue
Block a user