Browse Source

upd workflow

VladSenyuta 2 years ago
parent
commit
f9527553f7

+ 84 - 0
.github/workflows/e2e-automation.yml

@@ -0,0 +1,84 @@
+name: E2E Automation suite
+on:
+  workflow_dispatch:
+    inputs:
+      test_suite:
+        description: 'Select test suite to run'
+        default: 'regression'
+        required: true
+        type: choice
+        options:
+          - regression
+          - sanity
+          - smoke
+      qase_enabled:
+        description: 'Enable Qase integration'
+        default: false
+        required: true
+        type: boolean
+
+jobs:
+  build-and-test:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+      - name: Set up environment
+        id: set_env_values
+        run: |
+          cat "./kafka-ui-e2e-checks/.env.ci" >> "./kafka-ui-e2e-checks/.env"
+      - name: Pull with Docker
+        id: pull_chrome
+        run: |
+          docker pull selenium/standalone-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 ./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 -DQASEIO_API_TOKEN=${{ secrets.QASEIO_API_TOKEN }} -Dsurefire.suiteXmlFiles='src/test/resources/${{ github.event.inputs.test_suite }}.xml' -Dsuite=${{ github.event.inputs.test_suite }} -Dqase=${{ github.event.inputs.qase_enabled }} -f 'kafka-ui-e2e-checks' test -Pprod
+      - name: Generate Allure report
+        uses: simple-elf/allure-report-action@master
+        if: always()
+        id: allure-report
+        with:
+          allure_results: ./kafka-ui-e2e-checks/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_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+          AWS_REGION: 'eu-central-1'
+          SOURCE_DIR: 'allure-history/allure-results'
+      - name: Deploy report to Amazon S3
+        if: always()
+        uses: Sibz/github-status-action@v1.1.6
+        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/gh-docker-logs@v2.2.1

+ 0 - 1
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/settings/BaseSource.java

@@ -10,7 +10,6 @@ public abstract class BaseSource {
     public static final String CLUSTER_NAME = "local";
     public static final String CLUSTER_NAME = "local";
     private static Config config;
     private static Config config;
     public static final String BROWSER = config().browser();
     public static final String BROWSER = config().browser();
-    public static final String SUITE = config().suite();
 
 
     private static Config config() {
     private static Config config() {
         if (config == null) {
         if (config == null) {

+ 0 - 5
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/settings/configs/Profiles.java

@@ -3,15 +3,10 @@ package com.provectus.kafka.ui.settings.configs;
 import org.aeonbits.owner.Config;
 import org.aeonbits.owner.Config;
 
 
 import static com.provectus.kafka.ui.variables.Browser.CONTAINER;
 import static com.provectus.kafka.ui.variables.Browser.CONTAINER;
-import static com.provectus.kafka.ui.variables.Suite.CUSTOM;
 
 
 public interface Profiles extends Config {
 public interface Profiles extends Config {
 
 
     @Key("browser")
     @Key("browser")
     @DefaultValue(CONTAINER)
     @DefaultValue(CONTAINER)
     String browser();
     String browser();
-
-    @Key("suite")
-    @DefaultValue(CUSTOM)
-    String suite();
 }
 }

+ 5 - 13
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/utilities/qaseUtils/QaseExtension.java

@@ -6,8 +6,6 @@ import java.time.OffsetDateTime;
 import java.time.ZoneOffset;
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
 
 
-import static com.provectus.kafka.ui.settings.BaseSource.SUITE;
-import static com.provectus.kafka.ui.variables.Suite.*;
 import static org.apache.commons.lang3.BooleanUtils.FALSE;
 import static org.apache.commons.lang3.BooleanUtils.FALSE;
 import static org.apache.commons.lang3.BooleanUtils.TRUE;
 import static org.apache.commons.lang3.BooleanUtils.TRUE;
 import static org.apache.commons.lang3.StringUtils.isEmpty;
 import static org.apache.commons.lang3.StringUtils.isEmpty;
@@ -15,18 +13,12 @@ import static org.apache.commons.lang3.StringUtils.isEmpty;
 @Slf4j
 @Slf4j
 public class QaseExtension {
 public class QaseExtension {
 
 
-    private static boolean isSuiteEnabled() {
-        return switch (SUITE) {
-            case CUSTOM, SMOKE -> false;
-            case REGRESSION, SANITY -> true;
-            default -> throw new IllegalStateException("Unexpected value: " + SUITE);
-        };
-    }
-
     public static void testRunSetup() {
     public static void testRunSetup() {
         String qaseApiToken = System.getProperty("QASEIO_API_TOKEN");
         String qaseApiToken = System.getProperty("QASEIO_API_TOKEN");
-        if (isEmpty(qaseApiToken) || !isSuiteEnabled()) {
-            log.warn("Integration with Qase is disabled due to suite settings or token wasn't defined.");
+        String qaseEnabled = System.getProperty("INPUT_QASE_ENABLED");
+        String testSuite = System.getProperty("INPUT_TEST_SUITE");
+        if (isEmpty(qaseApiToken) || !Boolean.parseBoolean(qaseEnabled)) {
+            log.warn("Integration with Qase is disabled due to run config or token wasn't defined.");
             System.setProperty("QASE_ENABLE", FALSE);
             System.setProperty("QASE_ENABLE", FALSE);
         } else {
         } else {
             log.warn("Integration with Qase is enabled. Find this run at https://app.qase.io/run/KAFKAUI.");
             log.warn("Integration with Qase is enabled. Find this run at https://app.qase.io/run/KAFKAUI.");
@@ -35,7 +27,7 @@ public class QaseExtension {
             System.setProperty("QASE_API_TOKEN", qaseApiToken);
             System.setProperty("QASE_API_TOKEN", qaseApiToken);
             System.setProperty("QASE_USE_BULK", TRUE);
             System.setProperty("QASE_USE_BULK", TRUE);
             System.setProperty("QASE_RUN_NAME", DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")
             System.setProperty("QASE_RUN_NAME", DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")
-                    .format(OffsetDateTime.now(ZoneOffset.UTC)) + ": " + "Automation " + SUITE.toUpperCase() + " suite");
+                    .format(OffsetDateTime.now(ZoneOffset.UTC)) + ": " + "Automation " + testSuite.toUpperCase() + " suite");
         }
         }
     }
     }
 }
 }