Added golangci-lint
action
#127
Workflow file for this run
This file contains 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: Tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
args: --timeout=5m | |
version: v1.60 | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Check go modules | |
run: | | |
go mod tidy | |
git --no-pager diff go.mod go.sum | |
test -z "$(git status --porcelain)" | |
- name: Install tools | |
run: | | |
go install github.com/onsi/ginkgo/v2/ginkgo | |
# With Golang 1.22 we need to use the release-0.18 branch | |
go install sigs.k8s.io/controller-runtime/tools/[email protected] | |
ENVTEST_BIN=$(setup-envtest use -p path) | |
sudo mkdir -p /usr/local/kubebuilder/bin | |
sudo cp $ENVTEST_BIN/* /usr/local/kubebuilder/bin | |
- name: Run tests | |
run: ginkgo -v -r --skip-file=tests | |
tests-e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Check go modules | |
run: | | |
go mod tidy | |
git --no-pager diff go.mod go.sum | |
test -z "$(git status --porcelain)" | |
- name: Install Ginkgo | |
run: go install github.com/onsi/ginkgo/v2/ginkgo | |
- name: Build | |
run: ./scripts/build | |
- name: Run tests | |
run: ginkgo -v ./tests | |
- name: Archive k3s logs | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: k3s-logs | |
path: /tmp/k3s.log |