Skip to content

Commit 745ec96

Browse files
committed
Refactor e2e workflows
1 parent d432966 commit 745ec96

File tree

12 files changed

+192
-370
lines changed

12 files changed

+192
-370
lines changed

.github/workflows/branch-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: read
11+
statuses: write
1112

1213
jobs:
1314
build:

.github/workflows/e2e-automation.yml

Lines changed: 7 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -14,75 +14,13 @@ on:
1414

1515
permissions:
1616
contents: read
17+
checks: write
18+
statuses: write
1719

1820
jobs:
1921
build-and-test:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v4
23-
with:
24-
token: ${{ github.token }}
25-
ref: ${{ github.sha }}
26-
- name: Configure AWS credentials
27-
uses: aws-actions/configure-aws-credentials@v4
28-
with:
29-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
30-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
31-
aws-region: eu-central-1
32-
- name: Set up environment
33-
id: set_env_values
34-
run: |
35-
cat "./e2e-tests/.env.ci" >> "./e2e-tests/.env"
36-
- name: Pull with Docker
37-
id: pull_chrome
38-
run: |
39-
docker pull selenoid/vnc_chrome:103.0
40-
- name: Set up JDK
41-
uses: actions/setup-java@v3
42-
with:
43-
java-version: '17'
44-
distribution: 'zulu'
45-
cache: 'maven'
46-
- name: Build with Maven
47-
id: build_app
48-
run: |
49-
./mvnw -B -ntp versions:set -DnewVersion=${{ github.sha }}
50-
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
51-
- name: Compose with Docker
52-
id: compose_app
53-
# use the following command until #819 will be fixed
54-
run: |
55-
docker-compose -f e2e-tests/docker/selenoid-git.yaml up -d
56-
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
57-
- name: Run test suite
58-
run: |
59-
./mvnw -B -ntp versions:set -DnewVersion=${{ github.sha }}
60-
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/${{ github.event.inputs.test_suite }}.xml' -Dsuite=${{ github.event.inputs.test_suite }} -f 'e2e-tests' test -Pprod
61-
- name: Generate Allure report
62-
uses: simple-elf/allure-report-action@master
63-
if: always()
64-
id: allure-report
65-
with:
66-
allure_results: ./e2e-tests/allure-results
67-
gh_pages: allure-results
68-
allure_report: allure-report
69-
subfolder: allure-results
70-
report_url: "http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com"
71-
- uses: jakejarvis/s3-sync-action@master
72-
if: always()
73-
env:
74-
AWS_S3_BUCKET: 'kafkaui-allure-reports'
75-
AWS_REGION: 'eu-central-1'
76-
SOURCE_DIR: 'allure-history/allure-results'
77-
- name: Deploy report to Amazon S3
78-
if: always()
79-
uses: Sibz/github-status-action@v1.1.6
80-
with:
81-
authToken: ${{secrets.GITHUB_TOKEN}}
82-
context: "Click Details button to open Allure report"
83-
state: "success"
84-
sha: ${{ github.sha }}
85-
target_url: http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com/${{ github.run_number }}
86-
- name: Dump Docker logs on failure
87-
if: failure()
88-
uses: jwalton/gh-docker-logs@v2.2.2
22+
uses: ./.github/workflows/e2e-run.yml
23+
secrets: inherit
24+
with:
25+
suite_name: ${{ github.event.inputs.test_suite }}
26+
sha: ${{ github.sha }}

