Skip to content

Commit

Permalink
refactor(ci): refactor gh action (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
whg517 authored Nov 15, 2024
1 parent 9ba74f5 commit ceb391c
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 66 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/ci.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
push:
pull_request:

jobs:
go-lint:
name: Go Lint
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.23'

- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.62
md-lint:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Run markdownlint
uses: DavidAnson/markdownlint-cli2-action@v18
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests

on:
push:
pull_request:

jobs:
go-test:
name: Go Test
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.23'

- name: Running Tests
run: |
go mod tidy
make test
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
run:
timeout: 5m
allow-parallel-runners: true
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test: generate fmt vet envtest ## Run tests.

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
$(GOLANGCI_LINT) run --timeout=5m
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
Expand Down Expand Up @@ -102,9 +102,3 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

0 comments on commit ceb391c

Please sign in to comment.