-
Notifications
You must be signed in to change notification settings - Fork 158
139 lines (119 loc) · 5.53 KB
/
zephyr.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
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
name: Zephyr tests
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
jobs:
run_test:
name: Build and run
strategy:
matrix:
config:
- zephyr-ref: v3.4.0
zephyr-sdk: 0.16.1
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Install dependencies
run: |
# Don't prompt for anything
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
# most of the ci-base zephyr docker image packages
sudo apt-get install -y mosquitto mosquitto-clients zip bridge-utils uml-utilities \
git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 \
autoconf automake bison build-essential ca-certificates cargo ccache chrpath cmake \
cpio device-tree-compiler dfu-util diffstat dos2unix doxygen file flex g++ gawk gcc \
gcovr git git-core gnupg gperf gtk-sharp2 help2man iproute2 lcov libcairo2-dev \
libglib2.0-dev libgtk2.0-0 liblocale-gettext-perl libncurses5-dev libpcap-dev \
libpopt0 libsdl1.2-dev libsdl2-dev libssl-dev libtool libtool-bin locales make \
net-tools ninja-build openssh-client parallel pkg-config python3-dev python3-pip \
python3-ply python3-setuptools python-is-python3 qemu rsync socat srecord sudo \
texinfo unzip wget ovmf xz-utils
- name: Install west
run: sudo pip install west
- name: Init west workspace
run: west init --mr ${{ matrix.config.zephyr-ref }} zephyr
- name: Update west.yml
working-directory: zephyr/zephyr
run: |
REF=$(echo '${{ github.ref }}' | sed -e 's/\//\\\//g')
sed -e 's/remotes:/remotes:\n \- name: wolfssl\n url\-base: https:\/\/github.com\/wolfssl/' -i west.yml
sed -e "s/remotes:/remotes:\n \- name: wolfmqtt\n url\-base: https:\/\/github.com\/${{ github.repository_owner }}/" -i west.yml
sed -e "s/projects:/projects:\n \- name: wolfMQTT\n path: modules\/lib\/wolfmqtt\n remote: wolfmqtt\n revision: $REF/" -i west.yml
sed -e 's/projects:/projects:\n \- name: wolfssl\n path: modules\/crypto\/wolfssl\n remote: wolfssl\n revision: master/' -i west.yml
- name: Update west workspace
working-directory: zephyr
run: west update -n -o=--depth=1
- name: Export zephyr
working-directory: zephyr
run: west zephyr-export
- name: Install pip dependencies
working-directory: zephyr
run: sudo pip install -r zephyr/scripts/requirements.txt
- name: Install zephyr SDK
run: |
wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${{ matrix.config.zephyr-sdk }}/zephyr-sdk-${{ matrix.config.zephyr-sdk }}_linux-x86_64.tar.xz
tar xf zephyr-sdk-${{ matrix.config.zephyr-sdk }}_linux-x86_64.tar.xz
cd zephyr-sdk-${{ matrix.config.zephyr-sdk }}
./setup.sh -h -c
- name: Setup qemu networking
working-directory: zephyr/tools/net-tools
run: |
make
./loop-socat.sh &
sleep 1 # let the networks set everything up
sudo ./loop-slip-tap.sh -v &
sleep 1 # let the networks set everything up
- name: Setup mosquitto broker and sub
working-directory: zephyr/modules/lib/wolfmqtt
run: |
# Disable default broker daemon
sudo service mosquitto stop
mosquitto -c scripts/broker_test/mosquitto.conf &> broker.log &
sleep 1 # let the broker set everything up
mosquitto_sub -p 11883 -t sensors &> sub.log &
# This is some debug info useful if something goes wrong
- name: Show network status
run: |
sudo ifconfig
sudo route
sudo netstat -tulpan
- name: Run client
id: client-test
working-directory: zephyr
run: |
./zephyr/scripts/twister --testsuite-root modules/lib/wolfmqtt --test zephyr/samples/client/sample.lib.wolfmqtt_client -vvv
rm -rf zephyr/twister-out
- name: Check output
run: |
grep test zephyr/modules/lib/wolfmqtt/sub.log
> zephyr/modules/lib/wolfmqtt/sub.log # clear file
- name: Run tls client
id: client-tls-test
working-directory: zephyr
run: |
./zephyr/scripts/twister --testsuite-root modules/lib/wolfmqtt --test zephyr/samples/client_tls/sample.lib.wolfmqtt_client_tls -vvv
rm -rf zephyr/twister-out
- name: Check output
run: |
grep test zephyr/modules/lib/wolfmqtt/sub.log
> zephyr/modules/lib/wolfmqtt/sub.log # clear file
- name: Zip failure logs
if: ${{ failure() && (steps.client-test.outcome == 'failure' || steps.client-tls-test.outcome == 'failure') }}
run: |
zip -9 -r logs.zip zephyr/twister-out
zip -9 logs.zip zephyr/modules/lib/wolfmqtt/broker.log \
zephyr/modules/lib/wolfmqtt/sub.log
- name: Upload failure logs
if: ${{ failure() && (steps.client-test.outcome == 'failure' || steps.client-tls-test.outcome == 'failure') }}
uses: actions/upload-artifact@v3
with:
name: zephyr-client-test-logs
path: logs.zip
retention-days: 5