Skip to content

Commit

Permalink
chore(ci): run the smoke tests on GKE (#20)
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Chen <[email protected]>
  • Loading branch information
jijiechen authored Jan 8, 2025
1 parent a5d2c65 commit 7665e5a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- main
workflow_dispatch: {}
env:
SMOKE_PRODUCT_NAME: "kuma"
SMOKE_PRODUCT_VERSION: "2.9.2"
Expand Down Expand Up @@ -34,9 +35,14 @@ jobs:
skip-cache: true
build-test:
name: Build and test
timeout-minutes: 40
needs:
- check
runs-on: ubuntu-latest
strategy:
matrix:
envPlatform: ${{ fromJSON( github.event_name == 'workflow_dispatch' && '["kind", "gke"]' || '["kind"]' ) }}
fail-fast: false
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci/skip-test') }}
steps:
- name: Checkout
Expand All @@ -52,11 +58,20 @@ jobs:
- name: make build
run: make build
- name: make run
run: make run
env:
GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }}
GOOGLE_LOCATION: ${{ secrets.GOOGLE_LOCATION }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
if: ${{ matrix.envPlatform != 'gke' || env.GOOGLE_PROJECT != '' }}
run: |
SMOKE_ENV_TYPE=${{ matrix.envPlatform }} make run
- name: make cleanup-kubernetes
if: always()
run: make cleanup-kubernetes
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
if: always()
with:
name: smoke-report
name: smoke-report-${{ matrix.envPlatform }}
if-no-files-found: ignore
path: |
raw-report.json
Expand Down
2 changes: 1 addition & 1 deletion mk/dependencies/deps.lock
Original file line number Diff line number Diff line change
@@ -1 +1 @@
efc1b32134a21ddebd5619c46d07997a44c839fa
e272c7ad4eb24ee19172ed8fee55a09ea00f4ff9
2 changes: 0 additions & 2 deletions mk/dev.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
SMOKE_PRODUCT_NAME ?= kuma
SMOKE_PRODUCT_VERSION ?= 2.9.2
CI_TOOLS_DIR ?= ${HOME}/.kuma-smoke-dev
CI_TOOLS_BIN_DIR=$(CI_TOOLS_DIR)/bin

Expand Down
12 changes: 9 additions & 3 deletions mk/run.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
SMOKE_PRODUCT_NAME ?= kuma
SMOKE_PRODUCT_VERSION ?= 2.9.2
SMOKE_ENV_TYPE ?= kind

# Extract major, minor, and patch versions
MAJOR := $(word 1,$(subst ., ,$(SMOKE_PRODUCT_VERSION)))
MINOR := $(word 2,$(subst ., ,$(SMOKE_PRODUCT_VERSION)))
Expand Down Expand Up @@ -40,13 +44,15 @@ fetch-product:
deploy-kubernetes:
@[ -f $(TOP)/build/kuma-smoke ] || (echo "Please run 'make build' first" && exit 1)
@mkdir -p $(TOP)/build/kubernetes
@$(TOP)/build/kuma-smoke kubernetes deploy --env-platform kind --kubeconfig-output $(TOP)/build/kubernetes/cluster.config
@$(TOP)/build/kuma-smoke kubernetes deploy --env-platform $(SMOKE_ENV_TYPE) --kubeconfig-output $(TOP)/build/kubernetes/cluster.config

.PHONY: cleanup-kubernetes
cleanup-kubernetes:
$(eval ENV_NAME=$(shell kubectl --kubeconfig=$(TOP)/build/kubernetes/cluster.config config view -o jsonpath='{.clusters[0].name}'))
@$(TOP)/build/kuma-smoke kubernetes cleanup --env $(ENV_NAME)
@rm -f $(TOP)/build/kubernetes/cluster.config
@if [[ "$(ENV_NAME)" != "" ]]; then \
$(TOP)/build/kuma-smoke kubernetes cleanup --env $(ENV_NAME) --env-platform $(SMOKE_ENV_TYPE) ; \
rm -f $(TOP)/build/kubernetes/cluster.config; \
fi

.PHONY: run
run: fetch-product deploy-kubernetes
Expand Down

0 comments on commit 7665e5a

Please sign in to comment.