-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (60 loc) · 2.02 KB
/
ci.yml
File metadata and controls
68 lines (60 loc) · 2.02 KB
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
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install Dependencies
run: |
sudo apt-get update; sudo apt-get install socat
pip install tox
- name: Run Tox
run: tox -e py
- name: Run API test
run: |
wget https://raw.githubusercontent.com/UpdateHub/updatehub/master/doc/agent-http.yaml \
-O agent-http.yaml
docker run \
--rm \
--detach=true \
--name agent-sdk-python-mock \
-p 8080:8000 \
-v $PWD/agent-http.yaml:/api.yaml \
danielgtaylor/apisprout@sha256:6c07143937e57095d8478efc8ab7eab52b44e67c7673285f8c0a2bf4a7b137ad \
/api.yaml --validate-request
PYTHONPATH=. python examples/api.py
- name: Run listener test
run: |
export UH_LISTENER_TEST=updatehub-statechange.sock
PYTHONPATH=. python3.6 examples/state_change_listener.py &
while [ ! -S "$UH_LISTENER_TEST" ]; do
sleep 1
done
if [[ "$(echo "download" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "cancel" ]]; then
echo "Unexpected download response"
exit 1
fi
if [[ "$(echo "install" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
echo "Unexpected install response"
exit 2
fi
if [[ "$(echo "error" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
echo "Unexpected error response"
exit 3
fi
if [[ "$(echo "reboot" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
echo "Unexpected reboot response"
exit 4
fi