22# See LICENSE file for licensing details.
33name : Tests
44
5- concurrency :
6- group : ${{ github.workflow }}-${{ github.ref }}
7- cancel-in-progress : true
8-
95on :
106 workflow_dispatch :
11- workflow_call :
127 pull_request :
8+ workflow_call :
139 schedule :
1410 - cron : " 53 0 * * *" # Daily at 00:53 UTC
1511
12+ env :
13+ JUJU_CHANNEL : " 3.6/stable"
14+ MICROK8S_CHANNEL : " 1.28-strict/stable"
15+ JUJU_BOOTSTRAP_OPTIONS : " --agent-version 3.6.12"
16+
1617jobs :
1718 lint :
1819 name : Lint
@@ -24,54 +25,65 @@ jobs:
2425 - name : Install tox
2526 run : pipx install tox
2627 - name : Run linters
27- run : make lint
28+ run : tox run -e lint
2829
29- integration-test :
30+ integration-test-terraform :
3031 strategy :
3132 fail-fast : false
32- max-parallel : 5
33+ max-parallel : 2
3334 matrix :
34- tests :
35- - tox-environment : integration-bundle
36- tls : " true"
37- - tox-environment : integration-e2e
38- tls : " false"
39- - tox-environment : integration-e2e
40- tls : " true"
41- - tox-environment : integration-e2e-backup
42- tls : " false"
35+ tox-environment :
36+ - integration-terraform
37+ kraft-mode :
38+ - single
39+ - multi
4340 juju :
44- - snap_channel : " 3.4/stable"
45- agent : " 3.4.2"
4641 - snap_channel : " 3.6/stable"
47- agent : " 3.6.0"
48- name : ${{ matrix.tests.tox-environment }}_${{ matrix.tests.tls }}_${{ matrix.juju.agent || matrix.juju.snap_channel }}
42+ agent : " 3.6.10"
43+ runs-on : [self-hosted, linux, AMD64, X64, xlarge, noble]
44+ name : ${{ matrix.tox-environment }}_${{ matrix.kraft-mode }}_${{ matrix.juju.agent || matrix.juju.snap_channel }}
4945 needs :
5046 - lint
51- runs-on : ubuntu-22.04
5247 timeout-minutes : 120
5348 steps :
54- - name : (GitHub hosted) Free up disk space
55- timeout-minutes : 5
56- run : |
57- printf '\nDisk usage before cleanup\n'
58- df --human-readable
59- # Based on https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
60- rm -r /usr/share/dotnet
61- rm -r /opt/hostedtoolcache/
62- printf '\nDisk usage after cleanup\n'
63- df --human-readable
6449 - name : Checkout
6550 uses : actions/checkout@v4
6651 - name : Setup operator environment
67- uses : charmed-kubernetes/actions-operator@main
68- with :
69- juju-channel : ${{ matrix.juju.snap_channel }}
70- bootstrap-options : " --agent-version ${{ matrix.juju.agent }}"
71- provider : microk8s
72- channel : 1.28-strict/stable
73- microk8s-group : snap_microk8s
74- microk8s-addons : " hostpath-storage dns"
52+ run : |
53+ sudo snap install concierge --classic
54+ # calico has issues with strict confinements, so remove -strict
55+ sudo snap install microk8s --channel ${MICROK8S_CHANNEL//"-strict"/} --classic
56+ sudo snap install juju --channel $JUJU_CHANNEL
57+
58+ sudo usermod -a -G microk8s $USER
59+ mkdir -p ~/.kube
60+ chmod 0700 ~/.kube
61+
62+ sudo tee /var/snap/microk8s/current/args/certs.d/docker.io/hosts.toml << EOF
63+ server = "$DOCKERHUB_MIRROR"
64+ [host."${DOCKERHUB_MIRROR#'https://'}"]
65+ capabilities = ["pull", "resolve"]
66+ EOF
67+
68+ sudo microk8s stop
69+ sudo microk8s start
70+
71+ # make juju work with microk8s --classic
72+ sudo mkdir -p /var/snap/juju/current/microk8s/credentials
73+ sudo microk8s config | sudo tee /var/snap/juju/current/microk8s/credentials/client.config
74+ sudo chown -R $USER:$USER /var/snap/juju/current/microk8s/credentials
75+
76+ sudo concierge prepare \
77+ -p microk8s \
78+ --microk8s-channel ${MICROK8S_CHANNEL//"-strict"/} \
79+ --juju-channel $JUJU_CHANNEL \
80+ --extra-debs pipx
81+
82+ pipx ensurepath
83+ pipx install tox poetry
84+ - name : Install terraform snap
85+ run : |
86+ sudo snap install terraform --channel=latest/stable --classic
7587 - name : Select tests
7688 id : select-tests
7789 run : |
8496 echo "mark_expression=not unstable" >> $GITHUB_OUTPUT
8597 fi
8698 - name : Run integration tests
87- run : |
88- if [[ "${{ matrix.tests.tls }}" == "true" ]]; then
89- FLAGS="--tls"
90- else
91- FLAGS=""
92- fi
93-
94- make build TLS=${{ matrix.tests.tls }}
95- echo "======================"
96- echo "Bundle being deployed:"
97- echo "======================"
98- cat build/bundle.yaml
99- echo "======================"
100- tox run -e ${{ matrix.tests.tox-environment }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' $FLAGS
99+ run : |
100+ tox run -e ${{ matrix.tox-environment }} -- -m '${{ steps.select-tests.outputs.mark_expression }}' --keep-models --kraft-mode=${{ matrix.kraft-mode }}
0 commit comments