Skip to content

Commit

Permalink
E2E: Make autotests great again (#289)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Zabaluev <gpg@haarolean.dev>
Co-authored-by: VladSenyuta <vlad.senyuta@gmail.com>
  • Loading branch information
3 people authored Apr 15, 2024
1 parent 4a3c424 commit 3278803
Show file tree
Hide file tree
Showing 113 changed files with 1,328 additions and 2,074 deletions.
1 change: 1 addition & 0 deletions .github/workflows/branch-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

permissions:
contents: read
statuses: write

jobs:
build:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/e2e-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "E2E: Suite run"
on:
workflow_dispatch:
inputs:
test_suite:
description: 'Select test suite to run'
default: 'regression'
required: true
type: choice
options:
- regression
- sanity
- smoke

permissions:
contents: read
checks: write
statuses: write

jobs:
build-and-test:
uses: ./.github/workflows/e2e-run.yml
secrets: inherit
with:
suite_name: ${{ github.event.inputs.test_suite }}
sha: ${{ github.sha }}
24 changes: 24 additions & 0 deletions .github/workflows/e2e-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "E2E: PR smoke tests"
on:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
paths:
- "pom.xml"
- "contract/**"
- "api/**"
- "serde-api/**"
- "frontend/**"
- "e2e-tests/**"

permissions:
contents: read
checks: write
statuses: write

jobs:
build-and-test:
uses: ./.github/workflows/e2e-run.yml
secrets: inherit
with:
suite_name: "smoke"
sha: ${{ github.event.pull_request.head.sha }}
164 changes: 164 additions & 0 deletions .github/workflows/e2e-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: "E2E: Run tests"

on:
workflow_call:
inputs:
suite_name:
description: 'Test suite name to run'
default: 'regression'
required: true
type: string
sha:
required: true
type: string

permissions:
contents: read
checks: write
statuses: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}
ref: ${{ inputs.sha }}

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
cache: 'maven'

- name: Build with Maven
id: build_app
run: |
./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.sha }}
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true
- name: Upload maven artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: ~/.m2/repository/io/kafbat/ui/**/*
retention-days: 7

- name: Dump docker image
run: |
docker image save ghcr.io/kafbat/kafka-ui:latest > /tmp/image.tar
- name: Upload docker image
uses: actions/upload-artifact@v4
with:
name: image
path: /tmp/image.tar
retention-days: 7

tests:
runs-on: ubuntu-latest
needs: build
steps:

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}
ref: ${{ inputs.sha }}

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
cache: 'maven'

- name: Download maven artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: ~/.m2/repository/io/kafbat/ui

- name: Download docker image
uses: actions/download-artifact@v4
with:
name: image
path: /tmp

- name: Load Docker image
run: |
docker load --input /tmp/image.tar
- name: Cache Docker images.
uses: ScribeMD/docker-cache@0.5.0
with:
key: docker-${{ runner.os }}-${{ hashFiles('./e2e-tests/selenoid/selenoid-ci.yaml', './documentation/compose/e2e-tests.yaml') }}

- name: Compose up
id: compose_app
# use the following command until #819 will be fixed # TODO recheck 819
run: |
mkdir -p ./e2e-tests/target/selenoid-results/video
mkdir -p ./e2e-tests/target/selenoid-results/logs
docker-compose -f ./e2e-tests/selenoid/selenoid-ci.yaml up -d
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
- name: Dump Docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2.2.2

- name: Run test suite
run: |
./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.sha }}
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/${{ inputs.suite_name }}.xml' -f 'e2e-tests' test -Pprod
- name: Upload allure reports artifact
if: '!cancelled()'
uses: actions/upload-artifact@v4
with:
name: reports
path: ./e2e-tests/target/allure-results
retention-days: 7

reports:
runs-on: ubuntu-latest
needs: tests
if: ${{ !cancelled() && github.repository == 'kafbat/kafka-ui' }}
steps:
- name: Download allure reports artifact
uses: actions/download-artifact@v4
with:
name: reports
path: ./e2e-tests/target/allure-results

- name: Generate Allure report
uses: simple-elf/allure-report-action@v1.9
id: allure-report
with:
allure_results: ./e2e-tests/target/allure-results
gh_pages: allure-results
allure_report: allure-report
subfolder: allure-results
report_url: "https://reports.kafbat.dev"

- name: Upload allure report to R2
uses: ryand56/r2-upload-action@latest
with:
source-dir: allure-history/allure-results
destination-dir: .
r2-bucket: "reports"
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_ACCESS_SECRET_KEY }}

- name: Add allure link status check
uses: Sibz/github-status-action@v1.1.6
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Click Details button to view Allure report"
state: "success"
sha: ${{ inputs.sha }}
target_url: https://reports.kafbat.dev/${{ github.run_number }}
17 changes: 17 additions & 0 deletions .github/workflows/e2e-weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "E2E: Weekly suite"
on:
schedule:
- cron: '0 1 * * 1'

permissions:
contents: read
checks: write
statuses: write

jobs:
build-and-test:
uses: ./.github/workflows/e2e-run.yml
secrets: inherit
with:
suite_name: "sanity"
sha: ${{ github.sha }}
6 changes: 3 additions & 3 deletions .github/workflows/welcome-first-time-contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
Welcome, and thank you for opening your first issue in the repo!
Please wait for triaging by our maintainers.
Please wait for triaging by our maintainers.
As development is carried out in our spare time, you can support us by sponsoring our activities or even funding the development of specific issues.
[Sponsorship link](https://github.com/kafbat)
Expand All @@ -34,6 +34,6 @@ jobs:
Welcome, and thank you for opening your first PR in the repo!
Please wait for triaging by our maintainers.
Please wait for triaging by our maintainers.
Please take a look at our [contributing guide](https://ui.docs.kafbat.io/development/contributing).
3 changes: 0 additions & 3 deletions e2e-tests/.env.ci

This file was deleted.

3 changes: 0 additions & 3 deletions e2e-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.env
build/
allure-results/
selenoid/video/
target/
selenoid/logs/
70 changes: 0 additions & 70 deletions e2e-tests/QASE.md

This file was deleted.

Loading

0 comments on commit 3278803

Please sign in to comment.