-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (221 loc) · 9.28 KB
/
integration_tests.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Integration Tests
on:
push:
workflow_dispatch:
inputs:
package_channel:
description: 'Modality package channel (stable/nightly)'
required: true
default: 'stable'
type: choice
options:
- stable
- nightly
env:
MODALITY_URL: "http://localhost:14181/v1"
MODALITY_WORKSPACE: "ci-tests"
RENODE_CI_MODE: YES
jobs:
demo:
name: Run, collect, and test
timeout-minutes: 30
runs-on: ubuntu-20.04
steps:
- name: Print Environment
run: |
echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW"
echo "GITHUB_RUN_ID=$GITHUB_RUN_ID"
echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER"
echo "GITHUB_JOB=$GITHUB_JOB"
echo "GITHUB_ACTION=$GITHUB_ACTION"
echo "GITHUB_ACTOR=$GITHUB_ACTOR"
echo "GITHUB_REF=$GITHUB_REF"
echo "GITHUB_SHA=$GITHUB_SHA"
echo "PACKAGE_CHANNEL=${{inputs.package_channel}}"
docker --version
- name: Checkout Sources
uses: actions/checkout@v4
- name: Login to github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.AUXON_GHCR_TOKEN_RO }}
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libftdi1-dev libudev-dev bridge-utils gcc-arm-none-eabi binutils-arm-none-eabi
- name: Install renode (latest)
run: |
cd /opt
sudo wget --quiet --output-document renode.tar.gz https://builds.renode.io/renode-latest.linux-portable.tar.gz
sudo mkdir renode
sudo tar xf renode.tar.gz -C renode --strip-components 1
sudo pip install -r /opt/renode/tests/requirements.txt
echo "PATH=/opt/renode:${PATH}" >> $GITHUB_ENV
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
toolchain: stable
- name: Build release binaries
run: cargo build --release
- name: Install Auxon client packages
env:
DEBIAN_FRONTEND: noninteractive
run: |
wget --no-verbose --quiet https://get.keygen.sh/auxon-io/auxon.deb -O /tmp/auxon.deb
sudo apt-get install -y /tmp/auxon.deb
sudo apt-get update
sudo apt-get install -y --no-install-recommends modality-client conform deviant
- name: Start Modality server
run: |
image="ghcr.io/auxoncorp/modalityd:latest"
if [ "${{inputs.package_channel}}" == "nightly" ]; then
image="ghcr.io/auxoncorp/modalityd-nightly:latest"
fi
mkdir -p modalityd_data
docker run \
--name modalityd \
--network=host \
-v "$(pwd)/modalityd_data:/data-dir" \
-e MODALITY_ACCEPT_EULA=Y \
-e MODALITY_LICENSE_KEY="${{secrets.MODALITY_LICENSE_KEY}}" \
-e NO_TLS=Y \
-d --rm \
${image}
curl --retry-max-time 30 --retry 10 --retry-connrefused ${{env.MODALITY_URL}}/alive
docker logs modalityd
- name: Setup initial Modality configuration
run: |
modality --version
modality config --modalityd ${{env.MODALITY_URL}}
modality user create --use ci
echo "MODALITY_AUTH_TOKEN=$(modality user auth-token)" >> $GITHUB_ENV
modality workspace create --use ${{env.MODALITY_WORKSPACE}} test_system/config/workspace.toml
- name: Update reflector plugins
run: |
sudo mkdir -p /usr/lib/modality-reflector-plugins/importers
sudo mkdir -p /usr/lib/modality-reflector-plugins/collectors
sudo cp target/release/modality-trace-recorder-importer /usr/lib/modality-reflector-plugins/importers/
sudo cp target/release/modality-trace-recorder-tcp-collector /usr/lib/modality-reflector-plugins/collectors/
sudo cp target/release/modality-trace-recorder-itm-collector /usr/lib/modality-reflector-plugins/collectors/
- name: Create specs
run: |
conform spec create --file test_system/specs/device.speqtr device-specs
- name: Setup test network
working-directory: test_system
run: sudo ./scripts/setup_network.sh &
- name: Build test system with TCP stream port
working-directory: test_system
run: ./scripts/build.sh -DSTREAM_PORT=TCP
- name: Start Modality Reflector
working-directory: test_system
run: |
image="ghcr.io/auxoncorp/modality-reflector:latest"
if [ "${{inputs.package_channel}}" == "nightly" ]; then
image="ghcr.io/auxoncorp/modality-reflector-nightly:latest"
fi
docker run \
--name reflector \
--network=host \
-e GITHUB_JOB="$GITHUB_JOB" \
-e GITHUB_SHA="$GITHUB_SHA" \
-e GIT_COMMIT="$GIT_COMMIT" \
-e GITHUB_RUN_NUMBER="$GITHUB_RUN_NUMBER" \
-e INGEST_PROTOCOL_PARENT_URL="modality-ingest://127.0.0.1" \
-e MUTATION_PROTOCOL_PARENT_URL="modality-mutation://127.0.0.1" \
-v "/usr/lib/modality-reflector-plugins:/usr/lib/modality-reflector-plugins" \
-v "$(pwd)/config/reflector_config_tcp.toml:/reflector_config.toml" \
-e MODALITY_AUTH_TOKEN="${{env.MODALITY_AUTH_TOKEN}}" \
-e REFLECTOR_OPTS="--config /reflector_config.toml --collector trace-recorder-tcp" \
-d --rm \
${image}
- name: Run the system with TCP stream port
working-directory: test_system
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
./scripts/run.sh
sleep 1
docker container stop -s SIGINT reflector
- name: Build test system with RTT stream port
working-directory: test_system
run: ./scripts/build.sh -DSTREAM_PORT=RTT
- name: Run the system with RTT stream port
working-directory: test_system
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
./scripts/run.sh
- name: Import RTT data
working-directory: test_system
run: |
image="ghcr.io/auxoncorp/modality-reflector:latest"
if [ "${{github.event.inputs.package_channel}}" == "nightly" ]; then
image="ghcr.io/auxoncorp/modality-reflector-nightly:latest"
fi
docker run \
--name reflector \
--network=host \
-e GITHUB_JOB="$GITHUB_JOB" \
-e GITHUB_SHA="$GITHUB_SHA" \
-e GIT_COMMIT="$GIT_COMMIT" \
-e GITHUB_RUN_NUMBER="$GITHUB_RUN_NUMBER" \
-e RUST_LOG=modality_trace_recorder=trace \
-e INGEST_PROTOCOL_PARENT_URL="modality-ingest://127.0.0.1" \
-e MUTATION_PROTOCOL_PARENT_URL="modality-mutation://127.0.0.1" \
-v "/usr/lib/modality-reflector-plugins:/usr/lib/modality-reflector-plugins" \
-v "$(pwd)/config/reflector_config_rtt.toml:/reflector_config.toml" \
-v "/tmp/rtt_log.bin:/rtt_log.bin" \
-e MODALITY_AUTH_TOKEN="${{env.MODALITY_AUTH_TOKEN}}" \
-e IMPORT=1 \
-e REFLECTOR_OPTS="--config /reflector_config.toml trace-recorder" \
${image}
- name: Inspect data
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
modality workspace sync-indices
modality workspace list
modality workspace inspect ${{env.MODALITY_WORKSPACE}}
modality segment list
- name: Evaluate specs
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
conform spec eval --name device-specs --segment "RTT:$GITHUB_RUN_NUMBER"
conform spec eval --name device-specs --segment "TCP:$GITHUB_RUN_NUMBER"
- name: Spec coverage
continue-on-error: true
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
echo '# RTT Spec Coverage' >> $GITHUB_STEP_SUMMARY
conform spec coverage --format text --segment "RTT:$GITHUB_RUN_NUMBER" >> $GITHUB_STEP_SUMMARY || true
echo '# TCP Spec Coverage' >> $GITHUB_STEP_SUMMARY
conform spec coverage --format text --segment "TCP:$GITHUB_RUN_NUMBER" >> $GITHUB_STEP_SUMMARY || true
- name: Export Data
if: always()
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
datetime=$(date +'%Y-%m-%dT%H-%M-%SZ')
tarfile=trc_test_system_modality_data_${datetime}.tar.gz
echo TARBALL_NAME=${tarfile} >> $GITHUB_ENV
docker container stop -s SIGTERM -t 20 modalityd
modality user auth-token > modalityd_data/user_auth_token
cp /tmp/rtt_log.bin modalityd_data/
sudo rm -rf modalityd_data/index_invalidation_events
sudo rm -f modalityd_data/lcache
tar czvf ${tarfile} modalityd_data
- name: Upload Modality data
if: always()
uses: actions/upload-artifact@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.TARBALL_NAME }}
path: ${{ env.TARBALL_NAME }}
retention-days: 2
if-no-files-found: error