-
Notifications
You must be signed in to change notification settings - Fork 49
153 lines (145 loc) · 5.35 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
name: UDMI Integration Suite
on:
push:
tags:
- '**'
workflow_dispatch:
concurrency:
group: it-${{ github.repository }}
cancel-in-progress: true
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" ]
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
env:
IMAGE_NAME: ${{ github.repository }}
REF_NAME: ${{ github.ref_name }}
steps:
- name: Setup Environment
run: |
git clone https://github.com/faucetsdn/udmi_site_model.git
ln -s udmi_site_model/ site_model
docker network create udminet --subnet 192.168.99.0/24
- name: Start UDMIS container
run: |
cat udmi_site_model/cloud_iot_config.json
docker run -d --net udminet --name udmis -p 8883:8883 \
-v $(realpath site_model):/root/site_model \
-v $PWD/var/tmp:/tmp \
-v $PWD/var/etcd:/root/udmi/var/etcd \
-v $PWD/var/mosquitto:/etc/mosquitto \
ghcr.io/$IMAGE_NAME:udmis-$REF_NAME udmi/bin/start_local block site_model/cloud_iot_config.json
for count in `seq 0 30`; do
echo Waiting for UDMIS startup $((30 - count))
[[ ! -f var/tmp/pod_ready.txt ]] || break
(docker ps | fgrep -q udmis) || break
sleep 1
done
ls -l var/tmp/pod_ready.txt 2>&1
- 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: |
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 \
broken_config extra_config device_config_acked
- name: Sequencer results
run: |
cat site_model/out/devices/AHU-1/results.md
[[ $(cat site_model/out/devices/AHU-1/results.md | fgrep 'stable | pass' | wc -l) == 3 ]]
- name: UDMIS logs
if: ${{ !cancelled() }}
run: docker logs udmis
- 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
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