Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
87 changes: 64 additions & 23 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: nix develop --command go mod tidy
- 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,37 +125,27 @@ 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')
||
always() && !failure() && !cancelled() &&
(
(needs.changes.outputs.actions == 'true') ||
(needs.changes.outputs.go == 'true') ||
(needs.changes.outputs.charts == 'true') ||
(needs.changes.outputs.chartyaml == 'true') ||
(needs.changes.outputs.tests == 'true') ||
(needs.changes.outputs.make == 'true')
(github.event_name == 'push' && github.ref_name == 'main')
||
(
(needs.changes.outputs.actions == 'true') ||
(needs.changes.outputs.go == 'true') ||
(needs.changes.outputs.charts == 'true') ||
(needs.changes.outputs.chartyaml == 'true') ||
(needs.changes.outputs.tests == 'true') ||
(needs.changes.outputs.make == 'true')
)
)
permissions:
contents: read
Expand Down Expand Up @@ -153,6 +186,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 All @@ -161,6 +197,7 @@ jobs:
# Only run the e2e tests if on the main branch or in a merge queue and
# files have changed that require e2e tests
if: |
always() && !failure() && !cancelled() &&
(github.repository == 'ngrok/ngrok-operator') &&
(
(github.event_name == 'push' && github.ref_name == 'main') ||
Expand Down Expand Up @@ -189,12 +226,14 @@ jobs:
- changes
- kubebuilder-diff
- lint
- go-fix
- e2e
concurrency:
group: e2e
cancel-in-progress: false
timeout-minutes: 30
if: |
always() && !failure() && !cancelled() &&
(github.repository == 'ngrok/ngrok-operator') &&
(
(github.event_name == 'push' && github.ref_name == 'main') ||
Expand Down Expand Up @@ -236,12 +275,14 @@ jobs:
- changes
- kubebuilder-diff
- lint
- go-fix
- e2e-multi-namespace
concurrency:
group: e2e
cancel-in-progress: false
timeout-minutes: 60
if: |
always() && !failure() && !cancelled() &&
(github.repository == 'ngrok/ngrok-operator') &&
(
(github.event_name == 'push' && github.ref_name == 'main') ||
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