-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (101 loc) · 4.13 KB
/
ci.yml
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: tbottest selftest CI
on:
push:
branches:
- master
- testing-ci
pull_request:
jobs:
test:
name: Testing
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies, doc-tools
run: |
python -m pip install --upgrade pip
pip3 install --user pytest mypy paramiko termcolor2 pyserial coverage pytest-cov
- name: Configure SSH
env:
SSH_KEY: ${{ secrets.PRIVATE_KEY }}
SSH_HOST: ${{ secrets.TARGET_HOST }}
SSH_USER: ${{ secrets.TARGET_USER }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
echo "SSHUSER: $SSH_USER"
chmod 600 ~/.ssh/staging.key
cat >>~/.ssh/config <<END
Host $SSH_HOST
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
Host 192.168.1.113
HostName 192.168.1.113
User $SSH_USER
ProxyJump $SSH_HOST
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
- name: Run tbottest selftests
run: |
export COLUMNS=160
# for unknown reasons termcolor2 get not found
# but Install step shows, that it is installed
export PYTHONPATH=/home/runner/.local/lib/python3.7/site-packages
mkdir temp
cd temp
# set some git default values so git am works
git config --global user.email "[email protected]"
git config --global user.name "Heiko Schocher"
../scripts/create_setup.sh
# test if ssh works
echo "--------------------- try forwarder ------------------"
ssh -o StrictHostKeyChecking=no -i ~/.ssh/staging.key [email protected] /home/pi/hello.sh
echo "---------------------- try to login on lab -----------"
ssh -o StrictHostKeyChecking=no -i '~/.ssh/staging.key' [email protected] /home/pi/hello.sh
# correct path to keyfile
sed -i "s|/home/\${username}/.ssh/id_rsa|~/.ssh/staging.key|g" tbotconfig/foo/tbot.ini
echo "----- Test commandline completion ------------------------------------"
set +e
returncode=0
RET=$(tbottest/newtbot_starter.py @tbotconfig/foo/args/argsfoo-noeth --complete-module tbotco)
if [[ "${RET}" != "tbotconfig" ]];then
echo "Commandline completion module failed"
returncode=1
fi
RET=$(tbottest/newtbot_starter.py @tbotconfig/foo/args/argsfoo-noeth --complete-module tbotconfig.in)
if [[ "${RET}" != "tbotconfig.interactive" ]];then
echo "Commandline completion module second level failed"
returncode=1
fi
RET=$(tbottest/newtbot_starter.py @tbotconfig/foo/args/argsfoo-noeth --complete-testcase tbotconfig.interactive.la)
if [[ "${RET}" != "tbotconfig.interactive.lab" ]];then
echo "Commandline completion testcase failed"
returncode=1
fi
echo "----- now try to login into lab with tbot setup and do all tests -----"
tbottest/newtbot_starter.py @tbotconfig/foo/args/argsfoo-noeth -q -q tbotconfig.ci.tests.all
exitcode="$?"
if [[ "${exitcode}" != "0" ]];then
echo "doing all tests failed"
returncode=1
fi
# and test second build host
tbottest/newtbot_starter.py @tbotconfig/foo/args/argsfoo-noeth -q -q tbotconfig.ci.testbh.bhall
if [[ "${exitcode}" != "0" ]];then
echo "doing all build host tests failed"
returncode=1
fi
tbottest/newtbot_starter.py @tbotconfig/foo/args/argsfoo-noeth -f buildername:sisyphus -q -q tbotconfig.ci.testbh.bhall
if [[ "${exitcode}" != "0" ]];then
echo "doing all sisyphus build host tests failed"
returncode=1
fi
exit "${returncode}"