|
| 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 | + |
| 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: Dump Docker logs on failure |
| 110 | + if: failure() |
| 111 | + |
| 112 | + |
| 113 | + - name: Run test suite |
| 114 | + run: | |
| 115 | + ./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.sha }} |
| 116 | + ./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/${{ inputs.suite_name }}.xml' -f 'e2e-tests' test -Pprod |
| 117 | +
|
| 118 | + - name: Upload allure reports artifact |
| 119 | + if: '!cancelled()' |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: reports |
| 123 | + path: ./e2e-tests/target/allure-results |
| 124 | + retention-days: 7 |
| 125 | + |
| 126 | + reports: |
| 127 | + runs-on: ubuntu-latest |
| 128 | + needs: tests |
| 129 | + if: ${{ !cancelled() && github.repository == 'kafbat/kafka-ui' }} |
| 130 | + steps: |
| 131 | + - name: Download allure reports artifact |
| 132 | + uses: actions/download-artifact@v4 |
| 133 | + with: |
| 134 | + name: reports |
| 135 | + path: ./e2e-tests/target/allure-results |
| 136 | + |
| 137 | + - name: Generate Allure report |
| 138 | + uses: simple-elf/[email protected] |
| 139 | + id: allure-report |
| 140 | + with: |
| 141 | + allure_results: ./e2e-tests/target/allure-results |
| 142 | + gh_pages: allure-results |
| 143 | + allure_report: allure-report |
| 144 | + subfolder: allure-results |
| 145 | + report_url: "https://reports.kafbat.dev" |
| 146 | + |
| 147 | + - name: Upload allure report to R2 |
| 148 | + uses: ryand56/r2-upload-action@latest |
| 149 | + with: |
| 150 | + source-dir: allure-history/allure-results |
| 151 | + destination-dir: . |
| 152 | + r2-bucket: "reports" |
| 153 | + r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} |
| 154 | + r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} |
| 155 | + r2-secret-access-key: ${{ secrets.R2_ACCESS_SECRET_KEY }} |
| 156 | + |
| 157 | + - name: Add allure link status check |
| 158 | + |
| 159 | + with: |
| 160 | + authToken: ${{secrets.GITHUB_TOKEN}} |
| 161 | + context: "Click Details button to view Allure report" |
| 162 | + state: "success" |
| 163 | + sha: ${{ inputs.sha }} |
| 164 | + target_url: https://reports.kafbat.dev/${{ github.run_number }} |
0 commit comments