Fix CI test job by replacing deprecated kubebuilder-tools with setup-envtest #32
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - mercari-master | |
| paths: | |
| - ".github/workflows/go.yaml" | |
| - "**.go" | |
| - "go.mod" | |
| - "go.sum" | |
| pull_request: | |
| paths: | |
| - ".github/workflows/go.yaml" | |
| - "**.go" | |
| - "go.mod" | |
| - "go.sum" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # This will make sure we only apply the concurrency limits on pull requests | |
| # but not pushes to master branch by making the concurrency group name unique | |
| # for pushes | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: false | |
| - name: fmt | |
| run: go fmt ./... | |
| - name: Check diff | |
| run: git diff --exit-code | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: false | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 | |
| with: | |
| only-new-issues: true | |
| version: v2.5.0 | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: false | |
| - name: Generate | |
| run: make generate | |
| - name: Check diff | |
| run: git diff --exit-code | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| - run: make manifests | |
| - name: Check diff | |
| run: git diff --exit-code | |
| - name: Setup envtest | |
| run: | | |
| go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(go list -m -f '{{ .Version }}' sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $2, $3}') | |
| ENVTEST_K8S_VERSION=$(go list -m -f '{{ .Version }}' k8s.io/api | awk -F'[v.]' '{printf "1.%d", $3}') | |
| echo "KUBEBUILDER_ASSETS=$(setup-envtest use ${ENVTEST_K8S_VERSION} -p path)" >> $GITHUB_ENV | |
| - name: Run go tests | |
| run: | | |
| go test -short `go list ./... | grep -v ./test_e2e_arc` |