Skip to content

Fix testing pipeline for cases with bad device state #8620

Fix testing pipeline for cases with bad device state

Fix testing pipeline for cases with bad device state #8620

Workflow file for this run

name: UDMI test suite
on:
push:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 13 * * *'
concurrency:
group: ci-${{ github.repository }}
cancel-in-progress: true
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Checkout source
uses: actions/checkout@v3
- name: start and test local servers
run: |
bin/setup_base
bin/clone_model
bin/start_pubsub
bin/test_mosquitto
- name: bin/run_tests all_tests
run: bin/run_tests all_tests
- name: all test output
if: ${{ always() }}
run: more out/test_*
spelling:
name: Docs Spelling Checks
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- name: Check Spelling
uses: rojopolis/spellcheck-github-actions@0.35.0
with:
config_path: .spellcheck.yml
task_name: Markdown
udmif:
name: UDMIF unit tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
- name: Install Angular CLI
run: npm install -g @angular/cli
- name: web tests
run: udmif/web/runTests
- name: api tests
run: udmif/api/runTests
pretest:
name: Pre-test Setup
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
timeout-minutes: 10
if: vars.TARGET_PROJECT != ''
env:
PUSH_REGISTRY: ghcr.io
TARGET_PROJECT: ${{ vars.TARGET_PROJECT }}
UDMI_ALT_REGISTRY: ZZ-REDIRECT-NA
UDMI_UPDATE_UDMIS: ${{ vars.UDMI_UPDATE_UDMIS }}
IMAGE_NAME: ${{ github.repository }}
GITHUB_REF: ${{ github.ref }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: sanity check
run: |
[[ -n $UDMI_ALT_REGISTRY ]]
[[ -n $TARGET_PROJECT ]]
- name: Log in to the github registry
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v2
with:
registry: ${{ env.PUSH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup udmis container build
if: ${{ github.event_name == 'push' }}
run: |
revhash=$(git log -n 1 --pretty=format:"%h" udmis)
IMAGE_TAG=U${revhash:0:9}
PUSH_REPO=$PUSH_REGISTRY/${{ github.repository }}
PUSH_TAG=$PUSH_REPO:udmis-$IMAGE_TAG
echo PUSH_TAG=$PUSH_TAG >> $GITHUB_ENV
bin/container udmis prep --no-check $PUSH_TAG
echo Pushing built container as $PUSH_TAG | tee -a $GITHUB_STEP_SUMMARY
- name: Build and push docker image
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v4
with:
file: udmis/Dockerfile.udmis
context: udmis
push: true
tags: ${{ env.PUSH_TAG }}
- name: Update udmis deployment
if: ${{ env.UDMI_UPDATE_UDMIS != '' }}
run: |
bin/clone_model
bin/update_udmis sites/udmi_site_model/ $TARGET_PROJECT $PUSH_TAG
sequencer:
name: Sequencer Tests
runs-on: ubuntu-latest
needs: pretest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
if: vars.TARGET_PROJECT != ''
env:
TARGET_PROJECT: ${{ vars.TARGET_PROJECT }}
UDMI_ALT_REGISTRY: ZZ-REDIRECT-NA
UDMI_REGISTRY_SUFFIX: _${{ matrix.shard }}
MATRIX_SHARD_COUNT: 10
MATRIX_SHARD_INDEX: ${{ matrix.shard }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: base setup
run: bin/run_tests install_dependencies
- name: stagger startup
run: sleep $(($MATRIX_SHARD_INDEX * 20 + 20))
- name: registrar clean
run: bin/test_regclean $TARGET_PROJECT
- name: sequence tests clean
run: bin/test_sequencer clean nocheck $TARGET_PROJECT
- name: sequence tests alpha
run: bin/test_sequencer alpha nocheck $TARGET_PROJECT
- name: sequence test post-process
if: ${{ always() }}
run: egrep ' test .* after .*s ' out/sequencer.log > out/timing_sequencer.out
- name: itemized sequencer tests
run: bin/test_itemized $TARGET_PROJECT
- name: output files
if: ${{ always() }}
run: more out/*.out* | cat
- name: pubber logs
if: ${{ always() }}
run: more out/pubber.log* pubber/out/*.json | cat
- name: itemized test post-process
if: ${{ always() }}
run: egrep ' test .* after .*s ' out/sequencer.log-* > out/timing_itemized.out
- name: support bundle
if: ${{ always() }}
run: |
ls -lrt out*/ sites/udmi_site_model/out*/
bin/support ${{ github.repository_owner }}_${{ github.job }}_
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
if-no-files-found: error
name: udmi-support_${{ github.run_id }}
path: '*_udmi-support_*.tgz'
baseline:
name: Baseline Tests
runs-on: ubuntu-latest
needs: pretest
timeout-minutes: 40
if: vars.TARGET_PROJECT != ''
env:
TARGET_PROJECT: ${{ vars.TARGET_PROJECT }}
UDMI_ALT_REGISTRY: ZZ-REDIRECT-NA
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: base setup
run: bin/run_tests install_dependencies
- name: registrar clean
run: bin/test_regclean $TARGET_PROJECT
- name: telemetry validator
run: bin/test_validator $TARGET_PROJECT
- name: validator result
if: ${{ always() }}
run: cat /tmp/validator.out || true
- name: message captures
if: ${{ always() }}
run: |
cd sites/udmi_site_model/out
find . -type f | sort | xargs ls -l
find . -type f | sort | xargs more | cat
- name: nostate sequences
run: bin/test_sequencer nostate full $TARGET_PROJECT
- name: support bundle
if: ${{ always() }}
run: UDMI_REGISTRY_SUFFIX=_b bin/support ${{ github.repository_owner }}_${{ github.job }}_
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
if-no-files-found: error
name: udmi-support_${{ github.run_id }}
path: '*_udmi-support_*.tgz'
redirect:
name: Endpoint Redirection
runs-on: ubuntu-latest
needs: [ pretest, baseline ]
timeout-minutes: 10
if: vars.TARGET_PROJECT != ''
env:
TARGET_PROJECT: ${{ vars.TARGET_PROJECT }}
UDMI_ALT_REGISTRY: ZZ-REDIRECT-NA
MQTT_PROXY_HOST: ${{ vars.MQTT_PROXY_HOST }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: base setup
run: bin/run_tests install_dependencies
- name: bin/test_proxy
if: ${{ env.MQTT_PROXY_HOST != '' }}
run: bin/test_proxy $TARGET_PROJECT $MQTT_PROXY_HOST
- name: bin/test_redirect
run: bin/test_redirect $TARGET_PROJECT
- name: pubber.log
if: ${{ always() }}
run: more out/pubber.log* | cat
- name: support bundle
if: ${{ always() }}
run: UDMI_REGISTRY_SUFFIX=_r bin/support ${{ github.repository_owner }}_${{ github.job }}_
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
if-no-files-found: error
name: udmi-support_${{ github.run_id }}
path: '*_udmi-support_*.tgz'
posttest:
name: Post-test Summarization
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [ baseline, sequencer, redirect ]
if: vars.TARGET_PROJECT != '' && ${{ always() }}
env:
TARGET_PROJECT: ${{ vars.TARGET_PROJECT }}
UDMI_ALT_REGISTRY: ZZ-REDIRECT-NA
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Base setup
run: bin/setup_base
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Processing support package
run: bin/support_process udmi-support_*
- name: Test run index
run: |
ls -d sites/udmi_site_model*/out*/devices/AHU-1/tests/*
find out* -name 'schema*.out*' -size +0 | xargs more | cat
- name: Sequencer validation
if: ${{ always() }}
run: bin/test_sequcheck
- name: Itemized validation
if: ${{ always() }}
run: bin/test_itemcheck