diff --git a/.github/workflows/approve_renovate_pr.yaml b/.github/workflows/approve_renovate_pr.yaml deleted file mode 100644 index 405c993a464..00000000000 --- a/.github/workflows/approve_renovate_pr.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2025 Canonical Ltd. -# See LICENSE file for licensing details. -name: Approve Renovate pull request - -on: - pull_request: - types: - - opened - -jobs: - approve-pr: - name: Approve Renovate pull request - uses: canonical/data-platform-workflows/.github/workflows/approve_renovate_pr.yaml@v48.0.1 - permissions: - pull-requests: write # Needed to approve PR diff --git a/.github/workflows/automatic-doc-checks.yml b/.github/workflows/automatic-doc-checks.yml deleted file mode 100644 index 145aa520620..00000000000 --- a/.github/workflows/automatic-doc-checks.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -name: Automatic doc checks - -on: - push: - branches: [ main ] - pull_request: - paths: - - 'docs/**' # Only run on changes to the docs directory - - workflow_dispatch: - # Manual trigger - - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - documentation-checks: - uses: canonical/documentation-workflows/.github/workflows/documentation-checks.yaml@main - with: - working-directory: "docs" - fetch-depth: 0 - permissions: {} diff --git a/.github/workflows/check_pr.yaml b/.github/workflows/check_pr.yaml deleted file mode 100644 index b0372f6662a..00000000000 --- a/.github/workflows/check_pr.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2025 Canonical Ltd. -# See LICENSE file for licensing details. -name: Check pull request - -on: - pull_request: - types: - - opened - - labeled - - unlabeled - - edited - branches: - - main - - '*/edge' - -jobs: - check-pr: - name: Check pull request - uses: canonical/data-platform-workflows/.github/workflows/check_charm_pr.yaml@v48.0.1 - permissions: {} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index d05779e3de7..00000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 2022 Canonical Ltd. -# See LICENSE file for licensing details. -name: Tests - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - pull_request: - paths-ignore: - - '.gitignore' - - '.jujuignore' - - 'LICENSE' - - '**.md' - - .github/renovate.json5 - - 'docs/**' - - 'terraform/**' - # Triggered on schedule by .github/workflows/scheduled_ci_*.yaml on default branch - workflow_dispatch: - # Triggered on push by .github/workflows/release.yaml - workflow_call: - outputs: - artifact-prefix: - description: build_charm.yaml `artifact-prefix` output - value: ${{ jobs.build.outputs.artifact-prefix }} - secrets: - AWS_ACCESS_KEY: - required: true - AWS_SECRET_KEY: - required: true - GCP_ACCESS_KEY: - required: true - GCP_SECRET_KEY: - required: true - UBUNTU_PRO_TOKEN: - required: true - LANDSCAPE_ACCOUNT_NAME: - required: true - LANDSCAPE_REGISTRATION_KEY: - required: true - -jobs: - lint-workflows: - name: Lint .github/workflows/ - uses: canonical/data-platform-workflows/.github/workflows/lint_workflows.yaml@v48.0.1 - permissions: - contents: read - - lint: - name: Lint - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: Install tox & poetry - run: | - pipx install tox - pipx install poetry - - name: tox run -e lint - run: tox run -e lint - permissions: {} - - unit-test: - name: Unit test charm - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: Install tox & poetry - run: | - pipx install tox - pipx install poetry - - name: Run tests - run: tox run -e unit - permissions: {} - - alert-test: - name: Test Prometheus Alert Rules - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout repo - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: Install prometheus snap - run: sudo snap install prometheus - - name: Check validity of prometheus alert rules - run: promtool check rules src/prometheus_alert_rules/* - - name: Run unit tests for prometheus alert rules - run: promtool test rules tests/alerts/*.yaml - permissions: {} - - build: - name: Build charm - uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v48.0.1 - permissions: - actions: read # Needed for GitHub API call to get workflow version - contents: read - - integration-test: - name: Integration test charm - needs: - - lint-workflows - - lint - - unit-test - - build - uses: ./.github/workflows/integration_test.yaml - with: - artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} - secrets: - AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} - AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} - GCP_ACCESS_KEY: ${{ secrets.GCP_ACCESS_KEY }} - GCP_SECRET_KEY: ${{ secrets.GCP_SECRET_KEY }} - UBUNTU_PRO_TOKEN: ${{ secrets.UBUNTU_PRO_TOKEN }} - LANDSCAPE_ACCOUNT_NAME: ${{ secrets.LANDSCAPE_ACCOUNT_NAME }} - LANDSCAPE_REGISTRATION_KEY: ${{ secrets.LANDSCAPE_REGISTRATION_KEY }} - permissions: - contents: write # Needed for Allure Report diff --git a/.github/workflows/cla-check.yml b/.github/workflows/cla-check.yml deleted file mode 100644 index c8a3f5a6d8d..00000000000 --- a/.github/workflows/cla-check.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: CLA check - -on: - pull_request: - branches: [main] - -jobs: - cla-check: - runs-on: ubuntu-24.04 - steps: - - name: Check if Canonical's Contributor License Agreement has been signed - uses: canonical/has-signed-canonical-cla@v2 - permissions: {} diff --git a/.github/workflows/documentation_checks.yaml b/.github/workflows/documentation_checks.yaml new file mode 100644 index 00000000000..8b7284d2ef6 --- /dev/null +++ b/.github/workflows/documentation_checks.yaml @@ -0,0 +1,42 @@ +name: Automatic documentation checks + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - main + paths: + - 'docs/**' + pull_request: + paths: + - 'docs/**' + +jobs: + check-docs: + name: Check documentation + runs-on: ubuntu-latest + timeout-minutes: 30 + defaults: + run: + working-directory: docs + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Set up environment + run: | + sudo apt-get install -y aspell aspell-en + sudo snap install woke + - run: make install + - name: Spell check + run: make spelling + - name: Inclusive language check + run: make woke + - name: Link check + run: make linkcheck + permissions: + contents: read diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml deleted file mode 100644 index 3c8fae006a4..00000000000 --- a/.github/workflows/integration_test.yaml +++ /dev/null @@ -1,414 +0,0 @@ -on: - workflow_call: - inputs: - artifact-prefix: - description: | - Prefix for charm package GitHub artifact(s) - - Use canonical/data-platform-workflows build_charm.yaml to build the charm(s) - required: true - type: string - secrets: - AWS_ACCESS_KEY: - required: true - AWS_SECRET_KEY: - required: true - GCP_ACCESS_KEY: - required: true - GCP_SECRET_KEY: - required: true - UBUNTU_PRO_TOKEN: - required: true - LANDSCAPE_ACCOUNT_NAME: - required: true - LANDSCAPE_REGISTRATION_KEY: - required: true - -jobs: - collect-integration-tests: - name: Collect integration test spread jobs - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: Set up environment - run: | - sudo snap install go --classic - go install github.com/canonical/spread/cmd/spread@latest - pipx install tox poetry - - name: Collect spread jobs - id: collect-jobs - shell: python - run: | - import json - import pathlib - import os - import subprocess - - spread_jobs = ( - subprocess.run( - [pathlib.Path.home() / "go/bin/spread", "-list", "github-ci"], - capture_output=True, - check=True, - text=True, - ) - .stdout.strip() - .split("\n") - ) - jobs = [] - for job in spread_jobs: - # Example `job`: "github-ci:ubuntu-24.04:tests/spread/test_charm.py:juju36" - _, runner, task, variant = job.split(":") - # Example: "test_charm.py" - task = task.removeprefix("tests/spread/") - if runner.endswith("-arm"): - architecture = "arm64" - else: - architecture = "amd64" - # Example: "test_charm.py:juju36 | amd64" - name = f"{task}:{variant} | {architecture}" - # ":" character not valid in GitHub Actions artifact - name_in_artifact = f"{task}-{variant}-{architecture}" - jobs.append({ - "spread_job": job, - "name": name, - "name_in_artifact": name_in_artifact, - "runner": runner, - }) - output = f"jobs={json.dumps(jobs)}" - print(output) - with open(os.environ["GITHUB_OUTPUT"], "a") as file: - file.write(output) - - name: Generate Allure default test results - if: ${{ github.event_name == 'workflow_dispatch' && github.run_attempt == '1' }} - run: tox run -e integration -- tests/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 == 'workflow_dispatch' && github.run_attempt == '1' }} - uses: actions/upload-artifact@v7 - with: - name: allure-default-results-integration-test - path: allure-default-results/ - if-no-files-found: error - outputs: - jobs: ${{ steps.collect-jobs.outputs.jobs }} - permissions: {} - - integration-test: - strategy: - fail-fast: false - matrix: - job: ${{ fromJSON(needs.collect-integration-tests.outputs.jobs) }} - name: ${{ matrix.job.name }} - needs: - - collect-integration-tests - runs-on: ${{ matrix.job.runner }} - timeout-minutes: 216 # Sum of steps `timeout-minutes` + 5 - environment: - name: integration-test - deployment: false - steps: - - name: Checkout - timeout-minutes: 3 - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: Set up environment - timeout-minutes: 5 - run: sudo snap install charmcraft --classic - # TODO: remove when https://github.com/canonical/charmcraft/issues/2105 and - # https://github.com/canonical/charmcraft/issues/2130 fixed - - run: | - sudo snap install go --classic - go install github.com/canonical/spread/cmd/spread@latest - - name: Download packed charm(s) - timeout-minutes: 5 - uses: actions/download-artifact@v8 - with: - pattern: ${{ inputs.artifact-prefix }}-* - merge-multiple: true - - name: Run spread job - timeout-minutes: 180 - id: spread - # TODO: replace with `charmcraft test` when - # https://github.com/canonical/charmcraft/issues/2105 and - # https://github.com/canonical/charmcraft/issues/2130 fixed - run: ~/go/bin/spread -vv -artifacts=artifacts "${VAR_SPREAD_JOB}" - env: - AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} - AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} - GCP_ACCESS_KEY: ${{ secrets.GCP_ACCESS_KEY }} - GCP_SECRET_KEY: ${{ secrets.GCP_SECRET_KEY }} - UBUNTU_PRO_TOKEN: ${{ secrets.UBUNTU_PRO_TOKEN }} - LANDSCAPE_ACCOUNT_NAME: ${{ secrets.LANDSCAPE_ACCOUNT_NAME }} - LANDSCAPE_REGISTRATION_KEY: ${{ secrets.LANDSCAPE_REGISTRATION_KEY }} - VAR_SPREAD_JOB: ${{ matrix.job.spread_job }} - - name: Upload Allure results - timeout-minutes: 3 - # 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 == 'workflow_dispatch' && github.run_attempt == '1' }} - uses: actions/upload-artifact@v7 - with: - name: allure-results-integration-test-${{ matrix.job.name_in_artifact }} - path: artifacts/${{ matrix.job.spread_job }}/allure-results/ - if-no-files-found: error - - timeout-minutes: 1 - if: ${{ success() || (failure() && steps.spread.outcome == 'failure') }} - run: snap list - - name: lxc image list - timeout-minutes: 1 - if: ${{ success() || (failure() && steps.spread.outcome == 'failure') }} - # sudo needed since spread runs scripts as root - run: sudo lxc image list - - name: Select model - timeout-minutes: 1 - # `!contains(matrix.job.spread_job, 'juju29')` workaround for juju 2 error: - # "ERROR cannot acquire lock file to read controller concierge-microk8s: unable to open - # /tmp/juju-store-lock-3635383939333230: permission denied" - # Unable to workaround error with `sudo rm /tmp/juju-*` - if: ${{ !contains(matrix.job.spread_job, 'juju29') && (success() || (failure() && steps.spread.outcome == 'failure')) }} - id: juju-switch - run: | - # sudo needed since spread runs scripts as root - # "testing" is default model created by concierge - sudo juju switch testing - mkdir ~/logs/ - - name: juju status - timeout-minutes: 1 - if: ${{ !contains(matrix.job.spread_job, 'juju29') && (success() || (failure() && steps.spread.outcome == 'failure')) }} - run: sudo juju status --color --relations --storage | tee ~/logs/juju-status.txt - - name: juju debug-log - timeout-minutes: 3 - if: ${{ !contains(matrix.job.spread_job, 'juju29') && (success() || (failure() && steps.spread.outcome == 'failure')) }} - run: sudo juju debug-log --color --replay --no-tail | tee ~/logs/juju-debug-log.txt - - name: jhack tail - timeout-minutes: 3 - if: ${{ !contains(matrix.job.spread_job, 'juju29') && (success() || (failure() && steps.spread.outcome == 'failure')) }} - run: sudo jhack tail --printer raw --replay --no-watch | tee ~/logs/jhack-tail.txt - - name: Upload logs - timeout-minutes: 5 - if: ${{ !contains(matrix.job.spread_job, 'juju29') && (success() || (failure() && steps.spread.outcome == 'failure')) }} - uses: actions/upload-artifact@v7 - with: - name: logs-integration-test-${{ matrix.job.name_in_artifact }} - path: ~/logs/ - if-no-files-found: error - - name: Disk usage - timeout-minutes: 1 - if: ${{ success() || (failure() && steps.spread.outcome == 'failure') }} - run: df --human-readable - permissions: {} - - allure-report: - name: Publish Allure report - if: ${{ !cancelled() && github.event_name == 'workflow_dispatch' && github.run_attempt == '1' }} - concurrency: - group: github-pages - cancel-in-progress: false - needs: - - integration-test - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - 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('/', '_')}" - 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 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@v6 - with: - persist-credentials: true - 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@v8 - with: - path: allure-default-results/ - name: allure-default-results-integration-test - - name: Download test results - uses: actions/download-artifact@v8 - 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: | - mkdir -p repo/"${VAR_BRANCH}"/ - if [[ -d repo/"${VAR_BRANCH}"/_latest/history/ ]] - then - echo 'Loading history' - cp -r repo/"${VAR_BRANCH}"/_latest/history/ allure-results/ - fi - env: - VAR_BRANCH: ${{ 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": 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 top-level index.html - shell: python - run: | - import os - - DATA = """ - -