-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding docker-based integration test (#940)
- Loading branch information
Showing
18 changed files
with
251 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
\#* | ||
|
||
/udmi-support_*/ | ||
/site_model | ||
udmi_site_model/ | ||
gcp_reflect_key.pkcs8 | ||
workspace.xml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.