Skip to content

[DPE-10092] Tiobe scan #2751

[DPE-10092] Tiobe scan

[DPE-10092] Tiobe scan #2751

Workflow file for this run

# 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:
schedule:
- cron: '53 0 * * *' # Daily at 00:53 UTC
# Triggered on push to branch "main" by .github/workflows/release.yaml
workflow_call:
permissions: {}
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
libs-version: [0, 1]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install tox
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version
run: python3 -m pip install tox
- name: Run linters
run: tox run -e lint-v${{ matrix.libs-version }}
unit-test:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
libs-version: [0, 1]
juju-version:
- libjuju-version: "2.9.49.1"
- libjuju-version: "3.6.1.0"
exclude:
- libs-version: 1
juju-version: {libjuju-version: "2.9.49.1"}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install tox
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version
run: python3 -m pip install tox
- name: Run tests
run: tox run -e unit-v${{ matrix.libs-version }}
env:
LIBJUJU_VERSION_SPECIFIER: "==${{ matrix.juju-version.libjuju-version }}"
integration-test-v0:
strategy:
fail-fast: false
matrix:
ubuntu-versions:
# Update whenever charmcraft.yaml is changed
- series: jammy
bases-index: 0
- series: focal
bases-index: 1
tests:
- tox-environment: integration-db-v0
provider: microk8s
- tox-environment: integration-upgrade-v0-1
provider: microk8s
- tox-environment: integration-upgrade-v0-2
provider: microk8s
- tox-environment: integration-upgrade-v0-3
provider: microk8s
- tox-environment: integration-upgrade-v0-4
provider: microk8s
# To be enabled after data_interfaces v040
# - integration-upgrade-v0-5
# - integration-upgrade-v0-6
# - integration-upgrade-v0-7
- tox-environment: integration-upgrade-databag-v0
provider: microk8s
- tox-environment: integration-s3-v0
provider: microk8s
- tox-environment: integration-opensearch-v0
provider: microk8s
- tox-environment: integration-kafka-v0
provider: microk8s
- tox-environment: integration-kafka-connect-v0
provider: microk8s
- tox-environment: integration-status-v0
provider: microk8s
- tox-environment: integration-etcd-v0
provider: lxd
juju-version:
- juju-bootstrap-option: "2.9.51"
juju-snap-channel: "2.9/stable"
libjuju-version: "2.9.49.1"
- juju-bootstrap-option: "3.6.1"
juju-snap-channel: "3.6/stable"
libjuju-version: "3.6.1.0"
exclude:
- tests: {tox-environment: integration-upgrade-v0-1}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: {tox-environment: integration-upgrade-v0-2}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: {tox-environment: integration-upgrade-v0-3}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: {tox-environment: integration-upgrade-v0-4}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: {tox-environment: integration-upgrade-v0-5}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: {tox-environment: integration-upgrade-v0-6}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: {tox-environment: integration-upgrade-v0-7}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: {tox-environment: integration-upgrade-databag-v0}
juju-version: {juju-snap-channel: "2.9/stable"}
- tests: { tox-environment: integration-etcd-v0}
juju-version: { juju-snap-channel: "2.9/stable" }
- tests: {tox-environment: integration-opensearch-v0}
ubuntu-versions: {series: focal}
- tests: {tox-environment: integration-kafka-v0}
ubuntu-versions: {series: focal}
- tests: {tox-environment: integration-kafka-connect-v0}
ubuntu-versions: {series: focal}
- tests: {tox-environment: integration-status-v0}
ubuntu-versions: {series: focal}
- tests: {tox-environment: integration-etcd-v0}
ubuntu-versions: {series: focal}
name: ${{ matrix.tests.tox-environment }} Juju ${{ matrix.juju-version.juju-snap-channel}} -- ${{ matrix.ubuntu-versions.series }}
needs:
- lint
- unit-test
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup concierge
run: |
sudo snap install --classic concierge
sudo concierge prepare --juju-channel "${{ matrix.juju-version.juju-snap-channel}}" --extra-debs tox
sudo snap install charmcraft --channel 2.x/stable --classic
- name: Setup k8s controller
if: ${{ 'microk8s' == matrix.tests.provider }}
# TODO: Replace with custom image on self-hosted runner
run: |
juju switch concierge-microk8s
- name: Setup lxd controller
if: ${{ 'lxd' == matrix.tests.provider }}
run: |
juju switch concierge-lxd
- name: Download packed charm(s)
uses: actions/download-artifact@v8
with:
name: ${{ needs.build.outputs.artifact-name }}
- 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
# set a predictable model name so it can be consumed by charm-logdump-action
run:
tox run -e ${{ matrix.tests.tox-environment }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --model testing --os-series=${{ matrix.ubuntu-versions.series }} --build-bases-index=${{ matrix.ubuntu-versions.bases-index }}
env:
CI_PACKED_CHARMS: ${{ needs.build.outputs.charms }}
LIBJUJU_VERSION_SPECIFIER: "==${{ matrix.juju-version.libjuju-version }}"
WEBSOCKETS_VERSION_SPECIFIER: ${{ env.WEBSOCKETS_VERSION_SPECIFIER }}
- name: Print debug-log
if: failure()
run: juju switch testing; juju debug-log --replay --no-tail
- name: Dump logs
uses: canonical/charm-logdump-action@main
if: failure()
with:
app: data-platform-libs
model: testing
integration-test-v1:
strategy:
fail-fast: false
matrix:
ubuntu-versions:
# Update whenever charmcraft.yaml is changed
- series: jammy
bases-index: 0
tests:
- tox-environment: integration-db-v1
provider: microk8s
- tox-environment: integration-opensearch-v1
provider: microk8s
- tox-environment: integration-kafka-v1
provider: microk8s
- tox-environment: integration-kafka-connect-v1
provider: microk8s
- tox-environment: integration-backward-compatibility-v1
provider: microk8s
- tox-environment: integration-status-v1
provider: microk8s
- tox-environment: integration-etcd-v1
provider: lxd
juju-version:
- juju-bootstrap-option: "3.6.1"
juju-snap-channel: "3.6/stable"
libjuju-version: "3.6.1.0"
name: V1 -- ${{ matrix.tests.tox-environment }} Juju ${{ matrix.juju-version.juju-snap-channel}} -- ${{ matrix.ubuntu-versions.series }}
needs:
- lint
- unit-test
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup concierge
run: |
sudo snap install --classic concierge
sudo concierge prepare --juju-channel "3.6/stable" --extra-debs tox --extra-snaps "charmcraft/3.x/stable"
- name: Setup k8s controller
if: ${{ 'microk8s' == matrix.tests.provider }}
# TODO: Replace with custom image on self-hosted runner
run: |
juju switch concierge-microk8s
- name: Setup lxd controller
if: ${{ 'lxd' == matrix.tests.provider }}
run: |
juju switch concierge-lxd
- name: Download packed charm(s)
uses: actions/download-artifact@v8
with:
name: ${{ needs.build.outputs.artifact-name }}
- 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
# set a predictable model name so it can be consumed by charm-logdump-action
run:
tox run -e ${{ matrix.tests.tox-environment }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --model testing --os-series=${{ matrix.ubuntu-versions.series }} --build-bases-index=${{ matrix.ubuntu-versions.bases-index }}
env:
CI_PACKED_CHARMS: ${{ needs.build.outputs.charms }}
LIBJUJU_VERSION_SPECIFIER: "==${{ matrix.juju-version.libjuju-version }}"
WEBSOCKETS_VERSION_SPECIFIER: ${{ env.WEBSOCKETS_VERSION_SPECIFIER }}
- name: Print debug-log
if: failure()
run: juju switch testing; juju debug-log --replay --no-tail
- name: Dump logs
uses: canonical/charm-logdump-action@main
if: failure()
with:
app: data-platform-libs
model: testing