-
Notifications
You must be signed in to change notification settings - Fork 100
145 lines (139 loc) · 4.22 KB
/
test.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Testing
on: [push, pull_request, workflow_dispatch]
jobs:
lint:
name: Linter
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.9"
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run linter
run: |
tox -e lint
./scripts/copyright.sh
build-test:
name: Build test
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Run build test target
run: |
make build-test
unit-tests:
needs: lint
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.9"
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e py3
integration:
name: Integration
needs: [lint, unit-tests]
timeout-minutes: 150
runs-on: ubuntu-latest
strategy:
matrix:
python:
# We will reduce the workload to 3.10 to
# save some resources for now.
# - "3.9"
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
juju-channel: 3.4/stable
# 2023-01-11 Commented until we discover a
# clear approach for this.
# - name: Set proxy in controller
# run: |
# set -euxo pipefail
# # build a squid config file
# CONTROLLER_IP=$(juju list-controllers --format yaml | yq '.controllers[.current-controller].recent-server' | awk -F '[:]' '{print $1}');
# echo "Controller IP is: $CONTROLLER_IP"
# PROXY=$CONTROLLER_IP:3128
# echo "Proxy address is: $PROXY"
# echo "acl all src all" > squid.conf
# echo "http_access allow all" >> squid.conf
# echo "http_port $PROXY" >> squid.conf
# cat squid.conf
# # copy to the controller and reconfigure it
# juju status -m controller
# juju switch controller
# juju ssh 0 "sudo apt-get install squid -y"
# juju scp squid.conf 0:/tmp/squid.conf
# juju ssh 0 "sudo mv /tmp/squid.conf /etc/squid/squid.conf"
# juju ssh 0 "sudo squid -k reconfigure"
# # Test curl after waiting
# sleep 10
# echo "Test proxy access"
# curl -s -o /dev/null -w "%{http_code}" --proxy http://$PROXY https://charmhub.io
# # set model defaults
# juju model-defaults apt-http-proxy=$PROXY apt-https-proxy=$PROXY juju-http-proxy=$PROXY juju-https-proxy=$PROXY snap-http-proxy=$PROXY snap-https-proxy=$PROXY
# juju model-defaults
- name: Run integration
# Force one single concurrent test
run: tox -e integration
integration-quarantine:
name: Quarantined Integration Tests
needs: [lint, unit-tests]
timeout-minutes: 150
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
juju-channel: 3.4/stable
- name: Run integration
run: tox -e integration-quarantine