diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index fa1bd93..25928d7 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -44,11 +44,8 @@ jobs: with: command: fmt args: --all -- --check - - name: Run doctest - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace --doc + - name: Run doctests + run: ./tools/run_doctests.sh - name: Run cargo doc # This step is required to detect possible errors in docs that are not doctests. uses: actions-rs/cargo@v1 diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 3b4866e..5a0d85b 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -56,8 +56,6 @@ jobs: uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - - name: Build Digital Twins Connector - run: ./cloud_connectors/azure/digital_twins_connector/build.sh - name: Build MQTT Connector's Azure Function run: dotnet build cloud_connectors/azure/mqtt_connector/azure_function/src/function.csproj - name: Perform CodeQL Analysis diff --git a/cloud_connectors/azure/mqtt_connector/README.md b/cloud_connectors/azure/mqtt_connector/README.md index a1dfb77..b12de21 100644 --- a/cloud_connectors/azure/mqtt_connector/README.md +++ b/cloud_connectors/azure/mqtt_connector/README.md @@ -12,7 +12,7 @@ The Azure MQTT Cloud Connector forwards data emitted by Freyja to an Azure Event ![Component Diagram](../../../docs/diagrams/azure_mqtt_cloud_connector.svg) -Note that since this cloud connector interfaces with MQTT, it can be configured for use with any MQTT endpoint, not just the Azure-based solution shown here. The architecture diagram and the setup steps presented in this document provide a sample of a full end-to-end architecture that integrates this connector with a cloud digital twin solution. +Note that since this cloud connector interfaces with MQTT, it can be configured for use with any MQTT endpoint, not only the Azure-based solution shown here. The architecture diagram and the setup steps presented in this document provide a sample of a full end-to-end architecture that integrates this connector with a cloud digital twin solution. ## Prerequisites diff --git a/tools/run_doctests.sh b/tools/run_doctests.sh new file mode 100755 index 0000000..ae5966d --- /dev/null +++ b/tools/run_doctests.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# SPDX-License-Identifier: MIT + +# Running `cargo test --workspace --doc` will fail if the workspace contains only binary packages. +# Normally doc tests are only supported for library packages and binary packages will be skipped, +# but for some reason if a workspace contains only binary packages then the test command will fail. +# This script runs the test command and suppresses the error caused in this case. +# Unfortunately there are no tools to easily navigate a workspace and filter packages by type, +# so this script works by checking the output of the test command. +# Although this is not robust, it is far simpler than the alternative. +OUTPUT=$(cargo test --workspace --doc 2>&1) +RETURN_CODE=$? + +echo $OUTPUT +echo + +if [[ $OUTPUT =~ "error: no library targets found in packages" ]]; then + echo "Detected 'no library targets' error, which is being suppressed" + exit 0 +else + exit $RETURN_CODE +fi \ No newline at end of file