| 1 |
name: ci-pipeline |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: [ master ] |
| 5 |
pull_request: |
| 6 |
branches: [ master ] |
| 7 |
jobs: |
| 8 |
ci: |
| 9 |
strategy: |
| 10 |
fail-fast: false |
| 11 |
matrix: |
| 12 |
go-version: ['1.25', '1.26'] |
| 13 |
runs-on: ubuntu-latest |
| 14 |
steps: |
| 15 |
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6.0.0 |
| 16 |
- name: Set up Go |
| 17 |
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v6.0.0 |
| 18 |
with: |
| 19 |
go-version: ${{ matrix.go-version }} |
| 20 |
- name: Build |
| 21 |
run: | |
| 22 |
go mod tidy && git diff --exit-code |
| 23 |
go build ./cmd/... ./pkg/... |
| 24 |
- name: Format |
| 25 |
run: | |
| 26 |
diff=$(gofmt -s -d .) |
| 27 |
if [[ -n "${diff}" ]]; then echo "${diff}"; exit 1; fi |
| 28 |
- name: Test |
| 29 |
run: | |
| 30 |
go test -race ./cmd/... ./pkg/... |
| 31 |
- name: Run integration tests |
| 32 |
run: | |
| 33 |
cd test/integration |
| 34 |
go mod tidy && git diff --exit-code |
| 35 |
go test ./... |
| 36 |
# We set the maximum version of the go directive here according to |
| 37 |
# the oldest Go toolchain (.go-version) in use on our supported |
| 38 |
# release branches in k/k. |
| 39 |
- name: Run verify scripts |
| 40 |
run: | |
| 41 |
./hack/verify-go-directive.sh 1.25.0 |
| 42 |
ci-go-tip: |
| 43 |
# Informational lane that exercises the vendored encoding/json/v2 shim |
| 44 |
# against Go tip so upstream changes (e.g. graduating JSONv2 to baseline) |
| 45 |
# surface here rather than in kubernetes/kubernetes CI. |
| 46 |
runs-on: ubuntu-latest |
| 47 |
continue-on-error: true |
| 48 |
steps: |
| 49 |
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6.0.0 |
| 50 |
- name: Set up Go stable |
| 51 |
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v6.0.0 |
| 52 |
with: |
| 53 |
go-version: 'stable' |
| 54 |
- name: Install gotip |
| 55 |
run: | |
| 56 |
go install golang.org/dl/gotip@latest |
| 57 |
gotip download |
| 58 |
- name: Build with gotip (default GOEXPERIMENT) |
| 59 |
run: | |
| 60 |
gotip build ./cmd/... ./pkg/... |
| 61 |
- name: Test with gotip (default GOEXPERIMENT) |
| 62 |
run: | |
| 63 |
gotip test -race ./cmd/... ./pkg/... |
| 64 |
required: |
| 65 |
# The name of the ci jobs above change based on the golang version. |
| 66 |
# Use this as a stable required job that depends on the above jobs. |
| 67 |
# ref: https://github.com/kubernetes/test-infra/pull/27016 |
| 68 |
needs: ci |
| 69 |
runs-on: ubuntu-latest |
| 70 |
steps: |
| 71 |
- run: echo "Required jobs success!" |