Skip to content

Run global Konveyor CI tests #3

Run global Konveyor CI tests

Run global Konveyor CI tests #3

Workflow file for this run

name: Run global Konveyor CI tests
on:
workflow_call:
inputs:
tag:
description: |
The tag that should be used to pull all konveyor related images.
For example, if you wanted to set a nightly build for release-0.2, you would specify
"release-0.2".
required: false
type: string
default: latest
operator_tag:
description: |
The tag name for operator to be used for setup, e.g. a build for release-0.3,
you would specify "v0.3.0".
required: false
type: string
default: latest
component_name:
description: |
The name of the component being tested, ie konveyor-hub, analyzer-lsp, etc.
Must correspond to an artifact storing the custom built image, named <component_name>,
and should contain the file <component_name>.tar inside.
required: false
type: string
run_api_tests:
description: |
A flag that determines whether the API tests should be run or not
type: boolean
required: false
default: true
run_ui_tests:
description: |
A flag that determines whether the UI tests should be run or not
type: boolean
required: false
default: true
api_tests_ref:
description: |
The branch or PR of the go-konveyor-tests repository to clone.
For a pull request, the reference format would be "refs/pull/${PR_NUMBER}/merge".
For a branch, the reference format would just be the branch name.
This input can be set automatically on a pull request by adding a string of the format:
Go tests PR: 140
replacing "140" with the appropriate PR number. This will make it easier to coordinate changes
that require updating the global tests as well.
required: false
type: string
default: main
api_hub_tests_ref:
description: |
The branch or PR of the Hub API tests from tackle2-hub repository to clone.
For a pull request, the reference format would be "refs/pull/${PR_NUMBER}/merge".
For a branch, the reference format would just be the branch name.
required: false
type: string
default: main
ui_tests_ref:
description: |
The branch or PR of the tackle-ui-tests repository to clone.
For a pull request, the reference format would be "refs/pull/${PR_NUMBER}/merge".
For a branch, the reference format would just be the branch name.
This input can be set automatically on a pull request by adding a string of the format:
UI tests PR: 140
replacing "140" with the appropriate PR number. This will make it easier to coordinate changes
that require updating the global tests as well.
required: false
type: string
default: main
workflow_dispatch:
inputs:
tag:
description: |
The tag that should be used to pull all konveyor related images.
For example, if you wanted to set a nightly build for release-0.2, you would specify
"release-0.2".
required: false
type: string
default: latest
operator_tag:
description: |
The tag name for operator to be used for setup, e.g. a build for release-0.3,
you would specify "v0.3.0".
required: false
type: string
default: latest
component_name:
description: |
The name of the component being tested, ie konveyor-hub, analyzer-lsp, etc.
Must correspond to an artifact storing the custom built image, named <component_name>,
and should contain the file <component_name>.tar inside.
required: false
type: string
run_api_tests:
description: |
A flag that determines whether the API tests should be run or not
type: boolean
required: false
default: true
run_ui_tests:
description: |
A flag that determines whether the UI tests should be run or not
type: boolean
required: true
default: true
api_tests_ref:
description: |
The branch or PR of the go-konveyor-tests repository to clone.
For a pull request, the reference format would be "refs/pull/${PR_NUMBER}/merge".
For a branch, the reference format would just be the branch name.
This input can be set automatically on a pull request by adding a string of the format:
Go tests PR: 140
replacing "140" with the appropriate PR number. This will make it easier to coordinate changes
that require updating the global tests as well.
required: false
type: string
default: main
api_hub_tests_ref:
description: |
The branch or PR of the Hub API tests from tackle2-hub repository to clone.
For a pull request, the reference format would be "refs/pull/${PR_NUMBER}/merge".
For a branch, the reference format would just be the branch name.
required: false
type: string
default: main
ui_tests_ref:
description: |
The branch or PR of the tackle-ui-tests repository to clone.
For a pull request, the reference format would be "refs/pull/${PR_NUMBER}/merge".
For a branch, the reference format would just be the branch name.
This input can be set automatically on a pull request by adding a string of the format:
UI tests PR: 140
replacing "140" with the appropriate PR number. This will make it easier to coordinate changes
that require updating the global tests as well.
required: false
type: string
default: main
jobs:
e2e-api-integration-tests:
runs-on: ubuntu-latest
if: ${{ inputs.run_api_tests }}
steps:
- name: Extract pull request number from inputs or PR description
env:
body: ${{ github.event.pull_request.body }}
run: |
PULL_REQUEST_NUMBER=$(echo ${body} | grep -oP '[A|a][P|p][I|i] [T|t]ests [P|p][R|r]:\s*\K\d+' || true)
[ -z "$PULL_REQUEST_NUMBER" ] \
&& GOLANG_TESTS_REF=${{ inputs.api_tests_ref }} \
|| GOLANG_TESTS_REF=refs/pull/$PULL_REQUEST_NUMBER/merge
echo "GOLANG_TESTS_REF=${GOLANG_TESTS_REF}" >>"$GITHUB_ENV"
echo "Using GOLANG_TESTS_REF \`${GOLANG_TESTS_REF}\`" >>"$GITHUB_STEP_SUMMARY"
- name: Checkout golang api tests repo
uses: actions/checkout@v4
with:
repository: konveyor/go-konveyor-tests
path: go-konveyor-tests
ref: "${{ env.GOLANG_TESTS_REF }}"
# TODO Should DRY this
- name: set up docker buildx
if: "${{ inputs.component_name != '' }}"
uses: docker/setup-buildx-action@v2
- name: Download artifact
if: "${{ inputs.component_name != '' }}"
uses: actions/download-artifact@v3
with:
name: ${{ inputs.component_name }}
path: /tmp
- name: start minikube
uses: konveyor/tackle2-operator/.github/actions/start-minikube@main
with:
memory: 'max'
cpus: 'max'
# TODO: Could just load all images found in this artifact so that people can rebuild multiple components if needed
- name: Load image
if: "${{ inputs.component_name != '' }}"
run: |
export SHELL=/bin/bash
eval $(minikube -p minikube docker-env)
docker load --input /tmp/${{ inputs.component_name }}.tar
- name: install konveyor
uses: konveyor/tackle2-operator/.github/actions/install-tackle@release-0.4
if: "${{ startsWith(inputs.operator_tag, 'v0.4') }}"
with:
operator-bundle-image: "quay.io/konveyor/tackle2-operator-bundle:${{ inputs.operator_tag }}"
hub-image: "quay.io/konveyor/tackle2-hub:${{ inputs.tag }}"
ui-image: "quay.io/konveyor/tackle2-ui:${{ inputs.tag }}"
addon-analyzer-image: "quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.tag }}"
image-pull-policy: IfNotPresent
analyzer-container-memory: 0
analyzer-container-cpu: 0
- name: install konveyor
uses: konveyor/tackle2-operator/.github/actions/install-tackle@release-0.3
if: "${{ startsWith(inputs.operator_tag, 'v0.3') }}"
with:
operator-bundle-image: "quay.io/konveyor/tackle2-operator-bundle:${{ inputs.operator_tag }}"
hub-image: "quay.io/konveyor/tackle2-hub:${{ inputs.tag }}"
ui-image: "quay.io/konveyor/tackle2-ui:${{ inputs.tag }}"
addon-analyzer-image: "quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.tag }}"
image-pull-policy: IfNotPresent
analyzer-container-memory: 0
analyzer-container-cpu: 0
- name: install konveyor
uses: konveyor/tackle2-operator/.github/actions/install-tackle@main
if: "${{ inputs.operator_tag == 'latest'}}"
with:
operator-bundle-image: "quay.io/konveyor/tackle2-operator-bundle:${{ inputs.operator_tag }}"
hub-image: "quay.io/konveyor/tackle2-hub:${{ inputs.tag }}"
ui-image: "quay.io/konveyor/tackle2-ui:${{ inputs.tag }}"
addon-analyzer-image: "quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.tag }}"
image-pull-policy: IfNotPresent
analyzer-container-memory: 0
analyzer-container-cpu: 0
# end DRY
- uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Install test dependencies
run: |
go install github.com/onsi/ginkgo/v2/ginkgo
working-directory: go-konveyor-tests
- name: Build and run golang API tests
run: |
export HUB_BASE_URL="http://$(minikube ip)/hub"
export HUB_TESTS_REF="${{ inputs.api_hub_tests_ref }}"
make test-tier0 test-tier1
working-directory: go-konveyor-tests
e2e-ui-integration-tests:
if: ${{ inputs.run_ui_tests }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# TODO enable customizing the number of tiers run for nightlies
tier: [tier0] #, tier1, tier2, tier3]
steps:
- name: Extract pull request number from inputs or PR description
env:
body: ${{ github.event.pull_request.body }}
run: |
PULL_REQUEST_NUMBER=$(echo ${body} | grep -oP '[U|u][I|i] [T|t]ests [P|p][R|r]: \K\d+' || true)
[ -z "$PULL_REQUEST_NUMBER" ] \
&& UI_TESTS_REF=${{ inputs.ui_tests_ref }} \
|| UI_TESTS_REF=refs/pull/$PULL_REQUEST_NUMBER/merge
echo "UI_TESTS_REF=${UI_TESTS_REF}" >>"$GITHUB_ENV"
echo "Using UI_TESTS_REF \`${UI_TESTS_REF}\`" >>"$GITHUB_STEP_SUMMARY"
- name: Checkout ui tests repo
uses: actions/checkout@v4
with:
repository: konveyor/tackle-ui-tests
path: tackle-ui-tests
ref: "${{ env.UI_TESTS_REF }}"
# TODO Should DRY this
- name: set up docker buildx
if: "${{ inputs.component_name != '' }}"
uses: docker/setup-buildx-action@v2
- name: Download artifact
if: "${{ inputs.component_name != '' }}"
uses: actions/download-artifact@v3
with:
name: ${{ inputs.component_name }}
path: /tmp
- name: start minikube
uses: konveyor/tackle2-operator/.github/actions/start-minikube@main
with:
memory: 'max'
cpus: 'max'
# TODO: Could just load all images found in this artifact so that people can rebuild multiple components if needed
- name: Load image
if: "${{ inputs.component_name != '' }}"
run: |
export SHELL=/bin/bash
eval $(minikube -p minikube docker-env)
docker load --input /tmp/${{ inputs.component_name }}.tar
- name: install konveyor
uses: konveyor/tackle2-operator/.github/actions/install-tackle@release-0.4
if: "${{ startsWith(inputs.operator_tag, 'v0.4') }}"
with:
operator-bundle-image: "quay.io/konveyor/tackle2-operator-bundle:${{ inputs.operator_tag }}"
hub-image: "quay.io/konveyor/tackle2-hub:${{ inputs.tag }}"
ui-image: "quay.io/konveyor/tackle2-ui:${{ inputs.tag }}"
addon-analyzer-image: "quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.tag }}"
image-pull-policy: IfNotPresent
analyzer-container-memory: 0
analyzer-container-cpu: 0
- name: install konveyor
uses: konveyor/tackle2-operator/.github/actions/install-tackle@release-0.3
if: "${{ startsWith(inputs.operator_tag, 'v0.3') }}"
with:
operator-bundle-image: "quay.io/konveyor/tackle2-operator-bundle:${{ inputs.operator_tag }}"
hub-image: "quay.io/konveyor/tackle2-hub:${{ inputs.tag }}"
ui-image: "quay.io/konveyor/tackle2-ui:${{ inputs.tag }}"
addon-analyzer-image: "quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.tag }}"
image-pull-policy: IfNotPresent
analyzer-container-memory: 0
analyzer-container-cpu: 0
- name: install konveyor
uses: konveyor/tackle2-operator/.github/actions/install-tackle@main
if: "${{ inputs.operator_tag == 'latest'}}"
with:
operator-bundle-image: "quay.io/konveyor/tackle2-operator-bundle:${{ inputs.operator_tag }}"
hub-image: "quay.io/konveyor/tackle2-hub:${{ inputs.tag }}"
ui-image: "quay.io/konveyor/tackle2-ui:${{ inputs.tag }}"
addon-analyzer-image: "quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.tag }}"
image-pull-policy: IfNotPresent
analyzer-container-memory: 0
analyzer-container-cpu: 0
# end DRY
- name: Wait for Ingress and expose UI service
run: |
external_ip=""
echo $external_ip;
while [[ -z $external_ip ]]
do
echo "Waiting for end point..."
external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] &&
echo $external_ip;
sleep 10;
done
echo "End point ready:" &&
echo $external_ip;
echo "UI_URL=https://$(minikube ip)" >>$GITHUB_ENV
# - name: Run login tests
# uses: cypress-io/github-action@v5
# env:
# CYPRESS_user: admin
# CYPRESS_pass: password
# CYPRESS_tackleUrl: "${{ env.UI_URL }}"
# with:
# working-directory: tackle-ui-tests
# spec: "cypress/e2e/tests/login.test.ts"
- name: Run UI tests
uses: cypress-io/github-action@v5
env:
CYPRESS_INCLUDE_TAGS: "@${{ matrix.tier }}"
CYPRESS_user: "admin"
CYPRESS_pass: "Dog8code"
CYPRESS_tackleUrl: "${{ env.UI_URL }}"
CYPRESS_git_user: "fakeuser"
CYPRESS_git_password: "${{ secrets.GITHUB_TOKEN }}"
CYPRESS_git_key: "${{ secrets.GITHUB_TOKEN }}"
with:
working-directory: tackle-ui-tests
spec: "**/*.test.ts"
- name: Upload cypress report data as artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: tackle-ui-test-reports-${{ matrix.tier }}
path: |
tackle-ui-tests/cypress/reports
tackle-ui-tests/cypress/screenshots