Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate tests to GHA #38

Merged
merged 3 commits into from
Oct 4, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
# skip-cache: true

# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true
skip-pkg-cache: true

# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ on:
push:
branches: [ "main" ]
pull_request:
# Trigger for Pull Request
branches: [ "main" ]
permissions:
contents: read
jobs:
lint:
############################################################################################
validate:
test:
runs-on: ubuntu-latest
steps:
############################################################################################
- name: Checkout code
uses: actions/checkout@v3
############################################################################################

- name: Set up cache
uses: actions/cache@v3
with:
Expand All @@ -27,11 +22,12 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
############################################################################################

- name: Set up go environment
uses: actions/setup-go@v4
with:
go-version: 1.19
############################################################################################

- name: Run unit tests
run: make test

37 changes: 37 additions & 0 deletions .github/workflows/run-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Run integration tests

on:
push:
branches: [ "main" ]

pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3

- name: Set up cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
/home/runner/work/application-connector-manager/application-connector-manager/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Set up go environment
uses: actions/setup-go@v4
with:
go-version: 1.19

- name: Run integration tests without lifecycle-manager
run: make -C hack/ci run-without-lifecycle-manager
16 changes: 16 additions & 0 deletions .github/workflows/run-vuln-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Run vuln check
on:
push:
branches: [ "main" ]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: vulncheck
uses: golang/govulncheck-action@v1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: applicationconnectors.operator.kyma-project.io
spec:
Expand Down
9 changes: 8 additions & 1 deletion hack/ci/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
PROJECT_ROOT ?= ../..
PROJECT_COMMON ?= ../common

K3D_URL=https://github.com/raw/k3d-io/k3d/main/install.sh
DEFAULT_K3D_VERSION=v5.4.6

include ${PROJECT_ROOT}/.env

ifndef MODULE_SHA
Expand Down Expand Up @@ -53,11 +56,15 @@ k3d-upgrade-test: \
render-manifest:
@make -C ${PROJECT_ROOT} render-manifest

.PHONY: install-k3d
install-k3d:
curl --silent --fail ${K3D_URL} | TAG=${DEFAULT_K3D_VERSION} bash

.PHONY: run-with-lifecycle-manager
run-with-lifecycle-manager:
@make -C ${PROJECT_COMMON} run-with-lifecycle-manager

.PHONY: run-without-lifecycle-manager
run-without-lifecycle-manager:
run-without-lifecycle-manager: install-k3d
@make -C ${PROJECT_COMMON} run-without-lifecycle-manager

4 changes: 2 additions & 2 deletions hack/common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ run-without-lifecycle-manager: \

.PHONY: create-k3d
create-k3d: ## Create k3d with kyma CRDs.
${KYMA} provision k3d --registry-port ${REGISTRY_PORT} --name ${CLUSTER_NAME} --ci
${KYMA} provision k3d --registry-port ${REGISTRY_PORT} --name ${CLUSTER_NAME} -p 8080:80@loadbalancer -p 8443:443@loadbalancer --ci

.PHONY: delete-k3d
delete-k3d: ## Delete k3d with kyma CRDs.
Expand All @@ -64,7 +64,7 @@ patch-with-istio-crds: ## Delete k3d kyma cluster.

.PHONY: create-k3d
create-k3d: ## Create k3d with kyma CRDs.
${KYMA} provision k3d --registry-port ${REGISTRY_PORT} --name ${CLUSTER_NAME} --ci
${KYMA} provision k3d --registry-port ${REGISTRY_PORT} --name ${CLUSTER_NAME} -p 8080:80@loadbalancer -p 8443:443@loadbalancer --ci

##@ Module management

Expand Down
Loading