.github/workflows/e2e-manual.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/e2e-run.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: "E2E: Run tests"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
suite_name:
7+
description: 'Test suite name to run'
8+
default: 'regression'
9+
required: true
10+
type: string
11+
sha:
12+
required: true
13+
type: string
14+
15+
permissions:
16+
contents: read
17+
checks: write
18+
statuses: write
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ github.token }}
28+
ref: ${{ inputs.sha }}
29+
30+
- name: Set up JDK
31+
uses: actions/setup-java@v3
32+
with:
33+
java-version: '17'
34+
distribution: 'zulu'
35+
cache: 'maven'
36+
37+
- name: Build with Maven
38+
id: build_app
39+
run: |
40+
./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.sha }}
41+
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true
42+
43+
- name: Upload maven artifacts
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: artifacts
47+
path: ~/.m2/repository/io/kafbat/ui/**/*
48+
retention-days: 7
49+
50+
- name: Dump docker image
51+
run: |
52+
docker image save ghcr.io/kafbat/kafka-ui:latest > /tmp/image.tar
53+
54+
- name: Upload docker image
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: image
58+
path: /tmp/image.tar
59+
retention-days: 7
60+
61+
tests:
62+
runs-on: ubuntu-latest
63+
needs: build
64+
steps:
65+
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
with:
69+
token: ${{ github.token }}
70+
ref: ${{ inputs.sha }}
71+
72+
- name: Set up JDK
73+
uses: actions/setup-java@v3
74+
with:
75+
java-version: '17'
76+
distribution: 'zulu'
77+
cache: 'maven'
78+
79+
- name: Download maven artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: artifacts
83+
path: ~/.m2/repository/io/kafbat/ui
84+
85+
- name: Download docker image
86+
uses: actions/download-artifact@v4
87+
with:
88+
name: image
89+
path: /tmp
90+
91+
- name: Load Docker image
92+
run: |
93+
docker load --input /tmp/image.tar
94+
95+
- name: Cache Docker images.
96+
uses: ScribeMD/docker-cache@0.5.0
97+
with:
98+
key: docker-${{ runner.os }}-${{ hashFiles('./e2e-tests/selenoid/selenoid-ci.yaml', './documentation/compose/e2e-tests.yaml') }}
99+
100+
- name: Compose up
101+
id: compose_app
102+
# use the following command until #819 will be fixed # TODO recheck 819
103+
run: |
104+
mkdir -p ./e2e-tests/target/selenoid-results/video
105+
mkdir -p ./e2e-tests/target/selenoid-results/logs
106+
docker-compose -f ./e2e-tests/selenoid/selenoid-ci.yaml up -d
107+
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
108+
109+
- name: Run test suite
110+
run: |
111+
./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.sha }}
112+
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/${{ github.event.inputs.test_suite }}.xml' -f 'e2e-tests' test -Pprod
113+
114+
- name: Dump Docker logs on failure
115+
if: failure()
116+
uses: jwalton/gh-docker-logs@v2.2.2
117+
118+
- name: Upload allure reports artifact
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: reports
122+
path: ./e2e-tests/target/allure-results
123+
retention-days: 7
124+
125+
reports:
126+
runs-on: ubuntu-latest
127+
needs: tests
128+
if: ${{ github.repository == 'kafbat/kafka-ui' }}
129+
steps:
130+
- name: Download allure reports artifact
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: reports
134+
path: ./e2e-tests/target/allure-results
135+
136+
- name: Generate Allure report
137+
uses: simple-elf/allure-report-action@v1.9
138+
id: allure-report
139+
with:
140+
allure_results: ./e2e-tests/target/allure-results
141+
gh_pages: allure-results
142+
allure_report: allure-report
143+
subfolder: allure-results
144+
report_url: "https://reports.kafbat.dev"
145+
146+
- name: Upload allure report to R2
147+
uses: ryand56/r2-upload-action@latest
148+
with:
149+
source-dir: allure-history/allure-results
150+
destination-dir: .
151+
r2-bucket: "reports"
152+
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
153+
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
154+
r2-secret-access-key: ${{ secrets.R2_ACCESS_SECRET_KEY }}
155+
156+
- name: Add allure link status check
157+
uses: Sibz/github-status-action@v1.1.6
158+
with:
159+
authToken: ${{secrets.GITHUB_TOKEN}}
160+
context: "Click Details button to view Allure report"
161+
state: "success"
162+
sha: ${{ inputs.sha }}
163+
target_url: https://reports.kafbat.dev/${{ github.run_number }}

