-
Notifications
You must be signed in to change notification settings - Fork 49
172 lines (163 loc) · 6.03 KB
/
integration.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
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
name: UDMI Integration Suite
on:
push:
tags:
- '**'
workflow_dispatch:
jobs:
images:
name: Build Docker Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
container: [ "udmis", "validator", "pubber", "misc" ]
env:
PUSH_REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
CONTAINER: ${{ matrix.container }}
REF_NAME: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Log in to the github registry
uses: docker/login-action@v3
with:
registry: ${{ env.PUSH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Container build and push
run: |
revhash=$(git log -n 1 --pretty=format:"%h")
IMAGE_HASH=g${revhash:0:8}
PUSH_REPO=$PUSH_REGISTRY/${IMAGE_NAME,,}
TAG_BASE=$PUSH_REPO:$CONTAINER
PUSH_TAG=${TAG_BASE}-$IMAGE_HASH
echo PUSH_TAG=$PUSH_TAG >> $GITHUB_ENV
bin/clone_model
$CONTAINER/bin/build check
bin/container $CONTAINER push --no-check $PUSH_TAG
docker tag $CONTAINER:latest $TAG_BASE-latest
docker push $TAG_BASE-latest
docker tag $CONTAINER:latest $TAG_BASE-$REF_NAME
docker push $TAG_BASE-$REF_NAME
echo Pushed built $CONTAINER container as $PUSH_TAG | tee -a $GITHUB_STEP_SUMMARY
- name: Docker images summary
run: |
docker images
echo
docker history $PUSH_TAG
simple:
name: Simple sequence test
runs-on: ubuntu-latest
timeout-minutes: 5
needs: images
strategy:
fail-fast: false
matrix:
device_id: [ "AHU-1", "AHU-22", "GAT-123" ]
env:
IMAGE_NAME: ${{ github.repository }}
REF_NAME: ${{ github.ref_name }}
DEVICE_ID: ${{ matrix.device_id }}
steps:
- name: Setup Environment
run: |
sudo apt-get install moreutils
git clone https://github.com/faucetsdn/udmi_site_model.git
ln -s udmi_site_model/ site_model
(cd site_model; git log -n 1)
jq ".device_id = \"$DEVICE_ID\"" site_model/cloud_iot_config.json | sponge site_model/cloud_iot_config.json
jq . site_model/cloud_iot_config.json
docker network create udminet --subnet 192.168.99.0/24
- name: Start UDMIS container
run: |
export IMAGE_TAG=ghcr.io/$IMAGE_NAME:udmis-$REF_NAME
docker run $IMAGE_TAG cat bin/actualize > /tmp/actualize.sh
cat /tmp/actualize.sh && bash /tmp/actualize.sh
- name: Registrar run
run: |
docker run --net udminet --name registrar -v $(realpath site_model):/root/site_model \
ghcr.io/$IMAGE_NAME:validator-$REF_NAME bin/registrar site_model/cloud_iot_config.json
- name: Pubber background run
run: |
echo docker run -d --net udminet --name pubber -v $(realpath site_model):/root/site_model \
ghcr.io/$IMAGE_NAME:pubber-$REF_NAME bin/pubber site_model/cloud_iot_config.json
docker run -d --net udminet --name pubber -v $(realpath site_model):/root/site_model \
ghcr.io/$IMAGE_NAME:pubber-$REF_NAME bin/pubber site_model/cloud_iot_config.json
for count in `seq 0 30`; do
(docker ps | fgrep -q pubber) || break
(docker logs pubber 2>&1 | fgrep -q -v "Connection complete") || break
echo Waiting for pubber startup $((30 - count))...
sleep 1
done
docker logs pubber 2>&1 | fgrep "Connection complete"
- name: Sequencer run
run: |
SEQUENCER_TESTS="broken_config extra_config device_config_acked"
[[ $REF_NAME =~ test- ]] && SEQUENCER_TESTS=${REF_NAME#test-}
docker run --net udminet --name sequencer -v $(realpath site_model):/root/site_model \
ghcr.io/$IMAGE_NAME:validator-$REF_NAME bin/sequencer site_model/cloud_iot_config.json \
$SEQUENCER_TESTS
- name: Sequencer results
run: |
cat site_model/out/devices/$DEVICE_ID/results.md
if [[ $REF_NAME =~ test- ]]; then
SPECIFIC_TEST=${REF_NAME#test-}
more site_model/out/devices/$DEVICE_ID/tests/$SPECIFIC_TEST/*
else
[[ $(cat site_model/out/devices/$DEVICE_ID/results.md | egrep 'stable \| [0-9]+ \| (pass|skip)' | wc -l) == 3 ]]
fi
- name: UDMIS logs
if: ${{ !cancelled() }}
run: |
docker logs udmis
more var/tmp/udmis.log
- name: Registrar logs
if: ${{ !cancelled() }}
run: docker logs registrar
- name: Pubber logs
if: ${{ !cancelled() }}
run: docker logs pubber
- name: Sequencer logs
if: ${{ !cancelled() }}
run: docker logs sequencer
discovery:
name: Simple discovery test
runs-on: ubuntu-latest
timeout-minutes: 5
needs: images
env:
IMAGE_NAME: ${{ github.repository }}
REF_NAME: ${{ github.ref_name }}
steps:
- name: Execute discovery node
run: |
export IMAGE_TAG=ghcr.io/$IMAGE_NAME:misc-$REF_NAME
# This currently fails (no config), but just check that it actually runs.
docker run $IMAGE_TAG discoverynode/bin/run | fgrep "Loading config"
udmif:
name: UDMIF unit tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.9.0
- name: Install Angular CLI
run: npm install -g @angular/cli
- name: web tests
run: echo Disabled udmif/web/runTests due to dependency integration problems
- name: api tests
run: echo Disabled udmif/api/runTests due to dependency integration problems