diff --git a/.github/workflows/schedule.yaml b/.github/workflows/nightly.yaml
similarity index 69%
rename from .github/workflows/schedule.yaml
rename to .github/workflows/nightly.yaml
index 53c18be8b..c1967f295 100644
--- a/.github/workflows/schedule.yaml
+++ b/.github/workflows/nightly.yaml
@@ -1,14 +1,14 @@
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
-name: Scheduled run
+name: Nightly tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
- schedule:
- - cron: '53 0 * * *' # Daily at 00:53 UTC
+ # Triggered on schedule by .github/workflows/scheduled_ci_*.yaml on default branch
+ workflow_dispatch:
jobs:
build:
@@ -22,6 +22,9 @@ jobs:
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v48.1.2
with:
path-to-charm-directory: ${{ matrix.path }}
+ permissions:
+ actions: read
+ contents: read
integration-test:
name: Integration tests
@@ -85,17 +88,36 @@ jobs:
# git push origin gh-pages-beta
# )
- name: Checkout GitHub pages branch
- uses: actions/checkout@v5
+ uses: actions/checkout@v6
with:
ref: gh-pages-beta
path: repo/
+ # ${{ steps.branch.outputs.branch }} will be 8_4_edge for 8.4/edge, 8_0_edge for 8.0/edge and so forth
+ - name: Parse branch name
+ id: branch
+ shell: python
+ run: |
+ import os
+
+ if not os.environ["VAR_REF"].startswith("refs/heads/"):
+ raise Exception(
+ "Allure Report generation assumes `workflow_dispatch` is triggered on a branch"
+ )
+ output = f"branch={os.environ['VAR_REF_NAME'].replace('.', '_').replace('/', '_')}"
+ print(output)
+ with open(os.environ["GITHUB_OUTPUT"], "a") as file:
+ file.write(output)
+ env:
+ VAR_REF: ${{ github.ref }}
+ VAR_REF_NAME: ${{ github.ref_name }}
- 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@v8
with:
path: allure-default-results/
- name: allure-default-results-integration-test
+ pattern: allure-default-results-integration-test-*
+ merge-multiple: true
- name: Download test results
uses: actions/download-artifact@v8
with:
@@ -145,50 +167,65 @@ jobs:
default_result.path.rename(actual_results / default_result.path.name)
- name: Load test report history
run: |
- if [[ -d repo/_latest/history/ ]]
+ if [[ -d repo/${ALLURE_REPORT_DIR}/_latest/history/ ]]
then
echo 'Loading history'
- cp -r repo/_latest/history/ allure-results/
+ cp -r repo/${ALLURE_REPORT_DIR}/_latest/history/ allure-results/
fi
+ env:
+ ALLURE_REPORT_DIR: ${{ steps.branch.outputs.branch }}
- name: Create executor.json
shell: python
run: |
# Reverse engineered from https://github.com/simple-elf/allure-report-action/blob/eca283b643d577c69b8e4f048dd6cd8eb8457cfd/entrypoint.sh
import json
+ import os
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 }}/",
+ "buildOrder": os.environ["VAR_RUN_NUMBER"], # TODO future improvement: use run ID
+ "buildName": f"Run {os.environ["VAR_RUN_ID"]}",
+ "buildUrl": f"https://github.com/{os.environ["VAR_REPOSITORY"]}/actions/runs/{os.environ["VAR_RUN_ID"]}",
+ "reportUrl": f"../{os.environ["VAR_RUN_NUMBER"]}/",
}
with open("allure-results/executor.json", "w") as file:
json.dump(DATA, file)
+ env:
+ VAR_RUN_NUMBER: ${{ github.run_number }}
+ VAR_RUN_ID: ${{ github.run_id }}
+ VAR_REPOSITORY: ${{ github.repository }}
- name: Generate Allure report
run: allure generate
- name: Create index.html
shell: python
run: |
+ import os
+
DATA = f"""
-
+
"""
- with open("repo/index.html", "w") as file:
+ report_dir = os.environ["ALLURE_REPORT_DIR"]
+ with open(f"repo/{report_dir}/index.html", "w") as file:
file.write(DATA)
+ env:
+ VAR_RUN_NUMBER: ${{ github.run_number }}
+ ALLURE_REPORT_DIR: ${{ steps.branch.outputs.branch }}
- name: Update GitHub pages branch
- working-directory: repo/
+ working-directory: repo/${{ steps.branch.outputs.branch }}/
# TODO future improvement: commit message
run: |
- mkdir '${{ github.run_number }}'
+ mkdir "${VAR_RUN_NUMBER}"
rm -f _latest
- ln -s '${{ github.run_number }}' _latest
- cp -r ../allure-report/. _latest/
- git add .
+ ln -s "${VAR_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 }}"
+ git commit -m "Allure report ${VAR_RUN_NUMBER}"
# Uses token set in checkout step
git push origin gh-pages-beta
+ env:
+ VAR_RUN_NUMBER: ${{ github.run_number }}