Merge branch 'master' into crony #157
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
name: UDMI Integration Suite | |
on: | |
push: | |
tags: | |
- '**' | |
branches: | |
- '**' | |
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 sequencer test | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: images | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
REF_NAME: ${{ github.ref_name }} | |
DEVICE_ID: ${{'AHU-1'}} | |
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: Generate keys | |
run: | | |
docker run --net udminet --name keygen -v $(realpath site_model):/root/site_model \ | |
ghcr.io/$IMAGE_NAME:validator-$REF_NAME bin/keygen CERT site_model/devices/$DEVICE_ID | |
- 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: Start discoverynode | |
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 -d \ | |
--net udminet \ | |
-v $(realpath site_model):/var/site_model \ | |
--name discoverynode \ | |
$IMAGE_TAG \ | |
bin/run /var/site_model //mqtt/udmis AHU-1 vendor.range=0x65,28179023,20231,,,,,,,,,,,,,,,, | |
- 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 \ | |
scan_single_future | |
- name: Sequencer results | |
run: | | |
cat site_model/out/devices/$DEVICE_ID/results.md | |
[[ $(cat site_model/out/devices/$DEVICE_ID/results.md | grep -Ec ".*discovery.* pass") == 1 ]] | |
- name: Discoverynode logs | |
if: ${{ !cancelled() }} | |
run: docker logs discoverynode | |
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 |