mirror of
https://github.com/imjasonh/client-go2
synced 2026-07-08 17:16:47 +00:00
Update to use stable Go and add comprehensive CI/CD
- Replace gotip with stable Go in GitHub Actions - Add automatic GVR inference for Kubernetes types - Rename API: NewClient (inferred GVR) and NewClientGVR (explicit) - Add comprehensive test coverage including e2e tests - Update CI to include linting, unit tests, and e2e tests with kind - Add .gitignore for common Go development files - Update README with usage examples and features 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d6bb3cc61c
commit
74aace1a2d
7 changed files with 554 additions and 122 deletions
46
.github/workflows/build.yaml
vendored
46
.github/workflows/build.yaml
vendored
|
|
@ -3,23 +3,47 @@ name: Build
|
|||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.17.x'
|
||||
- uses: engineerd/setup-kind@v0.5.0
|
||||
- run: |
|
||||
go install golang.org/dl/gotip@latest
|
||||
gotip download
|
||||
go-version: 'stable'
|
||||
|
||||
gotip build ./
|
||||
gotip run ./
|
||||
gotip run ./
|
||||
- run: go build ./...
|
||||
- run: go vet ./...
|
||||
|
||||
- run: |
|
||||
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
|
||||
echo "Code is not formatted. Run 'gofmt -s -w .'"
|
||||
gofmt -s -d .
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- run: |
|
||||
go mod tidy
|
||||
git diff --exit-code go.mod go.sum
|
||||
|
||||
- name: Run unit tests
|
||||
run: go test ./... -v -race
|
||||
|
||||
- uses: chainguard-dev/actions/setup-kind@main
|
||||
with:
|
||||
k8s-version: v1.33.0
|
||||
|
||||
- run: |
|
||||
kubectl cluster-info
|
||||
kubectl get nodes
|
||||
|
||||
- name: Run e2e tests
|
||||
run: go test ./... -v -tags=e2e
|
||||
|
||||
- name: Run example
|
||||
run: go run ./main.go
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue