From 1a70e98a7dde36f1df85078c4c0078d37156de37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sinclert=20P=C3=A9rez?= Date: Mon, 1 Dec 2025 11:12:31 +0100 Subject: [PATCH 1/4] Remove allure-report step from CI / release --- .github/workflows/ci.yaml | 2 - .github/workflows/integration_test.yaml | 136 ------------------------ .github/workflows/release.yaml | 4 - .github/workflows/release_test.yaml | 136 ------------------------ .github/workflows/schedule.yaml | 4 - 5 files changed, 282 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a0ba2a9b0..00a64abee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,5 +77,3 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit - permissions: - contents: write # Needed for Allure Report diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index dc3af7a38..3627f89c4 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -188,139 +188,3 @@ jobs: timeout-minutes: 1 if: ${{ success() || (failure() && steps.spread.outcome == 'failure') }} run: df --human-readable - - allure-report: - # TODO future improvement: use concurrency group for job - name: Publish Allure report - if: ${{ !cancelled() && github.event_name == 'schedule' && github.run_attempt == '1' }} - needs: - - integration-test - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Download Allure - # Following instructions from https://allurereport.org/docs/install-for-linux/#install-from-a-deb-package - run: gh release download --repo allure-framework/allure2 --pattern 'allure_*.deb' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Allure - run: | - sudo apt-get update - sudo apt-get install ./allure_*.deb -y - # For first run, manually create branch with no history - # (e.g. - # git checkout --orphan gh-pages-beta - # git rm -rf . - # touch .nojekyll - # git add .nojekyll - # git commit -m "Initial commit" - # git push origin gh-pages-beta - # ) - - name: Checkout GitHub pages branch - uses: actions/checkout@v5 - with: - ref: gh-pages-beta - path: repo/ - - name: Download default test results - # Default test results in case the integration tests time out or runner set up fails - # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) - uses: actions/download-artifact@v5 - with: - path: allure-default-results/ - name: allure-default-results-integration-test - - name: Download test results - uses: actions/download-artifact@v5 - with: - path: allure-results/ - pattern: allure-results-integration-test-* - merge-multiple: true - - name: Combine Allure default results & actual results - # For every test: if actual result available, use that. Otherwise, use default result - # So that, if actual result not available, Allure report will show "unknown"/"failed" test result - # instead of omitting the test - shell: python - run: | - import dataclasses - import json - import pathlib - - - @dataclasses.dataclass(frozen=True) - class Result: - test_case_id: str - path: pathlib.Path - - def __eq__(self, other): - if not isinstance(other, type(self)): - return False - return self.test_case_id == other.test_case_id - - - actual_results = pathlib.Path("allure-results") - default_results = pathlib.Path("allure-default-results") - - results: dict[pathlib.Path, set[Result]] = { - actual_results: set(), - default_results: set(), - } - for directory, results_ in results.items(): - for path in directory.glob("*-result.json"): - with path.open("r") as file: - id_ = json.load(file)["testCaseId"] - results_.add(Result(id_, path)) - - actual_results.mkdir(exist_ok=True) - - missing_results = results[default_results] - results[actual_results] - for default_result in missing_results: - # Move to `actual_results` directory - default_result.path.rename(actual_results / default_result.path.name) - - name: Load test report history - run: | - if [[ -d repo/_latest/history/ ]] - then - echo 'Loading history' - cp -r repo/_latest/history/ allure-results/ - fi - - name: Create executor.json - shell: python - run: | - # Reverse engineered from https://github.com/simple-elf/allure-report-action/blob/eca283b643d577c69b8e4f048dd6cd8eb8457cfd/entrypoint.sh - import json - - DATA = { - "name": "GitHub Actions", - "type": "github", - "buildOrder": ${{ github.run_number }}, # TODO future improvement: use run ID - "buildName": "Run ${{ github.run_id }}", - "buildUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", - "reportUrl": "../${{ github.run_number }}/", - } - with open("allure-results/executor.json", "w") as file: - json.dump(DATA, file) - - name: Generate Allure report - run: allure generate - - name: Create index.html - shell: python - run: | - DATA = f""" - - - - """ - with open("repo/index.html", "w") as file: - file.write(DATA) - - name: Update GitHub pages branch - working-directory: repo/ - # TODO future improvement: commit message - run: | - mkdir '${{ github.run_number }}' - rm -f _latest - ln -s '${{ github.run_number }}' _latest - cp -r ../allure-report/. _latest/ - git add . - git config user.name "GitHub Actions" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git commit -m "Allure report ${{ github.run_number }}" - # Uses token set in checkout step - git push origin gh-pages-beta diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 39ebe1199..f426ce85c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -29,8 +29,6 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit - permissions: - contents: write # Needed for Allure Report release-tests: name: Release tests @@ -40,8 +38,6 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit - permissions: - contents: write # Needed for Allure Report release-libraries: name: Release libraries diff --git a/.github/workflows/release_test.yaml b/.github/workflows/release_test.yaml index c5a2ba47e..24f40240b 100644 --- a/.github/workflows/release_test.yaml +++ b/.github/workflows/release_test.yaml @@ -188,139 +188,3 @@ jobs: timeout-minutes: 1 if: ${{ success() || (failure() && steps.spread.outcome == 'failure') }} run: df --human-readable - - allure-report: - # TODO future improvement: use concurrency group for job - name: Publish Allure report - if: ${{ !cancelled() && github.event_name == 'schedule' && github.run_attempt == '1' }} - needs: - - release-test - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Download Allure - # Following instructions from https://allurereport.org/docs/install-for-linux/#install-from-a-deb-package - run: gh release download --repo allure-framework/allure2 --pattern 'allure_*.deb' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Allure - run: | - sudo apt-get update - sudo apt-get install ./allure_*.deb -y - # For first run, manually create branch with no history - # (e.g. - # git checkout --orphan gh-pages-beta - # git rm -rf . - # touch .nojekyll - # git add .nojekyll - # git commit -m "Initial commit" - # git push origin gh-pages-beta - # ) - - name: Checkout GitHub pages branch - uses: actions/checkout@v5 - with: - ref: gh-pages-beta - path: repo/ - - name: Download default test results - # Default test results in case the release tests time out or runner set up fails - # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) - uses: actions/download-artifact@v5 - with: - path: allure-default-results/ - name: allure-default-results-release-test - - name: Download test results - uses: actions/download-artifact@v5 - with: - path: allure-results/ - pattern: allure-results-release-test-* - merge-multiple: true - - name: Combine Allure default results & actual results - # For every test: if actual result available, use that. Otherwise, use default result - # So that, if actual result not available, Allure report will show "unknown"/"failed" test result - # instead of omitting the test - shell: python - run: | - import dataclasses - import json - import pathlib - - - @dataclasses.dataclass(frozen=True) - class Result: - test_case_id: str - path: pathlib.Path - - def __eq__(self, other): - if not isinstance(other, type(self)): - return False - return self.test_case_id == other.test_case_id - - - actual_results = pathlib.Path("allure-results") - default_results = pathlib.Path("allure-default-results") - - results: dict[pathlib.Path, set[Result]] = { - actual_results: set(), - default_results: set(), - } - for directory, results_ in results.items(): - for path in directory.glob("*-result.json"): - with path.open("r") as file: - id_ = json.load(file)["testCaseId"] - results_.add(Result(id_, path)) - - actual_results.mkdir(exist_ok=True) - - missing_results = results[default_results] - results[actual_results] - for default_result in missing_results: - # Move to `actual_results` directory - default_result.path.rename(actual_results / default_result.path.name) - - name: Load test report history - run: | - if [[ -d repo/_latest/history/ ]] - then - echo 'Loading history' - cp -r repo/_latest/history/ allure-results/ - fi - - name: Create executor.json - shell: python - run: | - # Reverse engineered from https://github.com/simple-elf/allure-report-action/blob/eca283b643d577c69b8e4f048dd6cd8eb8457cfd/entrypoint.sh - import json - - DATA = { - "name": "GitHub Actions", - "type": "github", - "buildOrder": ${{ github.run_number }}, # TODO future improvement: use run ID - "buildName": "Run ${{ github.run_id }}", - "buildUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", - "reportUrl": "../${{ github.run_number }}/", - } - with open("allure-results/executor.json", "w") as file: - json.dump(DATA, file) - - name: Generate Allure report - run: allure generate - - name: Create index.html - shell: python - run: | - DATA = f""" - - - - """ - with open("repo/index.html", "w") as file: - file.write(DATA) - - name: Update GitHub pages branch - working-directory: repo/ - # TODO future improvement: commit message - run: | - mkdir '${{ github.run_number }}' - rm -f _latest - ln -s '${{ github.run_number }}' _latest - cp -r ../allure-report/. _latest/ - git add . - git config user.name "GitHub Actions" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git commit -m "Allure report ${{ github.run_number }}" - # Uses token set in checkout step - git push origin gh-pages-beta diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml index e59485526..aba3c14b1 100644 --- a/.github/workflows/schedule.yaml +++ b/.github/workflows/schedule.yaml @@ -23,8 +23,6 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit - permissions: - contents: write # Needed for Allure Report release-test: name: Release tests @@ -34,5 +32,3 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit - permissions: - contents: write # Needed for Allure Report From af7a7e7bcea049a815ee991993046b7918f7e9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sinclert=20P=C3=A9rez?= Date: Mon, 1 Dec 2025 11:18:30 +0100 Subject: [PATCH 2/4] Include allure-report step into schedule --- .github/workflows/schedule.yaml | 138 ++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml index aba3c14b1..c42ce2e4b 100644 --- a/.github/workflows/schedule.yaml +++ b/.github/workflows/schedule.yaml @@ -32,3 +32,141 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit + + allure-report: + name: Publish Allure report + if: ${{ !cancelled() && github.run_attempt == '1' }} + needs: + - integration-test + - release-test + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: write + steps: + - name: Download Allure + # Following instructions from https://allurereport.org/docs/install-for-linux/#install-from-a-deb-package + run: gh release download --repo allure-framework/allure2 --pattern 'allure_*.deb' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install Allure + run: | + sudo apt-get update + sudo apt-get install ./allure_*.deb -y + # For first run, manually create branch with no history + # (e.g. + # git checkout --orphan gh-pages-beta + # git rm -rf . + # touch .nojekyll + # git add .nojekyll + # git commit -m "Initial commit" + # git push origin gh-pages-beta + # ) + - name: Checkout GitHub pages branch + uses: actions/checkout@v5 + with: + ref: gh-pages-beta + path: repo/ + - name: Download default test results + # Default test results in case the integration tests time out or runner set up fails + # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) + uses: actions/download-artifact@v5 + with: + path: allure-default-results/ + name: allure-default-results-integration-test + - name: Download test results + uses: actions/download-artifact@v5 + with: + path: allure-results/ + pattern: allure-results-integration-test-* + merge-multiple: true + - name: Combine Allure default results & actual results + # For every test: if actual result available, use that. Otherwise, use default result + # So that, if actual result not available, Allure report will show "unknown"/"failed" test result + # instead of omitting the test + shell: python + run: | + import dataclasses + import json + import pathlib + + + @dataclasses.dataclass(frozen=True) + class Result: + test_case_id: str + path: pathlib.Path + + def __eq__(self, other): + if not isinstance(other, type(self)): + return False + return self.test_case_id == other.test_case_id + + + actual_results = pathlib.Path("allure-results") + default_results = pathlib.Path("allure-default-results") + + results: dict[pathlib.Path, set[Result]] = { + actual_results: set(), + default_results: set(), + } + for directory, results_ in results.items(): + for path in directory.glob("*-result.json"): + with path.open("r") as file: + id_ = json.load(file)["testCaseId"] + results_.add(Result(id_, path)) + + actual_results.mkdir(exist_ok=True) + + missing_results = results[default_results] - results[actual_results] + for default_result in missing_results: + # Move to `actual_results` directory + default_result.path.rename(actual_results / default_result.path.name) + - name: Load test report history + run: | + if [[ -d repo/_latest/history/ ]] + then + echo 'Loading history' + cp -r repo/_latest/history/ allure-results/ + fi + - name: Create executor.json + shell: python + run: | + # Reverse engineered from https://github.com/simple-elf/allure-report-action/blob/eca283b643d577c69b8e4f048dd6cd8eb8457cfd/entrypoint.sh + import json + + DATA = { + "name": "GitHub Actions", + "type": "github", + "buildOrder": ${{ github.run_number }}, # TODO future improvement: use run ID + "buildName": "Run ${{ github.run_id }}", + "buildUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "reportUrl": "../${{ github.run_number }}/", + } + with open("allure-results/executor.json", "w") as file: + json.dump(DATA, file) + - name: Generate Allure report + run: allure generate + - name: Create index.html + shell: python + run: | + DATA = f""" + + + + """ + with open("repo/index.html", "w") as file: + file.write(DATA) + - name: Update GitHub pages branch + working-directory: repo/ + # TODO future improvement: commit message + run: | + mkdir '${{ github.run_number }}' + rm -f _latest + ln -s '${{ github.run_number }}' _latest + cp -r ../allure-report/. _latest/ + git add . + git config user.name "GitHub Actions" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "Allure report ${{ github.run_number }}" + # Uses token set in checkout step + git push origin gh-pages-beta From 21c20c28a8dc50c078cfe1ab15209bb128f57659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sinclert=20P=C3=A9rez?= Date: Mon, 1 Dec 2025 11:19:41 +0100 Subject: [PATCH 3/4] [TEST] --- .github/workflows/ci.yaml | 138 ++++++++++++++++++++++++ .github/workflows/integration_test.yaml | 6 +- .github/workflows/release_test.yaml | 6 +- 3 files changed, 144 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 00a64abee..6980a2b93 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,3 +77,141 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit + + # TODO: Remove before merging + allure-report: + name: Publish Allure report + if: ${{ !cancelled() && github.run_attempt == '1' }} + needs: + - integration-test + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: write + steps: + - name: Download Allure + # Following instructions from https://allurereport.org/docs/install-for-linux/#install-from-a-deb-package + run: gh release download --repo allure-framework/allure2 --pattern 'allure_*.deb' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install Allure + run: | + sudo apt-get update + sudo apt-get install ./allure_*.deb -y + # For first run, manually create branch with no history + # (e.g. + # git checkout --orphan gh-pages-beta + # git rm -rf . + # touch .nojekyll + # git add .nojekyll + # git commit -m "Initial commit" + # git push origin gh-pages-beta + # ) + - name: Checkout GitHub pages branch + uses: actions/checkout@v5 + with: + ref: gh-pages-beta + path: repo/ + - name: Download default test results + # Default test results in case the integration tests time out or runner set up fails + # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) + uses: actions/download-artifact@v5 + with: + path: allure-default-results/ + name: allure-default-results-integration-test + - name: Download test results + uses: actions/download-artifact@v5 + with: + path: allure-results/ + pattern: allure-results-integration-test-* + merge-multiple: true + - name: Combine Allure default results & actual results + # For every test: if actual result available, use that. Otherwise, use default result + # So that, if actual result not available, Allure report will show "unknown"/"failed" test result + # instead of omitting the test + shell: python + run: | + import dataclasses + import json + import pathlib + + + @dataclasses.dataclass(frozen=True) + class Result: + test_case_id: str + path: pathlib.Path + + def __eq__(self, other): + if not isinstance(other, type(self)): + return False + return self.test_case_id == other.test_case_id + + + actual_results = pathlib.Path("allure-results") + default_results = pathlib.Path("allure-default-results") + + results: dict[pathlib.Path, set[Result]] = { + actual_results: set(), + default_results: set(), + } + for directory, results_ in results.items(): + for path in directory.glob("*-result.json"): + with path.open("r") as file: + id_ = json.load(file)["testCaseId"] + results_.add(Result(id_, path)) + + actual_results.mkdir(exist_ok=True) + + missing_results = results[default_results] - results[actual_results] + for default_result in missing_results: + # Move to `actual_results` directory + default_result.path.rename(actual_results / default_result.path.name) + - name: Load test report history + run: | + if [[ -d repo/_latest/history/ ]] + then + echo 'Loading history' + cp -r repo/_latest/history/ allure-results/ + fi + - name: Create executor.json + shell: python + run: | + # Reverse engineered from https://github.com/simple-elf/allure-report-action/blob/eca283b643d577c69b8e4f048dd6cd8eb8457cfd/entrypoint.sh + import json + + DATA = { + "name": "GitHub Actions", + "type": "github", + "buildOrder": ${{ github.run_number }}, # TODO future improvement: use run ID + "buildName": "Run ${{ github.run_id }}", + "buildUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "reportUrl": "../${{ github.run_number }}/", + } + with open("allure-results/executor.json", "w") as file: + json.dump(DATA, file) + - name: Generate Allure report + run: allure generate + - name: Create index.html + shell: python + run: | + DATA = f""" + + + + """ + with open("repo/index.html", "w") as file: + file.write(DATA) + - name: Update GitHub pages branch + working-directory: repo/ + # TODO future improvement: commit message + run: | + mkdir '${{ github.run_number }}' + rm -f _latest + ln -s '${{ github.run_number }}' _latest + cp -r ../allure-report/. _latest/ + git add . + git config user.name "GitHub Actions" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "Allure report ${{ github.run_number }}" + # Uses token set in checkout step + git push origin gh-pages-beta diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index 3627f89c4..f5c1ae594 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -71,12 +71,12 @@ jobs: with open(os.environ["GITHUB_OUTPUT"], "a") as file: file.write(output) - name: Generate Allure default test results - if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} + if: ${{ github.run_attempt == '1' }} run: tox run -e integration -- tests/integration/integration --allure-default-dir=allure-default-results - name: Upload Allure default results # Default test results in case the integration tests time out or runner set up fails # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) - if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} + if: ${{ github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-default-results-integration-test @@ -137,7 +137,7 @@ jobs: # Only upload results from one spread system & one spread variant # Allure can only process one result per pytest test ID. If parameterization is done via # spread instead of pytest, there will be overlapping pytest test IDs. - if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.event_name == 'schedule' && github.run_attempt == '1' }} + if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-results-integration-test-${{ matrix.job.name_in_artifact }} diff --git a/.github/workflows/release_test.yaml b/.github/workflows/release_test.yaml index 24f40240b..6960750db 100644 --- a/.github/workflows/release_test.yaml +++ b/.github/workflows/release_test.yaml @@ -71,12 +71,12 @@ jobs: with open(os.environ["GITHUB_OUTPUT"], "a") as file: file.write(output) - name: Generate Allure default test results - if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} + if: ${{ github.run_attempt == '1' }} run: tox run -e integration -- tests/integration/release --allure-default-dir=allure-default-results - name: Upload Allure default results # Default test results in case the integration tests time out or runner set up fails # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) - if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} + if: ${{ github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-default-results-release-test @@ -137,7 +137,7 @@ jobs: # Only upload results from one spread system & one spread variant # Allure can only process one result per pytest test ID. If parameterization is done via # spread instead of pytest, there will be overlapping pytest test IDs. - if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.event_name == 'schedule' && github.run_attempt == '1' }} + if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-results-release-test-${{ matrix.job.name_in_artifact }} From 608176a567bb41442f7fd0780351f946ed30414b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sinclert=20P=C3=A9rez?= Date: Tue, 2 Dec 2025 10:01:13 +0100 Subject: [PATCH 4/4] Revert "[TEST]" This reverts commit 42c7fec6f454ef95fae3d1aab95e9feb1b9c628f. --- .github/workflows/ci.yaml | 138 ------------------------ .github/workflows/integration_test.yaml | 6 +- .github/workflows/release_test.yaml | 6 +- 3 files changed, 6 insertions(+), 144 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6980a2b93..00a64abee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,141 +77,3 @@ jobs: with: artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: inherit - - # TODO: Remove before merging - allure-report: - name: Publish Allure report - if: ${{ !cancelled() && github.run_attempt == '1' }} - needs: - - integration-test - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: write - steps: - - name: Download Allure - # Following instructions from https://allurereport.org/docs/install-for-linux/#install-from-a-deb-package - run: gh release download --repo allure-framework/allure2 --pattern 'allure_*.deb' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Allure - run: | - sudo apt-get update - sudo apt-get install ./allure_*.deb -y - # For first run, manually create branch with no history - # (e.g. - # git checkout --orphan gh-pages-beta - # git rm -rf . - # touch .nojekyll - # git add .nojekyll - # git commit -m "Initial commit" - # git push origin gh-pages-beta - # ) - - name: Checkout GitHub pages branch - uses: actions/checkout@v5 - with: - ref: gh-pages-beta - path: repo/ - - name: Download default test results - # Default test results in case the integration tests time out or runner set up fails - # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) - uses: actions/download-artifact@v5 - with: - path: allure-default-results/ - name: allure-default-results-integration-test - - name: Download test results - uses: actions/download-artifact@v5 - with: - path: allure-results/ - pattern: allure-results-integration-test-* - merge-multiple: true - - name: Combine Allure default results & actual results - # For every test: if actual result available, use that. Otherwise, use default result - # So that, if actual result not available, Allure report will show "unknown"/"failed" test result - # instead of omitting the test - shell: python - run: | - import dataclasses - import json - import pathlib - - - @dataclasses.dataclass(frozen=True) - class Result: - test_case_id: str - path: pathlib.Path - - def __eq__(self, other): - if not isinstance(other, type(self)): - return False - return self.test_case_id == other.test_case_id - - - actual_results = pathlib.Path("allure-results") - default_results = pathlib.Path("allure-default-results") - - results: dict[pathlib.Path, set[Result]] = { - actual_results: set(), - default_results: set(), - } - for directory, results_ in results.items(): - for path in directory.glob("*-result.json"): - with path.open("r") as file: - id_ = json.load(file)["testCaseId"] - results_.add(Result(id_, path)) - - actual_results.mkdir(exist_ok=True) - - missing_results = results[default_results] - results[actual_results] - for default_result in missing_results: - # Move to `actual_results` directory - default_result.path.rename(actual_results / default_result.path.name) - - name: Load test report history - run: | - if [[ -d repo/_latest/history/ ]] - then - echo 'Loading history' - cp -r repo/_latest/history/ allure-results/ - fi - - name: Create executor.json - shell: python - run: | - # Reverse engineered from https://github.com/simple-elf/allure-report-action/blob/eca283b643d577c69b8e4f048dd6cd8eb8457cfd/entrypoint.sh - import json - - DATA = { - "name": "GitHub Actions", - "type": "github", - "buildOrder": ${{ github.run_number }}, # TODO future improvement: use run ID - "buildName": "Run ${{ github.run_id }}", - "buildUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", - "reportUrl": "../${{ github.run_number }}/", - } - with open("allure-results/executor.json", "w") as file: - json.dump(DATA, file) - - name: Generate Allure report - run: allure generate - - name: Create index.html - shell: python - run: | - DATA = f""" - - - - """ - with open("repo/index.html", "w") as file: - file.write(DATA) - - name: Update GitHub pages branch - working-directory: repo/ - # TODO future improvement: commit message - run: | - mkdir '${{ github.run_number }}' - rm -f _latest - ln -s '${{ github.run_number }}' _latest - cp -r ../allure-report/. _latest/ - git add . - git config user.name "GitHub Actions" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git commit -m "Allure report ${{ github.run_number }}" - # Uses token set in checkout step - git push origin gh-pages-beta diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index f5c1ae594..3627f89c4 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -71,12 +71,12 @@ jobs: with open(os.environ["GITHUB_OUTPUT"], "a") as file: file.write(output) - name: Generate Allure default test results - if: ${{ github.run_attempt == '1' }} + if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} run: tox run -e integration -- tests/integration/integration --allure-default-dir=allure-default-results - name: Upload Allure default results # Default test results in case the integration tests time out or runner set up fails # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) - if: ${{ github.run_attempt == '1' }} + if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-default-results-integration-test @@ -137,7 +137,7 @@ jobs: # Only upload results from one spread system & one spread variant # Allure can only process one result per pytest test ID. If parameterization is done via # spread instead of pytest, there will be overlapping pytest test IDs. - if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.run_attempt == '1' }} + if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.event_name == 'schedule' && github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-results-integration-test-${{ matrix.job.name_in_artifact }} diff --git a/.github/workflows/release_test.yaml b/.github/workflows/release_test.yaml index 6960750db..24f40240b 100644 --- a/.github/workflows/release_test.yaml +++ b/.github/workflows/release_test.yaml @@ -71,12 +71,12 @@ jobs: with open(os.environ["GITHUB_OUTPUT"], "a") as file: file.write(output) - name: Generate Allure default test results - if: ${{ github.run_attempt == '1' }} + if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} run: tox run -e integration -- tests/integration/release --allure-default-dir=allure-default-results - name: Upload Allure default results # Default test results in case the integration tests time out or runner set up fails # (So that Allure report will show "unknown"/"failed" test result, instead of omitting the test) - if: ${{ github.run_attempt == '1' }} + if: ${{ github.event_name == 'schedule' && github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-default-results-release-test @@ -137,7 +137,7 @@ jobs: # Only upload results from one spread system & one spread variant # Allure can only process one result per pytest test ID. If parameterization is done via # spread instead of pytest, there will be overlapping pytest test IDs. - if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.run_attempt == '1' }} + if: ${{ (success() || (failure() && steps.spread.outcome == 'failure')) && startsWith(matrix.job.spread_job, 'github-ci:ubuntu-24.04:') && endsWith(matrix.job.spread_job, ':juju36') && github.event_name == 'schedule' && github.run_attempt == '1' }} uses: actions/upload-artifact@v4 with: name: allure-results-release-test-${{ matrix.job.name_in_artifact }}