.github/workflows/e2e-tests.yml

Lines changed: 7 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "E2E: PR healthcheck"
22
on:
3-
pull_request_target:
3+
pull_request:
44
types: [ "opened", "reopened", "synchronize" ]
55
paths:
66
- "pom.xml"
@@ -12,76 +12,13 @@ on:
1212

1313
permissions:
1414
contents: read
15+
checks: write
1516
statuses: write
1617

1718
jobs:
1819
build-and-test:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: actions/checkout@v4
22-
with:
23-
token: ${{ github.token }}
24-
ref: ${{ github.event.pull_request.head.sha }}
25-
- name: Configure AWS credentials
26-
uses: aws-actions/configure-aws-credentials@v4
27-
with:
28-
aws-access-key-id: ${{ secrets.S3_AWS_ACCESS_KEY_ID }}
29-
aws-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }}
30-
aws-region: eu-central-1
31-
- name: Set up environment
32-
id: set_env_values
33-
run: |
34-
cat "./e2e-tests/.env.ci" >> "./e2e-tests/.env"
35-
- name: Pull with Docker
36-
id: pull_chrome
37-
run: |
38-
docker pull selenoid/vnc_chrome:103.0
39-
- name: Set up JDK
40-
uses: actions/setup-java@v3
41-
with:
42-
java-version: '17'
43-
distribution: 'zulu'
44-
cache: 'maven'
45-
- name: Build with Maven
46-
id: build_app
47-
run: |
48-
./mvnw -B -ntp versions:set -DnewVersion=${{ github.event.pull_request.head.sha }}
49-
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
50-
- name: Compose with Docker
51-
id: compose_app
52-
# use the following command until #819 will be fixed
53-
run: |
54-
docker-compose -f e2e-tests/docker/selenoid-git.yaml up -d
55-
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d && until [ "$(docker exec kafbat-ui wget --spider --server-response http://localhost:8080/actuator/health 2>&1 | grep -c 'HTTP/1.1 200 OK')" == "1" ]; do echo "Waiting for kafka-ui ..." && sleep 1; done
56-
- name: Run test suite
57-
run: |
58-
./mvnw -B -ntp versions:set -DnewVersion=${{ github.event.pull_request.head.sha }}
59-
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/smoke.xml' -f 'e2e-tests' test -Pprod
60-
- name: Generate allure report
61-
uses: simple-elf/allure-report-action@master
62-
if: always()
63-
id: allure-report
64-
with:
65-
allure_results: ./e2e-tests/allure-results
66-
gh_pages: allure-results
67-
allure_report: allure-report
68-
subfolder: allure-results
69-
report_url: "http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com"
70-
- uses: jakejarvis/s3-sync-action@master
71-
if: always()
72-
env:
73-
AWS_S3_BUCKET: 'kafkaui-allure-reports'
74-
AWS_REGION: 'eu-central-1'
75-
SOURCE_DIR: 'allure-history/allure-results'
76-
- name: Deploy report to Amazon S3
77-
if: always()
78-
uses: Sibz/github-status-action@v1.1.6
79-
with:
80-
authToken: ${{secrets.GITHUB_TOKEN}}
81-
context: "Click Details button to open Allure report"
82-
state: "success"
83-
sha: ${{ github.event.pull_request.head.sha || github.sha }}
84-
target_url: http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com/${{ github.run_number }}
85-
- name: Dump docker logs on failure
86-
if: failure()
87-
uses: jwalton/gh-docker-logs@v2.2.2
20+
uses: ./.github/workflows/e2e-run.yml
21+
secrets: inherit
22+
with:
23+
suite_name: "smoke"
24+
sha: ${{ github.event.pull_request.head.sha }}

0 commit comments

Comments
 (0)