-
Notifications
You must be signed in to change notification settings - Fork 7
123 lines (102 loc) · 3.58 KB
/
check.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Tests
on:
workflow_dispatch:
workflow_call:
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: python3 -m pip install tox
- name: Run linters
run: tox -e lint
unit:
name: Unit
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: python3 -m pip install tox
- name: Run unit test
run: tox -e unit
integration:
name: Integration
needs: [lint, unit]
runs-on: ['self-hosted', 'jammy', 'runner-openstack-exporter']
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox latest release
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: external controller juju config
run: |
mkdir -p $HOME/.local/share/juju
# The credential are stored in repository's secret as base64 encoded string.
# This help to avoid special characters that can interface with the parsing of YAML/JSON files.
echo ${{ secrets.JUJU_CONTROLLERS_YAML }} | base64 -d > $HOME/.local/share/juju/controllers.yaml
echo ${{ secrets.JUJU_ACCOUNTS_YAML }} | base64 -d > $HOME/.local/share/juju/accounts.yaml
- name: append to zaza yaml
run: |
cat >> $HOME/.zaza.yaml <<EOF
---
model_settings:
image-stream: released
update-status-hook-interval: 30s
region: prodstack6
cloud: builder-cloud
credential: builder-cloud-cred
EOF
- name: Configure latest lxd (to build the charm in)
uses: canonical/setup-lxd@2aa6f7caf7d1484298a64192f7f63a6684e648a4 # latest main at time of writing
with:
channel: latest/stable
- name: install external controller required packages
run: |
sudo snap install charmcraft --channel 3.x/stable --classic
sudo snap install juju --channel 3.4/stable --classic
sudo --preserve-env=http_proxy,https_proxy,no_proxy pip3 install tox
juju switch soleng-ci-ctrl-34
# Workaround to avoid missing cookies bug
# https://github.com/search?q=repo%3Ajuju%2Fpython-libjuju%20cookies_for_controller&type=code
juju show-controller soleng-ci-ctrl-34 &>/dev/null
- name: Show juju information
run: |
juju version
juju controllers | grep Version -A 1 | awk '{print $9}'
- name: Build the charm
run: charmcraft -v pack
- name: Build charm and run tests
run: |
export CHARM_PATH_JAMMY="$(pwd)/$(ls | grep '.*22.04.*\.charm$')"
echo "$CHARM_PATH_JAMMY"
export CHARM_PATH_FOCAL="$(pwd)/$(ls | grep '.*20.04.*\.charm$')"
echo "$CHARM_PATH_FOCAL"
tox -e func
env:
TEST_JUJU3: "1" # https://github.com/openstack-charmers/zaza/pull/653