Skip to content

Commit

Permalink
chore: Add github actions for integration tests (kyma-project#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-thaler authored Oct 30, 2023
1 parent ad09a7f commit 5bffebc
Show file tree
Hide file tree
Showing 13 changed files with 374 additions and 52 deletions.
31 changes: 31 additions & 0 deletions .github/template/finalize-test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Finalize tests
description: Finalizes integration test execution with cleanup and collecting dumps fors the error scenario

inputs:
failure:
description: Are we in failure mode?
required: true

runs:
using: "composite"

steps:

- name: Print operator logs
shell: bash
if: ${{ inputs.failure }}
run: |
kubectl -n kyma-system logs -l "app.kubernetes.io/instance=telemetry, app.kubernetes.io/name=operator"
- name: List Namespaces
shell: bash
if: ${{ inputs.failure }}
run: |
kubectl get namespaces
- name: List Pods
shell: bash
if: ${{ inputs.failure }}
run: |
kubectl get po --all-namespaces
13 changes: 13 additions & 0 deletions .github/template/prepare-checks/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Prepare checks
description: Prepares everything for static code check execution

runs:
using: "composite"

steps:
# uses an older go version by default, so configure go with newest version
- name: Setup golang
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
60 changes: 60 additions & 0 deletions .github/template/prepare-test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Prepare test
description: Prepares everything for integration test execution

inputs:
release:
description: Deploy operator in release mode
required: false
github-token:
description: Github token to use for github access
required: true

runs:
using: "composite"

steps:

# uses an older go version by default, so configure go with newest version
- name: Setup golang
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true

- name: Provision K3D
shell: bash
run: make provision-k3d

# wait for the build to succeed so that the manager image is available
- name: Wait for the 'pull-telemetry-manager-build' job to succeed
uses: kyma-project/wait-for-commit-status-action@2b3ffe09af8b6f40e1213d5fb7f91a7bd41ffb20
with:
context: "pull-telemetry-manager-build"
commit_ref: "${{ github.event.pull_request.head.sha }}" # Note: 'github.event.pull_request.head.sha' is not same as 'github.sha' on pull requests.
timeout: 600000 # 10 minutes in milliseconds
# The check interval is kept long otherwise it will exhaust the GitHub rate limit (More info: https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting)
check_interval: 60000 # 1 minute in milliseconds
env:
GITHUB_TOKEN: "${{ inputs.github-token }}"
GITHUB_OWNER: "${{ github.repository_owner }}"
GITHUB_REPO: "telemetry-manager"

- name: Deploy module experimental
if: ${{ inputs.release }}
shell: bash
run: make deploy

- name: Deploy module release
if: ${{ !inputs.release }}
shell: bash
run: make deploy-dev

- name: Wait for operator readiness
shell: bash
run: kubectl -n kyma-system rollout status deployment telemetry-operator --timeout=90s

- name: Print cluster info
shell: bash
run: |
kubectl cluster-info
kubectl -n kyma-system get po
66 changes: 66 additions & 0 deletions .github/workflows/pull-code-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: PR Code checks

on:
pull_request:
branches:
- "main"
- "release-*"
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare test
uses: "./.github/template/prepare-checks"

- name: Run tests
run: make test

linting:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare test
uses: "./.github/template/prepare-checks"

- name: Run linting
uses: golangci/golangci-lint-action@v3
with:
install-mode: binary
version: latest
args: --timeout=5m --config=./.golangci.yaml

verify-manifests:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare test
uses: "./.github/template/prepare-checks"

- name: Verify manifests
run: make lint-manifests

markdown-link-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Validate links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'no'
config-file: '.mlc.config.json'
folder-path: '.'
max-depth: -1
24 changes: 9 additions & 15 deletions .github/workflows/pull-governance.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: Governance
run-name: ${{github.event.pull_request.title}}
name: PR Governance

on:
pull_request_target:
branches:
- "main"
- "release-*"
types:
- opened
- reopened
- edited
- synchronize
workflow_dispatch:

jobs:
pr-title-check:
name: Check PR Title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@47b15d52c5c30e94a17ec87eb8dd51ff5221fed9
- name: Validate title
uses: amannn/action-semantic-pull-request@47b15d52c5c30e94a17ec87eb8dd51ff5221fed9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -26,14 +31,3 @@ jobs:
requireScope: false
# https://regex101.com/r/O5OZvC/1
subjectPattern: ^([A-Z].*[^.]|bump .*)$
markdown-link-check:
name: Check Markdown Links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'no'
config-file: '.mlc.config.json'
folder-path: '.'
max-depth: -1
137 changes: 137 additions & 0 deletions .github/workflows/pull-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: PR Integration

env:
IMG: europe-docker.pkg.dev/kyma-project/dev/telemetry-manager:PR-${{ github.event.number }}

on:
pull_request:
branches:
- "main"
- "release-*"
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:

jobs:
e2e-metrics:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare test
uses: "./.github/template/prepare-test"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: make run-e2e-test-metrics

- name: Finalize test
uses: "./.github/template/finalize-test"
if: success() || failure()
with:
failure: failure()

e2e-traces-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare Test
uses: "./.github/template/prepare-test"
with:
release: true
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: make run-e2e-test-tracing

- name: Finalize Test
uses: "./.github/template/finalize-test"
if: success() || failure()
with:
failure: failure()

e2e-traces:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare Test
uses: "./.github/template/prepare-test"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: make run-e2e-test-tracing

- name: Finalize Test
uses: "./.github/template/finalize-test"
if: success() || failure()
with:
failure: failure()

e2e-logs-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare Test
uses: "./.github/template/prepare-test"
with:
release: true
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: make run-e2e-test-logging

- name: Finalize Test
uses: "./.github/template/finalize-test"
if: success() || failure()
with:
failure: failure()

e2e-logs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare Test
uses: "./.github/template/prepare-test"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: make run-e2e-test-logging

- name: Finalize Test
uses: "./.github/template/finalize-test"
if: success() || failure()
with:
failure: failure()

e2e-integration-istio:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare Test
uses: "./.github/template/prepare-test"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: make run-integration-test-istio

- name: Finalize Test
uses: "./.github/template/finalize-test"
if: success() || failure()
with:
failure: failure()
Loading

0 comments on commit 5bffebc

Please sign in to comment.