Skip to content

Commit

Permalink
split verification test gh workflows (#24)
Browse files Browse the repository at this point in the history
* unify gh workflow names

* extract common gh actions

* split operator-verify gh workflow

* remove pull specific conditions from push gh jobs

* fixes after rebase

* fixes after rebase; rename gh action create-single-cluster; fix calling mandatory gh action collect-cluster-info
  • Loading branch information
anoipm authored May 10, 2024
1 parent 7f6cb7b commit 34de658
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 138 deletions.
10 changes: 10 additions & 0 deletions .github/actions/collect-cluster-info/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Collect cluster-info'
description: 'Action for collecting cluster-info'

runs:
using: 'composite'
steps:
- name: collect cluster-info
if: ${{ always() }}
run: make -C tests/operator cluster-info
shell: bash
16 changes: 16 additions & 0 deletions .github/actions/create-k3d-cluster/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Create k3d cluster'
description: 'Action for creating k3d cluster'

runs:
using: 'composite'
steps:
- name: create k3d cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0
with:
cluster-name: "k3dCluster"
args: >-
--agents 1
--image rancher/k3s:v1.29.3-k3s1
--port 80:80@loadbalancer
--port 443:443@loadbalancer
--wait
10 changes: 10 additions & 0 deletions .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Setup go'
description: 'Action for the go setup'

runs:
using: 'composite'
steps:
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22'
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Create release"
name: create release

on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/images-verify.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Images verify
name: images verify
run-name: ${{github.event.pull_request.title}}
on:
pull_request:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/integration-tests-pull.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: integration tests (pull)

on:
pull_request:
paths-ignore:
- 'docs/**'
- 'examples/**'
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]

jobs:
operator-integration-test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
- uses: ./.github/actions/setup-go
- uses: ./.github/actions/create-k3d-cluster
- name: run test
run: |
make -C components/operator deploy
make -C tests/operator test
env:
IMG: europe-docker.pkg.dev/kyma-project/dev/dockerregistry-operator:PR-${{ github.event.number }}
- if: ${{ always() }}
uses: ./.github/actions/collect-cluster-info
49 changes: 49 additions & 0 deletions .github/workflows/integration-tests-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: integration tests (push)

on:
push:
branches: [ "main", "release-*" ]

jobs:
operator-integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
- uses: ./.github/actions/create-k3d-cluster
- name: run test
run: |
make -C components/operator deploy
make -C tests/operator test
env:
IMG: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.sha }}
- if: ${{ always() }}
uses: ./.github/actions/collect-cluster-info

gardener-integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
- name: save service-account
shell: bash
run: 'echo "$GARDENER_SA" > /tmp/gardener-sa.yaml'
env:
GARDENER_SA: ${{ secrets.GARDENER_SA }}
- name: provision gardener
run: make -C hack provision-gardener
env:
GARDENER_SECRET_NAME: ${{ secrets.GARDENER_SECRET_NAME }}
GARDENER_PROJECT: ${{ secrets.GARDENER_PROJECT }}
GARDENER_SA_PATH: /tmp/gardener-sa.yaml
- name: run test
run: |
make -C components/operator deploy
make -C tests/operator test
env:
IMG: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.sha }}
- name: deprovision gardener
if: ${{ always() }}
run: make -C hack deprovision-gardener
env:
GARDENER_SA_PATH: /tmp/gardener-sa.yaml
20 changes: 20 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: lint

on:
pull_request:
paths:
- 'components/operator/**'
- '.github/**'
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]

jobs:
lint:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
- uses: golangci/golangci-lint-action@v3
with:
version: latest
working-directory: 'components/operator'
2 changes: 1 addition & 1 deletion .github/workflows/markdown.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Markdown
name: markdown
run-name: ${{github.event.pull_request.title}}
on:
schedule:
Expand Down
135 changes: 0 additions & 135 deletions .github/workflows/operator-verify.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: unit tests

on:
pull_request:
paths-ignore:
- 'docs/**'
- 'examples/**'
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rebase
- uses: ./.github/actions/setup-go
- name: run test
run: make -C components/operator test
25 changes: 25 additions & 0 deletions .github/workflows/upgrade-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: upgrade tests

on:
push:
branches: [ "main", "release-*" ]

jobs:
#TODO: after the first release bring this test back with deploy-release target
# operator-upgrade-test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/setup-go
# - uses: ./.github/actions/create-k3d-cluster
# - name: upgrade test
# run: |
# make -C components/operator deploy-release
# make -C tests/operator test
# make -C components/operator deploy
# make -C tests/operator test
# env:
# IMG: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.sha }}
# - if: ${{ always() }}
# uses: ./.github/actions/collect-cluster-info

0 comments on commit 34de658

Please sign in to comment.