Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 50 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
kubebuilder-diff:
name: Kubebuilder Diff
runs-on: ubuntu-latest
needs: [changes]
if: |
(needs.changes.outputs.go == 'true') ||
(needs.changes.outputs.make == 'true')
Comment thread
jonstacks marked this conversation as resolved.
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
Expand All @@ -49,19 +53,58 @@ jobs:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [changes]
if: |
(needs.changes.outputs.go == 'true') ||
Comment thread
jonstacks marked this conversation as resolved.
(needs.changes.outputs.make == 'true')
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
- uses: DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
- name: Lint
run: nix develop --command make lint

go-mod-tidy:
name: Go Mod Tidy Check
runs-on: ubuntu-latest
needs:
- changes
if: |
(needs.changes.outputs.go == 'true')
Comment thread
jonstacks marked this conversation as resolved.
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
- uses: DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
- run: go mod tidy
Comment thread
jonstacks marked this conversation as resolved.
Outdated
- run: git diff --exit-code go.mod
- run: git diff --exit-code go.sum

go-fix:
name: Go Fix Check
runs-on: ubuntu-latest
needs:
- changes
if: |
(needs.changes.outputs.go == 'true')
Comment thread
jonstacks marked this conversation as resolved.
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
- uses: DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
- name: Run go fix
run: nix develop --command make go-fix
- name: Fail if there are uncommitted changes
run: git diff --exit-code

build-images:
name: Build Images
needs:
- changes
- kubebuilder-diff
- lint
- go-mod-tidy
- go-fix
if: needs.changes.outputs.go == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
Expand All @@ -82,27 +125,14 @@ jobs:
push: false
tags: ngrok/ngrok-operator:latest

go-mod-tidy:
name: Go Mod Tidy Check
runs-on: ubuntu-latest
needs:
- changes
if: |
(needs.changes.outputs.go == 'true')
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
- uses: DeterminateSystems/magic-nix-cache-action@b8276522d77f21bf19d3574e5bc99186a6c7aa6c
- run: go mod tidy
- run: git diff --exit-code go.mod
- run: git diff --exit-code go.sum

build-and-test:
runs-on: ubuntu-latest
needs:
- changes
- kubebuilder-diff
- lint
- go-mod-tidy
- go-fix
if: |
(github.event_name == 'push' && github.ref_name == 'main')
||
Expand Down Expand Up @@ -153,6 +183,9 @@ jobs:
- changes
- kubebuilder-diff
- lint
- go-mod-tidy
- go-fix
- helm
Comment thread
jonstacks marked this conversation as resolved.
# Only run one e2e test at a time to avoid stomping on each other
concurrency:
group: e2e
Expand Down Expand Up @@ -189,6 +222,7 @@ jobs:
- changes
- kubebuilder-diff
- lint
- go-fix
- e2e
concurrency:
group: e2e
Expand Down Expand Up @@ -236,6 +270,7 @@ jobs:
- changes
- kubebuilder-diff
- lint
- go-fix
- e2e-multi-namespace
concurrency:
group: e2e
Expand Down
5 changes: 5 additions & 0 deletions tools/make/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ vet: ## Run go vet against code.
go vet ./...


.PHONY: go-fix
go-fix: ## Run go fix against code.
go fix ./...


.PHONY: helm-lint
helm-lint: _helm_setup ## Lint the helm chart
$(MAKE) -C $(HELM_CHART_DIR) lint
Loading