Convert to composite #2
Workflow file for this run
This file contains 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
name: Integration Tests | |
on: | |
workflow_call: | |
inputs: | |
charm-path: | |
type: string | |
required: false | |
provider: | |
type: string | |
description: "The provider to choose for either machine or k8s tests ('lxd' or 'microk8s')" | |
required: true | |
ip-range: | |
type: string | |
description: | | |
The IP range in the address pool for the load balancer to use. | |
It can be either a subnet(IP/mask) or a range (<IP1>-<IP2>) | |
required: false | |
default: null | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
integration-test: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Get IP range | |
id: ip_range | |
if: ${{ inputs.ip-range == '' }} | |
run: | | |
echo "ip_range=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')/32" >> $GITHUB_OUTPUT | |
- name: Setup operator enviroment (machine) | |
if: inputs.provider == 'lxd' | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
juju-channel: 3.4/stable | |
provider: lxd | |
- name: Setup operator environment (k8s) | |
if: inputs.provider == 'microk8s' | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
juju-channel: 3.4/stable | |
provider: microk8s | |
channel: 1.26-strict/stable | |
microk8s-group: snap_microk8s | |
microk8s-addons: "hostpath-storage dns metallb:${{ inputs.ip-range || steps.ip_range.outputs.ip_range }}" | |
- name: Run integration tests | |
run: cd ${{ inputs.charm-path }} && tox -vve integration | |
- name: Dump debug log | |
if: failure() | |
run: | | |
for m in $(juju models --format json | jq -r '.models[].name' | grep -v "admin/controller"); do juju debug-log -m $m --replay --ms --no-tail; done | |
exit 0 | |
- name: Dump logs | |
if: failure() | |
uses: canonical/observability/.github/workflows/_dump-logs.yaml@main |