Skip to content

Commit

Permalink
Refactor YOLO
Browse files Browse the repository at this point in the history
  • Loading branch information
Haarolean committed Apr 13, 2024
1 parent a8022fd commit b86a2d8
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 218 deletions.
81 changes: 4 additions & 77 deletions .github/workflows/e2e-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,84 +14,11 @@ on:

permissions:
contents: read
checks: write
statuses: write

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:

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

- name: Pull with Docker
id: pull_chrome
run: |
docker pull selenoid/vnc_chrome:103.0
- 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=${{ github.sha }}
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
- name: Compose with Docker
id: compose_app
# use the following command until #819 will be fixed
run: |
docker-compose -f e2e-tests/selenoid/selenoid-ci.yaml up -d
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
- name: Run test suite
run: |
./mvnw -B -ntp versions:set -DnewVersion=${{ github.sha }}
./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
- name: bruh
run: |
ls -la ./e2e-tests/target/allure-results
- name: Generate Allure report
uses: simple-elf/allure-report-action@master
if: always()
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
if: always()
uses: ryand56/r2-upload-action@latest
with:
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 }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: allure-history/allure-results
destination-dir: .

- name: Add allure link status check
if: always()
uses: Sibz/[email protected]
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Click Details button to view Allure report"
state: "success"
sha: ${{ github.sha }}
target_url: https://reports.kafbat.dev/${{ github.run_number }}

- name: Dump Docker logs on failure
if: failure()
uses: jwalton/[email protected]
uses: ./.github/workflows/e2e-run.yml
with:
suite_name: ${{ github.event.inputs.test_suite }}
137 changes: 137 additions & 0 deletions .github/workflows/e2e-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: "E2E: Run tests"

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

permissions:
contents: read
checks: write
statuses: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set commit SHA env var
run: |
echo "HEAD_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
token: ${{ github.token }}
ref: $HEAD_SHA

- name: Pull chrome docker image
id: pull_chrome
run: |
docker pull selenoid/vnc_chrome:103.0
# TODO https://github.com/marketplace/actions/docker-cache

- 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=$HEAD_SHA
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true
- 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

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

- 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: Compose up
# TODO cache these as well
id: compose_app
# use the following command until #819 will be fixed
run: |
docker-compose -f e2e-tests/selenoid/selenoid-ci.yaml up -d
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
- name: Run test suite
run: |
./mvnw -B -ntp versions:set -DnewVersion=$HEAD_SHA
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/${{ github.event.inputs.test_suite }}.xml' -f 'e2e-tests' test -Pprod
- name: Dump Docker logs on failure
if: failure()
uses: jwalton/[email protected]

- name: Upload allure reports artifact
uses: actions/upload-artifact@v4
with:
name: reports
path: ./e2e-tests/target/allure-results

reports:
runs-on: ubuntu-latest
needs: tests
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/[email protected]
if: ${{ github.repository == 'kafbat/kafka-ui' }}
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
if: ${{ github.repository == 'kafbat/kafka-ui' }}
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
if: ${{ github.repository == 'kafbat/kafka-ui' }}
uses: Sibz/[email protected]
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Click Details button to view Allure report"
state: "success"
sha: $HEAD_SHA
target_url: https://reports.kafbat.dev/${{ github.run_number }}
75 changes: 5 additions & 70 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "E2E: PR healthcheck"
on:
pull_request_target:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
paths:
- "pom.xml"
Expand All @@ -12,76 +12,11 @@ on:

permissions:
contents: read
checks: write
statuses: write

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
with:
token: ${{ github.token }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Pull with Docker
id: pull_chrome
run: |
docker pull selenoid/vnc_chrome:103.0
- 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=${{ github.event.pull_request.head.sha }}
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
- name: Compose with Docker
id: compose_app
# use the following command until #819 will be fixed
run: |
docker-compose -f e2e-tests/selenoid/selenoid-ci.yaml up -d
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
- name: Run test suite
run: |
./mvnw -B -ntp versions:set -DnewVersion=${{ github.event.pull_request.head.sha }}
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/smoke.xml' -f 'e2e-tests' test -Pprod
- name: Generate allure report
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: ./e2e-tests/allure-results
gh_pages: allure-results
allure_report: allure-report
subfolder: allure-results
report_url: "http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com"

- uses: jakejarvis/s3-sync-action@master
if: always()
env:
AWS_S3_BUCKET: 'kafkaui-allure-reports'
AWS_REGION: 'eu-central-1'
SOURCE_DIR: 'allure-history/allure-results'

- name: Deploy report to Amazon S3
if: always()
uses: Sibz/[email protected]
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Click Details button to open Allure report"
state: "success"
sha: ${{ github.event.pull_request.head.sha || github.sha }}
target_url: http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com/${{ github.run_number }}

- name: Dump docker logs on failure
if: failure()
uses: jwalton/[email protected]
uses: ./.github/workflows/e2e-run.yml
with:
suite_name: "smoke"
73 changes: 4 additions & 69 deletions .github/workflows/e2e-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,11 @@ on:

permissions:
contents: read
checks: write
statuses: write

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:

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

- name: Pull with Docker
id: pull_chrome
run: |
docker pull selenoid/vnc_chrome:103.0
- 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=${{ github.sha }}
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
- name: Compose with Docker
id: compose_app
# use the following command until #819 will be fixed
run: |
docker-compose -f e2e-tests/selenoid/selenoid-ci.yaml up -d
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
- name: Run test suite
run: |
./mvnw -B -ntp versions:set -DnewVersion=${{ github.sha }}
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/sanity.xml' -Dsuite=weekly -f 'e2e-tests' test -Pprod
- name: Generate Allure report
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: ./e2e-tests/allure-results
gh_pages: allure-results
allure_report: allure-report
subfolder: allure-results
report_url: "http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com"

- uses: jakejarvis/s3-sync-action@master
if: always()
env:
AWS_S3_BUCKET: 'kafkaui-allure-reports'
AWS_REGION: 'eu-central-1'
SOURCE_DIR: 'allure-history/allure-results'

- name: Deploy report to Amazon S3
if: always()
uses: Sibz/[email protected]
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Click Details button to open Allure report"
state: "success"
sha: ${{ github.sha }}
target_url: http://kafkaui-allure-reports.s3-website.eu-central-1.amazonaws.com/${{ github.run_number }}

- name: Dump Docker logs on failure
if: failure()
uses: jwalton/[email protected]
uses: ./.github/workflows/e2e-run.yml
with:
suite_name: "sanity"
Loading

0 comments on commit b86a2d8

Please sign in to comment.