mirror of
https://github.com/lukaszraczylo/kubemirror.git
synced 2026-06-05 22:43:51 +00:00
108 lines
2.2 KiB
YAML
108 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "docs/**"
|
|
- "examples/**"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.25"
|
|
cache: true
|
|
|
|
- name: Go mod tidy
|
|
run: go mod tidy && git diff --exit-code
|
|
|
|
- name: Go mod verify
|
|
run: go mod verify
|
|
|
|
- name: Format check
|
|
run: |
|
|
go fmt ./...
|
|
git diff --exit-code
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
- name: Test
|
|
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
|
|
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
file: ./coverage.out
|
|
flags: unittests
|
|
name: codecov-kubemirror
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.25"
|
|
cache: true
|
|
|
|
- name: Install staticcheck
|
|
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
- name: Install gosec
|
|
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
|
|
|
|
- name: Install deadcode
|
|
run: go install golang.org/x/tools/cmd/deadcode@latest
|
|
|
|
- name: Run staticcheck
|
|
run: staticcheck ./...
|
|
|
|
- name: Run gosec
|
|
run: gosec -exclude=G115 ./...
|
|
|
|
- name: Run deadcode
|
|
run: deadcode ./...
|
|
|
|
bench:
|
|
name: Benchmark
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.25"
|
|
cache: true
|
|
|
|
- name: Run benchmarks
|
|
run: go test -race -bench=. -benchmem ./... | tee benchmark.txt
|
|
|
|
- name: Upload benchmark results
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: benchmark-results
|
|
path: benchmark.txt
|