allure-framework / setup-allurectl

Set up your GitHub Actions workflow with a specific version of allurectl
https://qameta.io
Apache License 2.0
13 stars 3 forks source link

Allurectl GitHub Actions fails to finishing tests result upload to Test Ops side #137

Closed BAStos525 closed 1 year ago

BAStos525 commented 1 year ago

Hello! We have a problem with tests results uploading from GitHub Actions workflow to Test Ops side both either triggering from Launches tab or from Actions tab on GitHub repository. The error is:

BUILD SUCCESSFUL in ***m ***6s
*** actionable task: *** executed
Watcher is waiting for indexing complete...
Error:  Failed to get total files count in /home/runner/work/iroha-java/iroha-java/build/allure-results. Waiting stopped immidiatley.
Error:  Failed to get total files count in /home/runner/work/iroha-java/iroha-java/build/allure-results. Waiting stopped immidiatley.
Watcher is waiting until files processed
Total files indexed: 0 || Finished files: 0 || Orphan Files: 0
Total files indexed: 0 || Finished files: 0 || Orphan Files: 0
Waiting Finished. Waited for 200ns
+----------------------------------------------------+
| Indexer Stats                                      |
+-----------+-------------+--------+--------+--------+
| INDEXING: |   Total=0   |        |        |        |
+-----------+-------------+--------+--------+--------+
|   STATS:  |     type    |  count |        |        |
+-----------+-------------+--------+--------+--------+
|  TIMINGS: | Duration=0s | Min=0s | Avg=0s | Max=0s |
+-----------+-------------+--------+--------+--------+
+--------------------------------------------------------------------------------------------+
| Uploading Stats                                                                            |
+----------+----------------+--------------+-----------------+---------------+---------------+
|  FILES:  | TotalBatches=0 | TotalFiles=0 | UploadedFiles=0 | TotalSize=0 B | ErrorsCount=0 |
+----------+----------------+--------------+-----------------+---------------+---------------+
| TIMINGS: | Duration=0s    |    Min=0s    |      Avg=0s     |     Max=0s    |               |
+----------+----------------+--------------+-----------------+---------------+---------------+
Watcher finished in [***m***9.7872075[68](https://github.com/BAStos525/iroha-java/actions/runs/6328111264/job/17185505777#step:6:69)s]
Session [664] finished
Job Run [299] stopped

In this case we see the complete Job configured (bidirectional integration between GH Actions and Allure Test Ops) and we see the created launch item in Test Ops GUI where all tests are in progress (blue line). So, allure watch job can not send the final state of tests results? This problem touches both cases when to execute all tests and some tests set under test cases selection.

GitHub Actions workflow:

name: Upload test results to Allure TestOps

on:
  workflow_dispatch:
    inputs:
      TEST_ENDPOINT:
        description: "Endpoint for tests"
        required: true
        default: https://***
      TEST_BROWSER:
        description: "Browser for tests"
        required: true
        default: chrome
      ALLURE_JOB_RUN_ID:
        description: "ALLURE_JOB_RUN_ID service parameter. Leave blank."
        required: false
      ALLURE_USERNAME:
        description: "ALLURE_USERNAME service parameter. Leave blank"
        required: false

env:
  ALLURE_ENDPOINT: https://***
  ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
  ALLURE_PROJECT_ID: ${{ secrets.ALLURE_PROJECT_ID }}
  ALLURE_TESTPLAN_PATH: "./testplan.json"
  ALLURE_RESULTS: "build/allure-results"
  ALLURE_JOB_RUN_ID: ${{ github.event.inputs.ALLURE_JOB_RUN_ID }}

jobs:
  all-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 11
        uses: actions/setup-java@v3.11.0
        with:
          java-version: '11'
          distribution: 'temurin'
      - name: Install and configure allurectl
        uses: allure-framework/setup-allurectl@v1
        with:
          allure-endpoint: https://***
          allure-token: ${{ secrets.ALLURE_TOKEN }}
          allure-project-id: ${{ secrets.ALLURE_PROJECT_ID }}
      - name: Prepare TestPlan
        run: allurectl job-run plan --output-file ${ALLURE_TESTPLAN_PATH}
      - name: Build with Gradle
        continue-on-error: true
        run: |
          allurectl watch -- ./gradlew clean --continue
          export $( allurectl job-run env)
          printenv | grep TEST_
          printenv | grep ALLURE_
        env:
          TEST_ENDPOINT: ${{ github.event.inputs.TEST_ENDPOINT }}
          TEST_BROWSER: ${{ github.event.inputs.TEST_BROWSER }}
      - name: Get ALLURE_ environments just to check
        run: | 
          printenv | grep ALLURE_
      - name: Get GITHUB_ environments just to check
        run: | 
          printenv | grep GITHUB_

Could you please help?