-
Notifications
You must be signed in to change notification settings - Fork 10
104 lines (101 loc) · 3.41 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Test Suite
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.8]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: python3 -m pip install tox
- name: Run linters
run: tox -vve lint
- name: Static analysis
run: tox -vve static-bundle
integration-test-microk8s:
name: Integration tests (microk8s)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get prefsrc
run: |
echo "IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')" >> $GITHUB_ENV
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.1/stable
provider: microk8s
channel: 1.25-strict/stable
microk8s-addons: "hostpath-storage dns metallb:${{ env.IPADDR }}-${{ env.IPADDR }}"
- name: Update python-libjuju dependency to match juju version
# Assuming the dep is given on a separate tox.ini line
run: sed -E -i 's/^\s*juju\s*~=.+/ juju~=3.1.0/g' tox.ini
- name: Render bundle
run: tox -e render-edge
- name: Run tests (edge channel)
run: tox -e integration
- name: Dump logs
if: failure()
uses: canonical/charming-actions/dump-logs@main
end-to-end-tests:
# Must use Juju 3 to bootstrap both uk8s and lxd:https://bugs.launchpad.net/juju/+bug/2003582
name: End-to-end tests
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get prefsrc
run: |
echo "IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')" >> $GITHUB_ENV
- name: Setup lxd controller
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.1/stable
provider: lxd
- name: Save lxd controller name
id: lxd-controller
# The `CONTROLLER_NAME` envvar is set by the actions-operator action
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT
- name: Setup k8s controller
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.1/stable
provider: microk8s
channel: 1.25-strict/stable
microk8s-addons: "hostpath-storage dns metallb:${{ env.IPADDR }}-${{ env.IPADDR }}"
- name: Save k8s controller name
id: k8s-controller
# The `CONTROLLER_NAME` envvar is set by the actions-operator action
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT
- name: Fix microk8s permissions
run: |
chmod -R ugo+rwX ~/.kube
- name: Update python-libjuju dependency to match juju
run: sed -E -i 's/^\s*juju\s*~=.+/ juju~=3.1.0/g' tox.ini
- name: Render bundle
run: tox -e render-edge
- name: Run end-to-end tests
run: tox run -vve e2e
env:
K8S_CONTROLLER: ${{ steps.k8s-controller.outputs.name }}
LXD_CONTROLLER: ${{ steps.lxd-controller.outputs.name }}
- name: Dump logs
if: failure()
uses: canonical/charming-actions/dump-logs@main