[DPE-10745] chore: migrate remaining old libs to charmlibs equivalent #3453
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2022 Canonical Ltd. | |
| # See LICENSE file for licensing details. | |
| name: Tests | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**.md' | |
| - 'terraform/**' | |
| - '.gitignore' | |
| - '.readthedocs.yaml' | |
| schedule: | |
| - cron: '53 0 * * *' # Daily at 00:53 UTC | |
| workflow_dispatch: | |
| # Triggered on push to branch "main" by .github/workflows/release.yaml | |
| workflow_call: | |
| outputs: | |
| artifact-prefix: | |
| description: build_charm.yaml `artifact-prefix` output | |
| value: ${{ jobs.build.outputs.artifact-prefix }} | |
| env: | |
| JUJU_CHANNEL: "3.6/stable" | |
| MICROK8S_CHANNEL: "1.28-strict/stable" | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install tox | |
| run: pipx install tox | |
| - name: Run linters | |
| run: tox run -e lint | |
| unit-test: | |
| name: Unit tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install tox | |
| run: pipx install tox | |
| - name: Run tests | |
| run: tox run -e unit | |
| # FIXME: remove this once charmcraft monorepo feature is released. | |
| build-dev: | |
| if: ${{ github.ref_name != 'main' }} | |
| strategy: | |
| matrix: | |
| path: | |
| - machine | |
| - k8s | |
| - connect_machine | |
| - connect_k8s | |
| - tests/integration/machine/app-charm | |
| - tests/integration/k8s/app-charm | |
| - tests/integration/connect_machine/sink-integrator-charm | |
| - tests/integration/connect_machine/source-integrator-charm | |
| - tests/integration/connect_k8s/app-charm | |
| name: Build charm for testing | ${{ matrix.path }} | |
| uses: ./.github/workflows/_build_charm_dev.yaml | |
| with: | |
| path-to-charm-directory: ${{ matrix.path }} | |
| permissions: | |
| actions: read | |
| contents: read | |
| build-release: | |
| if: ${{ github.ref_name == 'main' }} | |
| strategy: | |
| matrix: | |
| path: | |
| - machine | |
| - k8s | |
| - connect_machine | |
| - connect_k8s | |
| - tests/integration/machine/app-charm | |
| - tests/integration/k8s/app-charm | |
| - tests/integration/connect_machine/sink-integrator-charm | |
| - tests/integration/connect_machine/source-integrator-charm | |
| - tests/integration/connect_k8s/app-charm | |
| name: Build charm for release | ${{ matrix.path }} | |
| uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v32.2.2 | |
| with: | |
| path-to-charm-directory: ${{ matrix.path }} | |
| cache: false # TODO: remove after re-added to ccc-hub | |
| permissions: | |
| actions: read | |
| contents: read | |
| integration-kafka-machine-single: | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tox-environments: | |
| - auto-balance | |
| - charm | |
| - provider | |
| - provider-v1 | |
| - password-rotation | |
| - tls | |
| - refresh | |
| - tls-complex | |
| - kraft | |
| - kraft-tls | |
| - ha | |
| - spaces | |
| - terraform | |
| kraft-mode: | |
| - single | |
| name: "Kafka | machine | ${{ matrix.tox-environments }} | ${{ matrix.kraft-mode }}" | |
| needs: | |
| - lint | |
| - unit-test | |
| - build-dev | |
| - build-release | |
| if: | | |
| always() && | |
| !cancelled() && | |
| (needs.build-dev.result == 'success' || needs.build-release.result == 'success') | |
| runs-on: [self-hosted, linux, AMD64, X64, large, noble] | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup operator environment | |
| uses: charmed-kubernetes/actions-operator@main | |
| with: | |
| provider: lxd | |
| juju-channel: 3.6/stable | |
| - name: Download packed charm(s) | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: ${{ needs.build-dev.outputs.artifact-prefix || needs.build-release.outputs.artifact-prefix }}-* | |
| merge-multiple: true | |
| - name: Setup terraform if needed | |
| if: ${{ matrix.tox-environments == 'terraform' }} | |
| run: | | |
| sudo snap install --classic terraform | |
| - name: Select tests | |
| id: select-tests | |
| run: | | |
| if [ "${{ github.event_name }}" == "schedule" ] | |
| then | |
| echo Running unstable and stable tests | |
| echo "mark_expression=" >> $GITHUB_OUTPUT | |
| else | |
| echo Skipping unstable tests | |
| echo "mark_expression=not unstable" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run integration tests | |
| run: tox run -e integration-machine-${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --kraft-mode ${{ matrix.kraft-mode }} | |
| env: | |
| CI_PACKED_CHARMS: ${{ needs.build-dev.outputs.charms || needs.build-release.outputs.charms }} | |
| integration-kafka-machine-multi: | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tox-environments: | |
| - auto-balance | |
| - charm | |
| - provider | |
| - provider-v1 | |
| - password-rotation | |
| - tls | |
| - refresh | |
| - tls-complex | |
| - balancer-broker | |
| - balancer-controller | |
| - kraft | |
| - kraft-tls | |
| - ha | |
| - ha-controller | |
| - spaces | |
| - oauth | |
| kraft-mode: | |
| - multi | |
| name: "Kafka | machine | ${{ matrix.tox-environments }} | ${{ matrix.kraft-mode }}" | |
| needs: | |
| - lint | |
| - unit-test | |
| - build-dev | |
| - build-release | |
| if: | | |
| always() && | |
| !cancelled() && | |
| (needs.build-dev.result == 'success' || needs.build-release.result == 'success') | |
| runs-on: [self-hosted, linux, AMD64, X64, xlarge, noble] | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup operator environment | |
| uses: charmed-kubernetes/actions-operator@main | |
| with: | |
| provider: lxd | |
| juju-channel: 3.6/stable | |
| - name: Download packed charm(s) | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: ${{ needs.build-dev.outputs.artifact-prefix || needs.build-release.outputs.artifact-prefix }}-* | |
| merge-multiple: true | |
| - name: Setup terraform & microk8s controller (for OAuth tests) | |
| if: ${{ matrix.tox-environments == 'oauth' }} | |
| run: | | |
| LXD_CONTROLLER=$(juju models --format json | jq -r '.models[0]."controller-name"') | |
| sudo snap install --classic terraform | |
| # calico has issues with strict confinements, so remove -strict | |
| sudo snap install microk8s --channel 1.32 --classic | |
| sudo usermod -a -G microk8s $USER | |
| mkdir -p ~/.kube | |
| chmod 0700 ~/.kube | |
| sudo tee /var/snap/microk8s/current/args/certs.d/docker.io/hosts.toml << EOF | |
| server = "$DOCKERHUB_MIRROR" | |
| [host."${DOCKERHUB_MIRROR#'https://'}"] | |
| capabilities = ["pull", "resolve"] | |
| EOF | |
| sudo microk8s stop | |
| sudo microk8s start | |
| # make juju work with microk8s --classic | |
| sudo mkdir -p /var/snap/juju/current/microk8s/credentials | |
| sudo microk8s config | sudo tee /var/snap/juju/current/microk8s/credentials/client.config | |
| sudo chown -R $USER:$USER /var/snap/juju/current/microk8s/credentials | |
| IP_ADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc') | |
| sudo microk8s enable dns | |
| sudo microk8s enable hostpath-storage | |
| sudo microk8s enable metallb:$IP_ADDR-$IP_ADDR | |
| juju bootstrap microk8s | |
| juju switch $LXD_CONTROLLER | |
| - name: Select tests | |
| id: select-tests | |
| run: | | |
| if [ "${{ github.event_name }}" == "schedule" ] | |
| then | |
| echo Running unstable and stable tests | |
| echo "mark_expression=" >> $GITHUB_OUTPUT | |
| else | |
| echo Skipping unstable tests | |
| echo "mark_expression=not unstable" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run integration tests | |
| run: tox run -e integration-machine-${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --keep-models --kraft-mode ${{ matrix.kraft-mode }} | |
| env: | |
| CI_PACKED_CHARMS: ${{ needs.build-dev.outputs.charms || needs.build-release.outputs.charms }} | |
| integration-kafka-k8s-single: | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tox-environments: | |
| - auto-balance | |
| - charm | |
| - provider | |
| - provider-v1 | |
| - password-rotation | |
| - tls | |
| - tls-complex | |
| - kraft | |
| - kraft-tls | |
| - ha | |
| - refresh | |
| kraft-mode: | |
| - single | |
| name: "Kafka | k8s | ${{ matrix.tox-environments }} | ${{ matrix.kraft-mode }}" | |
| needs: | |
| - lint | |
| - unit-test | |
| - build-dev | |
| - build-release | |
| if: | | |
| always() && | |
| !cancelled() && | |
| (needs.build-dev.result == 'success' || needs.build-release.result == 'success') | |
| runs-on: [self-hosted, linux, AMD64, X64, large, noble] | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup operator environment | |
| run: | | |
| sudo snap install concierge --classic | |
| sudo concierge prepare --trace --extra-debs pipx | |
| - name: Install dependencies | |
| run: | | |
| pipx install tox poetry | |
| pipx ensurepath | |
| # FIXME: remove this step when the previously installed charmcraft snap supports monorepos. | |
| - name: Install charmcraft with monorepo feature | |
| run: | | |
| sudo snap install --classic astral-uv | |
| git clone https://github.com/canonical/charmcraft \ | |
| --branch work/CHARMCRAFT-710-prototype \ | |
| ~/charmcraft | |
| pushd ~/charmcraft && uv run charmcraft --version && popd | |
| echo "CHARMCRAFT_BIN=$(realpath ~/charmcraft/.venv/bin/charmcraft)" >> $GITHUB_ENV | |
| - name: Download packed charm(s) | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: ${{ needs.build-dev.outputs.artifact-prefix || needs.build-release.outputs.artifact-prefix }}-* | |
| merge-multiple: true | |
| - name: Select tests | |
| id: select-tests | |
| run: | | |
| if [ "${{ github.event_name }}" == "schedule" ] | |
| then | |
| echo Running unstable and stable tests | |
| echo "mark_expression=" >> $GITHUB_OUTPUT | |
| else | |
| echo Skipping unstable tests | |
| echo "mark_expression=not unstable" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run integration tests | |
| run: tox run -e integration-k8s-${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --keep-models --kraft-mode ${{ matrix.kraft-mode }} | |
| env: | |
| CI_PACKED_CHARMS: ${{ needs.build-dev.outputs.charms || needs.build-release.outputs.charms }} | |
| integration-kafka-k8s-multi: | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tox-environments: | |
| - auto-balance | |
| - charm | |
| - provider | |
| - provider-v1 | |
| - password-rotation | |
| - tls | |
| - tls-complex | |
| - balancer-broker | |
| - balancer-controller | |
| - kraft | |
| - kraft-tls | |
| - ha | |
| - ha-controller | |
| - refresh | |
| kraft-mode: | |
| - multi | |
| name: "Kafka | k8s | ${{ matrix.tox-environments }} | ${{ matrix.kraft-mode }}" | |
| needs: | |
| - lint | |
| - unit-test | |
| - build-dev | |
| - build-release | |
| if: | | |
| always() && | |
| !cancelled() && | |
| (needs.build-dev.result == 'success' || needs.build-release.result == 'success') | |
| runs-on: [self-hosted, linux, AMD64, X64, xlarge, noble] | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup operator environment | |
| run: | | |
| sudo snap install concierge --classic | |
| sudo concierge prepare --trace --extra-debs pipx | |
| - name: Install dependencies | |
| run: | | |
| pipx install tox poetry | |
| pipx ensurepath | |
| # FIXME: remove this step when the previously installed charmcraft snap supports monorepos. | |
| - name: Install charmcraft with monorepo feature | |
| run: | | |
| sudo snap install --classic astral-uv | |
| git clone https://github.com/canonical/charmcraft \ | |
| --branch work/CHARMCRAFT-710-prototype \ | |
| ~/charmcraft | |
| pushd ~/charmcraft && uv run charmcraft --version && popd | |
| echo "CHARMCRAFT_BIN=$(realpath ~/charmcraft/.venv/bin/charmcraft)" >> $GITHUB_ENV | |
| - name: Download packed charm(s) | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: ${{ needs.build-dev.outputs.artifact-prefix || needs.build-release.outputs.artifact-prefix }}-* | |
| merge-multiple: true | |
| - name: Select tests | |
| id: select-tests | |
| run: | | |
| if [ "${{ github.event_name }}" == "schedule" ] | |
| then | |
| echo Running unstable and stable tests | |
| echo "mark_expression=" >> $GITHUB_OUTPUT | |
| else | |
| echo Skipping unstable tests | |
| echo "mark_expression=not unstable" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run integration tests | |
| run: tox run -e integration-k8s-${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --keep-models --kraft-mode ${{ matrix.kraft-mode }} | |
| env: | |
| CI_PACKED_CHARMS: ${{ needs.build-dev.outputs.charms || needs.build-release.outputs.charms }} | |
| integration-connect-machine: | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tox-environments: | |
| - charm | |
| - tls | |
| - plugins | |
| - provider | |
| - upgrade | |
| - requirer | |
| - scaling | |
| - secrets | |
| - terraform | |
| kafka-version: | |
| - "3" | |
| - "4" | |
| exclude: | |
| # TF tests don't involve Kafka | |
| - tox-environments: terraform | |
| kafka-version: 3 | |
| name: Connect | machine | ${{ matrix.tox-environments }} | Kafka ${{ matrix.kafka-version }} | |
| needs: | |
| - lint | |
| - unit-test | |
| - build-dev | |
| - build-release | |
| if: | | |
| always() && | |
| !cancelled() && | |
| (needs.build-dev.result == 'success' || needs.build-release.result == 'success') | |
| runs-on: [self-hosted, linux, AMD64, X64, large, noble] | |
| timeout-minutes: 90 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup operator environment | |
| uses: charmed-kubernetes/actions-operator@main | |
| with: | |
| provider: lxd | |
| juju-channel: 3.6/stable | |
| - name: Download packed charm(s) | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: ${{ needs.build-dev.outputs.artifact-prefix || needs.build-release.outputs.artifact-prefix }}-* | |
| merge-multiple: true | |
| - name: Setup terraform if needed | |
| if: ${{ matrix.tox-environments == 'terraform' }} | |
| run: | | |
| sudo snap install --classic terraform | |
| - name: Select tests | |
| id: select-tests | |
| run: | | |
| if [ "${{ github.event_name }}" == "schedule" ] | |
| then | |
| echo Running unstable and stable tests | |
| echo "mark_expression=" >> $GITHUB_OUTPUT | |
| else | |
| echo Skipping unstable tests | |
| echo "mark_expression=not unstable" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run integration tests | |
| run: tox run -e integration-connect-machine-${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --keep-models --kafka ${{ matrix.kafka-version }} | |
| env: | |
| CI_PACKED_CHARMS: ${{ needs.build-dev.outputs.charms || needs.build-release.outputs.charms }} | |
| integration-connect-k8s: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tox-environments: | |
| - charm | |
| - tls | |
| - plugins | |
| - provider | |
| - scaling | |
| - secrets | |
| - upgrade | |
| name: Connect | k8s | ${{ matrix.tox-environments }} | |
| needs: | |
| - lint | |
| - unit-test | |
| - build-dev | |
| - build-release | |
| if: | | |
| always() && | |
| !cancelled() && | |
| (needs.build-dev.result == 'success' || needs.build-release.result == 'success') | |
| runs-on: [self-hosted, linux, AMD64, X64, medium, noble] | |
| timeout-minutes: 90 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup operator environment | |
| run: | | |
| sudo snap install concierge --classic | |
| sudo concierge prepare --trace --extra-debs pipx | |
| - name: Install dependencies | |
| run: | | |
| pipx install tox | |
| pipx ensurepath | |
| - name: Download packed charm(s) | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: ${{ needs.build-dev.outputs.artifact-prefix || needs.build-release.outputs.artifact-prefix }}-* | |
| merge-multiple: true | |
| - name: Select tests | |
| id: select-tests | |
| run: | | |
| if [ "${{ github.event_name }}" == "schedule" ] | |
| then | |
| echo Running unstable and stable tests | |
| echo "mark_expression=" >> $GITHUB_OUTPUT | |
| else | |
| echo Skipping unstable tests | |
| echo "mark_expression=not unstable" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run integration tests | |
| run: tox run -e integration-connect-k8s-${{ matrix.tox-environments }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' | |
| env: | |
| CI_PACKED_CHARMS: ${{ needs.build-dev.outputs.charms || needs.build-release.outputs.charms }} |