diff --git a/.github/actions/generate_viancfg/action.yml b/.github/actions/generate_viancfg/action.yml new file mode 100644 index 0000000..d492463 --- /dev/null +++ b/.github/actions/generate_viancfg/action.yml @@ -0,0 +1,25 @@ +name: 'Generate Dynamic VI Analyzer Config' +description: 'Generates a .viancfg file based on changed files in a PR' +inputs: + template-path: + description: 'Path to the .viancfg template' + required: true + output-path: + description: 'Path to save the generated .viancfg' + required: true + base-branch: + description: 'Branch to compare against' + default: 'origin/develop' + required: false + +runs: + using: "composite" + steps: + - name: Generate VI Analyzer Config + shell: bash + run: | + chmod +x ${{ github.action_path }}/generate_viancfg.sh + ${{ github.action_path }}/generate_viancfg.sh \ + --template-path "${{ inputs.template-path }}" \ + --output-path "${{ inputs.output-path }}" \ + --target-branch "${{ inputs.base-branch }}" \ No newline at end of file diff --git a/.github/actions/generate_viancfg/generate_viancfg.sh b/.github/actions/generate_viancfg/generate_viancfg.sh new file mode 100644 index 0000000..00f5054 --- /dev/null +++ b/.github/actions/generate_viancfg/generate_viancfg.sh @@ -0,0 +1,103 @@ +#!/bin/bash +set -e + +# Parse arguments +TEMPLATE_PATH="" +OUTPUT_PATH="" +TARGET_BRANCH="origin/develop" + +while [[ $# -gt 0 ]]; do + case $1 in + --template-path) + TEMPLATE_PATH="$2" + shift 2 + ;; + --output-path) + OUTPUT_PATH="$2" + shift 2 + ;; + --target-branch) + TARGET_BRANCH="$2" + shift 2 + ;; + *) + echo "Unknown parameter: $1" + exit 1 + ;; + esac +done + +# Validate required parameters +if [ -z "$TEMPLATE_PATH" ] || [ -z "$OUTPUT_PATH" ]; then + echo "Error: --template-path and --output-path are required" + exit 1 +fi + +echo "Generating VI Analyzer config from template: $TEMPLATE_PATH" +echo "Target branch: $TARGET_BRANCH" +echo "" + +# Get changed LabVIEW files relative to the target branch +mapfile -t CHANGED_FILES < <(git diff --name-only "$TARGET_BRANCH" --diff-filter=d | grep -E '\.(vi|ctl|llb)$' || true) + +if [ ${#CHANGED_FILES[@]} -eq 0 ]; then + echo "No LabVIEW files changed. Skipping config generation." + exit 0 +fi + +echo "Found ${#CHANGED_FILES[@]} changed LabVIEW file(s):" +printf '%s\n' "${CHANGED_FILES[@]}" +echo "" + +# Get Git root directory +GIT_ROOT=$(git rev-parse --show-toplevel) + +# Read template XML and prepare output +cp "$TEMPLATE_PATH" "$OUTPUT_PATH" + +OUTPUT_DIR=$(dirname "$OUTPUT_PATH") +if [ -n "$OUTPUT_DIR" ] && [ ! -d "$OUTPUT_DIR" ]; then + mkdir -p "$OUTPUT_DIR" +fi + +# Get the absolute path of the output config for relative path calculation +OUTPUT_ABS_DIR=$(cd "$OUTPUT_DIR" && pwd) + +# Create a temporary file for the items +ITEMS_FILE=$(mktemp) + +for file in "${CHANGED_FILES[@]}"; do + # Construct absolute path + ABSOLUTE_FILE_PATH="$GIT_ROOT/$file" + + # Calculate relative path from output config to the VI + RELATIVE_PATH=$(realpath --relative-to="$OUTPUT_ABS_DIR" "$ABSOLUTE_FILE_PATH") + + FORMATTED_PATH="\"$RELATIVE_PATH\"" + + # Write XML item to temp file + cat >> "$ITEMS_FILE" << EOF + + $FORMATTED_PATH + FALSE + +EOF +done + +# Use awk to insert the items into the template +awk -v items_file="$ITEMS_FILE" ' + /<\/ItemsToAnalyze>/ { + while ((getline line < items_file) > 0) { + print line + } + close(items_file) + } + //,/<\/Item>/ { next } + { print } +' "$TEMPLATE_PATH" > "$OUTPUT_PATH" + +# Clean up temp file +rm -f "$ITEMS_FILE" + +echo "" +echo "Generated config at $OUTPUT_PATH with ${#CHANGED_FILES[@]} items." \ No newline at end of file diff --git a/.github/actions/generate_viancfg/via_template_linux.viancfg b/.github/actions/generate_viancfg/via_template_linux.viancfg new file mode 100644 index 0000000..a59f923 --- /dev/null +++ b/.github/actions/generate_viancfg/via_template_linux.viancfg @@ -0,0 +1,1057 @@ + + +1 +FALSE +"/" +0 + + + "." + FALSE + + + + + "Arrays and Strings in Loops" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Arrays and Strings in Loops.llb" + TRUE + + + + + "Coercion Dots" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Coercion Dots.llb" + TRUE + + + + + "Enabled Debugging" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Enabled Debugging.llb" + TRUE + + + + + "In Place Element Structure Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/In Place Element Structure Usage.llb" + TRUE + + + + + "Inlinable VIs" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Inlinable VIs.llb" + TRUE + + + + + "Parallel For Loop Debugging" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Parallel For Loop Debugging.llb" + TRUE + + + + + "Parallelizable Loops" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Parallelizable Loops.llb" + TRUE + + + + + "Prepend Scalar With Build Array" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Prepend Scalar With Build Array.llb" + TRUE + + + + + "Redundant Boolean Operations" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Redundant Boolean Operations.llb" + TRUE + + + + + "Value Property Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Value Property Usage.llb" + TRUE + + + + + "Wait in While Loop" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Wait in While Loop.llb" + TRUE + + + + + "Wired Terminals in Subdiagrams" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Wired Terminals in Subdiagrams.llb" + TRUE + + + + + "Array Constant Style" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Array Constant Style.llb" + TRUE + + + + + "Backwards Wires" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Backwards Wires.llb" + TRUE + + + + + "Case Structure Default Frame" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Case Structure Default Frame.llb" + TRUE + + + + + "Code Simplification" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Code Simplification.llb" + TRUE + + + + + "Control Terminal Label Visible" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Control Terminal Label Visible.llb" + TRUE + + + + + "Control Terminal Wiring" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Control Terminal Wiring.llb" + TRUE + + + + + "Diagram Disable Structures" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Diagram Disable Structures.llb" + TRUE + + + + + "Mixed Terminal Styles" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Mixed Terminal Styles.llb" + TRUE + + + + + "Poor Names of Enum Items" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Poor Names of Enum Items.llb" + TRUE + + + + + "Sequence Structure Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Sequence Structure Usage.llb" + TRUE + + + + + "String Constant Style" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/String Constant Style.llb" + TRUE + + + + + "Tunnel Position" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Tunnel Position.llb" + TRUE + + + + + "Unused Code" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Unused Code.llb" + TRUE + + + + + "Wire Bends" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Wire Bends.llb" + TRUE + + + + + "Wire Crossings" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Wire Crossings.llb" + TRUE + + + + + "Wires Under Objects" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Wires Under Objects.llb" + TRUE + + + + + "Adding Array Size Elements" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Adding Array Size Elements.llb" + TRUE + + + + + "Array Sum and Product Overflow" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Array Sum and Product Overflow.llb" + TRUE + + + + + "Breakpoint Detection" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Breakpoint Detection.llb" + TRUE + + + + + "Bundling Duplicate Names" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Bundling Duplicate Names.llb" + TRUE + + + + + "Case Structure with String Range" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Case Structure with String Range.llb" + TRUE + + + + + "Error Cluster Wired" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Error Cluster Wired.llb" + TRUE + + + + + "Find Deprecated Items" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Find Deprecated Items.llb" + TRUE + + + + + "For Loop Error Handling" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/For Loop Error Handling.llb" + TRUE + + + + + "For Loop Iteration Count" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/For Loop Iteration Count.llb" + TRUE + + + + + "For Loop Reference Handling" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/For Loop Reference Handling.llb" + TRUE + + + + + "Globals and Locals" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Globals and Locals.llb" + TRUE + + + + + "Hidden Objects in Structures" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Hidden Objects in Structures.llb" + TRUE + + + + + "Hidden Tunnels" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Hidden Tunnels.llb" + TRUE + + + + + "Indexer Datatype" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Indexer Datatype.llb" + TRUE + + + + + "Pattern Label" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Pattern Label.llb" + TRUE + + + + + "Reentrant VI Issues" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Reentrant VI Issues.llb" + TRUE + + + + + "Type Casting References" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Type Casting References.llb" + TRUE + + + + + "Unwired I32 Error" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Unwired I32 Error.llb" + TRUE + + + + + "Cyclomatic Complexity" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Cyclomatic Complexity.llb" + TRUE + + + + + "Depth of Nesting of Structures" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Depth of Nesting of Structures.llb" + TRUE + + + + + "Fan In" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Fan In.llb" + TRUE + + + + + "Fan Out" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Fan Out.llb" + TRUE + + + + + "Modularity Index" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Modularity Index.llb" + TRUE + + + + + "Approved Bookmark Tags" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Approved Bookmark Tags.llb" + TRUE + + + + + "Comment Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Comment Usage.llb" + TRUE + + + + + "Label Call Library Nodes" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Label Call Library Nodes.llb" + TRUE + + + + + "Revision History" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Revision History.llb" + TRUE + + + + + "Spell Check" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/User/Spell Check.llb" + TRUE + + + + + "VI Documentation" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/User/VI Documentation.llb" + TRUE + + + + + "Array Default Values" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/SubVI/Array Default Values.llb" + TRUE + + + + + "Cluster Sized to Fit" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/SubVI/Cluster Sized to Fit.llb" + TRUE + + + + + "Control Alignment" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/SubVI/Control Alignment.llb" + TRUE + + + + + "Alignment Grid Setting" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Alignment Grid Setting.llb" + TRUE + + + + + "Clipped Text" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Clipped Text.llb" + TRUE + + + + + "Dialog Controls" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Dialog Controls.llb" + TRUE + + + + + "Duplicate Control Labels" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Duplicate Control Labels.llb" + TRUE + + + + + "Empty List Items" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Empty List Items.llb" + TRUE + + + + + "Font Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Font Usage.llb" + TRUE + + + + + "Overlapping Controls" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Overlapping Controls.llb" + TRUE + + + + + "Panel Size and Position" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Panel Size and Position.llb" + TRUE + + + + + "Scalar Chart Updates" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Scalar Chart Updates.llb" + TRUE + + + + + "Synchronous Display" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Synchronous Display.llb" + TRUE + + + + + "Transparent Labels" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Transparent Labels.llb" + TRUE + + + + + "SubVI and TypeDef Locations" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/SubVI and TypeDef Locations.llb" + TRUE + + + + + "VI Extension" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Extension.llb" + TRUE + + + + + "VI Name" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Name.llb" + TRUE + + + + + "VI Saved Version" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Saved Version.llb" + TRUE + + + + + "VI Size" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Size.llb" + TRUE + + + + + "Connector Pane Alignment" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Connector Pane Alignment.llb" + TRUE + + + + + "Connector Pane Pattern" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Connector Pane Pattern.llb" + TRUE + + + + + "Default Icon" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Default Icon.llb" + TRUE + + + + + "Error Style" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Error Style.llb" + TRUE + + + + + "Full Connector Pane" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Full Connector Pane.llb" + TRUE + + + + + "Icon Size and Border" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Icon Size and Border.llb" + TRUE + + + + + "Polymorphic Terminals" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Polymorphic Terminals.llb" + TRUE + + + + + "Terminal Connection Type" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Terminal Connection Type.llb" + TRUE + + + + + "Terminal Positions" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Terminal Positions.llb" + TRUE + + + + + "Auto Error Handling Enabled" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Auto Error Handling Enabled.llb" + TRUE + + + + + "Broken VI" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Broken VI.llb" + TRUE + + + + + "Built Application Compatibility" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Built Application Compatibility.llb" + TRUE + + + + + "Control VI Type" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Control VI Type.llb" + TRUE + + + + + "Driver Usage" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Driver Usage.llb" + TRUE + + + + + "Platform Portability" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Platform Portability.llb" + TRUE + + + + + "Removed Diagram" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Removed Diagram.llb" + TRUE + + + + + "Separate Compiled Code Setting" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Separate Compiled Code Setting.llb" + TRUE + + + + + "Toolkit Usage" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Toolkit Usage.llb" + TRUE + + + + + "VI Lock State" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/VI Lock State.llb" + TRUE + + + + + "Connector Inputs and Outputs" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Connector Inputs and Outputs.llb" + TRUE + + + + + "Controls and Indicators" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Controls and Indicators.llb" + TRUE + + + + + "Diagram Count" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Diagram Count.llb" + TRUE + + + + + "Diagram Size" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Diagram Size.llb" + TRUE + + + + + "Node Count" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Node Count.llb" + TRUE + + + + + "Property Reads and Writes" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Property Reads and Writes.llb" + TRUE + + + + + "Shared Library Calls" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Shared Library Calls.llb" + TRUE + + + + + "Structure Count" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Structure Count.llb" + TRUE + + + + + "Wire Sources" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Wire Sources.llb" + TRUE + + + + + + + \ No newline at end of file diff --git a/.github/scripts/parse-via-report.sh b/.github/scripts/parse-via-report.sh new file mode 100644 index 0000000..5dcdf8c --- /dev/null +++ b/.github/scripts/parse-via-report.sh @@ -0,0 +1,146 @@ +#!/bin/bash +set -e +VIA_EXIT_CODE="${1:-0}" + +if [ ! -f "vi-analyzer-report.htm" ]; then + echo "No VI Analyzer report found" + exit $VIA_EXIT_CODE +fi + +echo "" +echo "==================================================" +echo " VI Analyzer Results" +echo "==================================================" +echo "" + +# Extract results +VIS_ANALYZED=$(grep -oP 'VIs Analyzed\K[0-9]+' vi-analyzer-report.htm || echo "0") +TESTS_RUN=$(grep -oP 'Total Tests Run\K[0-9]+' vi-analyzer-report.htm || echo "0") +PASSED=$(grep -oP 'Passed Tests\K[0-9]+' vi-analyzer-report.htm || echo "0") +FAILED=$(grep -oP 'Failed Tests\K[0-9]+' vi-analyzer-report.htm || echo "0") +SKIPPED=$(grep -oP 'Skipped Tests\K[0-9]+' vi-analyzer-report.htm || echo "0") + +# Extract error counts +VI_NOT_LOADABLE=$(grep -oP 'VI not loadable\K[0-9]+' vi-analyzer-report.htm || echo "0") +TEST_NOT_LOADABLE=$(grep -oP 'Test not loadable\K[0-9]+' vi-analyzer-report.htm || echo "0") +TEST_NOT_RUNNABLE=$(grep -oP 'Test not runnable\K[0-9]+' vi-analyzer-report.htm || echo "0") +TEST_ERROR_OUT=$(grep -oP 'Test error out\K[0-9]+' vi-analyzer-report.htm || echo "0") + +echo "VIs Analyzed: $VIS_ANALYZED" +echo "Total Tests: $TESTS_RUN" +echo "Passed: $PASSED" +echo "Failed: $FAILED" +echo "Skipped: $SKIPPED" +echo "" + +if [ "$FAILED" -gt 0 ]; then + echo "==================================================" + echo " Failed Tests Summary" + echo "==================================================" + + # Extract failed test details + awk ' + /Failed Tests/,/Testing Errors/ { + if (match($0, /([^<]+\.vi)<\/b>/, arr)) { + if (vi_name) print "" + vi_name = arr[1] + printf "\n %s\n", vi_name + print "---" + } + if (match($0, /([^<]+)<\/td>([^<]+)<\/td><\/tr>/, arr)) { + test_name = arr[1] + failure_msg = arr[2] + printf " %s\n → %s\n", test_name, failure_msg + } + } + ' vi-analyzer-report.htm + echo "" + HAS_ERRORS=1 +fi + +if [ "$VI_NOT_LOADABLE" -gt 0 ]; then + echo "==================================================" + echo " VI Not Loadable Errors" + echo "==================================================" + + awk ' + /

VI Not Loadable<\/h3>/,/<\/table>/ { + if (match($0, /([^<]+)<\/td>([^<]+)<\/td>([^<]+)<\/td><\/tr>/, arr)) { + vi_name = arr[1] + vi_path = arr[2] + error_msg = arr[3] + printf "\n %s\n", vi_name + printf " Path: %s\n", vi_path + printf " %s\n", error_msg + } + } + ' vi-analyzer-report.htm + echo "" + HAS_ERRORS=1 +fi + +if [ "$TEST_NOT_LOADABLE" -gt 0 ]; then + echo "==================================================" + echo " Test Not Loadable Errors" + echo "==================================================" + + awk ' + /

Test Not Loadable<\/h3>/,/<\/table>/ { + if (match($0, /([^<]+)<\/td>([^<]+)<\/td><\/tr>/, arr)) { + test_name = arr[1] + error_msg = arr[2] + printf "\n %s\n → %s\n", test_name, error_msg + } + } + ' vi-analyzer-report.htm + echo "" + HAS_ERRORS=1 +fi + +if [ "$TEST_NOT_RUNNABLE" -gt 0 ]; then + echo "==================================================" + echo " Test Not Runnable Errors" + echo "==================================================" + + awk ' + /

Test Not Runnable<\/h3>/,/<\/table>/ { + if (match($0, /([^<]+)<\/td>([^<]+)<\/td><\/tr>/, arr)) { + test_name = arr[1] + error_msg = arr[2] + printf "\n %s\n → %s\n", test_name, error_msg + } + } + ' vi-analyzer-report.htm + echo "" + HAS_ERRORS=1 +fi + +if [ "$TEST_ERROR_OUT" -gt 0 ]; then + echo "==================================================" + echo " Test Error Out Errors" + echo "==================================================" + + awk ' + /

Test Error Out<\/h3>/,/<\/table>/ { + if (match($0, /([^<]+)<\/td>([^<]+)<\/td><\/tr>/, arr)) { + test_name = arr[1] + error_msg = arr[2] + printf "\n %s\n → %s\n", test_name, error_msg + } + } + ' vi-analyzer-report.htm + echo "" + HAS_ERRORS=1 +fi + +if [ "$HAS_ERRORS" -eq 1 ]; then + echo "" + echo "==================================================" + echo "See full report in artifacts for complete details." + echo "==================================================" +else + echo " All tests passed!" + echo "==================================================" +fi + +exit $VIA_EXIT_CODE \ No newline at end of file diff --git a/.github/scripts/run-via.sh b/.github/scripts/run-via.sh new file mode 100644 index 0000000..21c623d --- /dev/null +++ b/.github/scripts/run-via.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +# VI Analyzer script for GitHub Actions + +# Accept config path as first argument, default to generated-config.viancfg +CONFIG_PATH="${1:-generated-config.viancfg}" +ABSOLUTE_CONFIG="/workspace/$CONFIG_PATH" +ABSOLUTE_REPORT="/workspace/vi-analyzer-report.htm" +LV_YEAR="${LV_YEAR:-2025}" +LABVIEW_PATH="/usr/local/natinst/LabVIEW-${LV_YEAR}-64/labview" + +# Verify that the configuration path exists +if [ ! -d "$ABSOLUTE_CONFIG" ] && [ ! -f "$ABSOLUTE_CONFIG" ]; then + echo "Error: Configuration path not found at $ABSOLUTE_CONFIG" + exit 1 +fi + +echo "Running LabVIEWCLI VIAnalyzer with the following parameters:" +echo "ConfigPath: $ABSOLUTE_CONFIG" +echo "ReportPath: $ABSOLUTE_REPORT" +echo "LabVIEWPath: $LABVIEW_PATH" +echo "" + +# Run VI Analyzer +LabVIEWCLI \ + -OperationName RunVIAnalyzer \ + -ConfigPath "$ABSOLUTE_CONFIG" \ + -ReportPath "$ABSOLUTE_REPORT" \ + -ReportSaveType HTML \ + -LabVIEWPath "$LABVIEW_PATH" \ + -Headless \ No newline at end of file diff --git a/.github/via-config.viancfg b/.github/via-config.viancfg new file mode 100644 index 0000000..eb87476 --- /dev/null +++ b/.github/via-config.viancfg @@ -0,0 +1,1057 @@ + + +1 +FALSE +"/" +0 + + + ".." + FALSE + + + + + "Arrays and Strings in Loops" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Arrays and Strings in Loops.llb" + TRUE + + + + + "Coercion Dots" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Coercion Dots.llb" + TRUE + + + + + "Enabled Debugging" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Enabled Debugging.llb" + TRUE + + + + + "In Place Element Structure Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/In Place Element Structure Usage.llb" + TRUE + + + + + "Inlinable VIs" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Inlinable VIs.llb" + TRUE + + + + + "Parallel For Loop Debugging" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Parallel For Loop Debugging.llb" + TRUE + + + + + "Parallelizable Loops" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Parallelizable Loops.llb" + TRUE + + + + + "Prepend Scalar With Build Array" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Prepend Scalar With Build Array.llb" + TRUE + + + + + "Redundant Boolean Operations" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Redundant Boolean Operations.llb" + TRUE + + + + + "Value Property Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Value Property Usage.llb" + TRUE + + + + + "Wait in While Loop" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Wait in While Loop.llb" + TRUE + + + + + "Wired Terminals in Subdiagrams" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Performance/Wired Terminals in Subdiagrams.llb" + TRUE + + + + + "Array Constant Style" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Array Constant Style.llb" + TRUE + + + + + "Backwards Wires" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Backwards Wires.llb" + TRUE + + + + + "Case Structure Default Frame" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Case Structure Default Frame.llb" + TRUE + + + + + "Code Simplification" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Code Simplification.llb" + TRUE + + + + + "Control Terminal Label Visible" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Control Terminal Label Visible.llb" + TRUE + + + + + "Control Terminal Wiring" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Control Terminal Wiring.llb" + TRUE + + + + + "Diagram Disable Structures" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Diagram Disable Structures.llb" + TRUE + + + + + "Mixed Terminal Styles" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Mixed Terminal Styles.llb" + TRUE + + + + + "Poor Names of Enum Items" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Poor Names of Enum Items.llb" + TRUE + + + + + "Sequence Structure Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Sequence Structure Usage.llb" + TRUE + + + + + "String Constant Style" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/String Constant Style.llb" + TRUE + + + + + "Tunnel Position" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Tunnel Position.llb" + TRUE + + + + + "Unused Code" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Unused Code.llb" + TRUE + + + + + "Wire Bends" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Wire Bends.llb" + TRUE + + + + + "Wire Crossings" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Wire Crossings.llb" + TRUE + + + + + "Wires Under Objects" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Style/Wires Under Objects.llb" + TRUE + + + + + "Adding Array Size Elements" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Adding Array Size Elements.llb" + TRUE + + + + + "Array Sum and Product Overflow" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Array Sum and Product Overflow.llb" + TRUE + + + + + "Breakpoint Detection" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Breakpoint Detection.llb" + TRUE + + + + + "Bundling Duplicate Names" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Bundling Duplicate Names.llb" + TRUE + + + + + "Case Structure with String Range" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Case Structure with String Range.llb" + TRUE + + + + + "Error Cluster Wired" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Error Cluster Wired.llb" + TRUE + + + + + "Find Deprecated Items" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Find Deprecated Items.llb" + TRUE + + + + + "For Loop Error Handling" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/For Loop Error Handling.llb" + TRUE + + + + + "For Loop Iteration Count" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/For Loop Iteration Count.llb" + TRUE + + + + + "For Loop Reference Handling" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/For Loop Reference Handling.llb" + TRUE + + + + + "Globals and Locals" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Globals and Locals.llb" + TRUE + + + + + "Hidden Objects in Structures" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Hidden Objects in Structures.llb" + TRUE + + + + + "Hidden Tunnels" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Hidden Tunnels.llb" + TRUE + + + + + "Indexer Datatype" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Indexer Datatype.llb" + TRUE + + + + + "Pattern Label" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Pattern Label.llb" + TRUE + + + + + "Reentrant VI Issues" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Reentrant VI Issues.llb" + TRUE + + + + + "Type Casting References" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Type Casting References.llb" + TRUE + + + + + "Unwired I32 Error" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Block Diagram/Warnings/Unwired I32 Error.llb" + TRUE + + + + + "Cyclomatic Complexity" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Cyclomatic Complexity.llb" + TRUE + + + + + "Depth of Nesting of Structures" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Depth of Nesting of Structures.llb" + TRUE + + + + + "Fan In" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Fan In.llb" + TRUE + + + + + "Fan Out" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Fan Out.llb" + TRUE + + + + + "Modularity Index" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Complexity Metrics/Modularity Index.llb" + TRUE + + + + + "Approved Bookmark Tags" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Approved Bookmark Tags.llb" + TRUE + + + + + "Comment Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Comment Usage.llb" + TRUE + + + + + "Label Call Library Nodes" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Label Call Library Nodes.llb" + TRUE + + + + + "Revision History" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/Developer/Revision History.llb" + TRUE + + + + + "Spell Check" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/User/Spell Check.llb" + TRUE + + + + + "VI Documentation" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Documentation/User/VI Documentation.llb" + TRUE + + + + + "Array Default Values" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/SubVI/Array Default Values.llb" + TRUE + + + + + "Cluster Sized to Fit" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/SubVI/Cluster Sized to Fit.llb" + TRUE + + + + + "Control Alignment" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/SubVI/Control Alignment.llb" + TRUE + + + + + "Alignment Grid Setting" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Alignment Grid Setting.llb" + TRUE + + + + + "Clipped Text" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Clipped Text.llb" + TRUE + + + + + "Dialog Controls" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Dialog Controls.llb" + TRUE + + + + + "Duplicate Control Labels" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Duplicate Control Labels.llb" + TRUE + + + + + "Empty List Items" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Empty List Items.llb" + TRUE + + + + + "Font Usage" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Font Usage.llb" + TRUE + + + + + "Overlapping Controls" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Overlapping Controls.llb" + TRUE + + + + + "Panel Size and Position" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Panel Size and Position.llb" + TRUE + + + + + "Scalar Chart Updates" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Scalar Chart Updates.llb" + TRUE + + + + + "Synchronous Display" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Synchronous Display.llb" + TRUE + + + + + "Transparent Labels" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/Front Panel/User Interface/Transparent Labels.llb" + TRUE + + + + + "SubVI and TypeDef Locations" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/SubVI and TypeDef Locations.llb" + TRUE + + + + + "VI Extension" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Extension.llb" + TRUE + + + + + "VI Name" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Name.llb" + TRUE + + + + + "VI Saved Version" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Saved Version.llb" + TRUE + + + + + "VI Size" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/File Properties/VI Size.llb" + TRUE + + + + + "Connector Pane Alignment" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Connector Pane Alignment.llb" + TRUE + + + + + "Connector Pane Pattern" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Connector Pane Pattern.llb" + TRUE + + + + + "Default Icon" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Default Icon.llb" + TRUE + + + + + "Error Style" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Error Style.llb" + TRUE + + + + + "Full Connector Pane" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Full Connector Pane.llb" + TRUE + + + + + "Icon Size and Border" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Icon Size and Border.llb" + TRUE + + + + + "Polymorphic Terminals" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Polymorphic Terminals.llb" + TRUE + + + + + "Terminal Connection Type" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Terminal Connection Type.llb" + TRUE + + + + + "Terminal Positions" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/Icon and Connector Pane/Terminal Positions.llb" + TRUE + + + + + "Auto Error Handling Enabled" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Auto Error Handling Enabled.llb" + TRUE + + + + + "Broken VI" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Broken VI.llb" + TRUE + + + + + "Built Application Compatibility" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Built Application Compatibility.llb" + TRUE + + + + + "Control VI Type" + 1 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Control VI Type.llb" + TRUE + + + + + "Driver Usage" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Driver Usage.llb" + TRUE + + + + + "Platform Portability" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Platform Portability.llb" + TRUE + + + + + "Removed Diagram" + 2 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Removed Diagram.llb" + TRUE + + + + + "Separate Compiled Code Setting" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Separate Compiled Code Setting.llb" + TRUE + + + + + "Toolkit Usage" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/Toolkit Usage.llb" + TRUE + + + + + "VI Lock State" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/General/VI Properties/VI Lock State.llb" + TRUE + + + + + "Connector Inputs and Outputs" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Connector Inputs and Outputs.llb" + TRUE + + + + + "Controls and Indicators" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Controls and Indicators.llb" + TRUE + + + + + "Diagram Count" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Diagram Count.llb" + TRUE + + + + + "Diagram Size" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Diagram Size.llb" + TRUE + + + + + "Node Count" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Node Count.llb" + TRUE + + + + + "Property Reads and Writes" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Property Reads and Writes.llb" + TRUE + + + + + "Shared Library Calls" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Shared Library Calls.llb" + TRUE + + + + + "Structure Count" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Structure Count.llb" + TRUE + + + + + "Wire Sources" + 0 + 5 + "LabVIEW" + "project/_VI Analyzer/_tests/VI Metrics/Wire Sources.llb" + TRUE + + + + + + + \ No newline at end of file diff --git a/.github/workflows/run-via-tests.yml b/.github/workflows/run-via-tests.yml new file mode 100644 index 0000000..9998df4 --- /dev/null +++ b/.github/workflows/run-via-tests.yml @@ -0,0 +1,106 @@ +name: (Work In Progress) Run VIA tests (GitHub Hosted) + +on: + # TODO: Uncomment the original triggers below when ready for full deployment + pull_request: + branches: + - feature/github-actions-cicd # Temporary: only run on this branch + # - main + # - develop + # - release/* + # - feature/* + # - hotfix/* + # types: + # - opened + # - synchronize + # - reopened + # - ready_for_review + + push: + branches: + - feature/github-actions-cicd # Temporary: only run on this branch + # - main + # - develop + # - release/* + # - hotfix/* + # - feature/* + + workflow_dispatch: + +jobs: + run-via-tests: + name: Run VI Analyzer tests + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history + + - name: Determine config file path + id: config-path + run: | + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "path=.github/via-config.viancfg" >> $GITHUB_OUTPUT + else + echo "path=generated-config.viancfg" >> $GITHUB_OUTPUT + fi + + - name: Generate VI Analyzer Config + if: github.event_name != 'workflow_dispatch' + uses: ./.github/actions/generate_viancfg + with: + template-path: '.github/actions/generate_viancfg/via_template_linux.viancfg' + output-path: 'generated-config.viancfg' + base-branch: origin/${{ github.event.pull_request.base.ref || 'develop' }} + + - name: Validate if config file exists + id: check-config + run: | + CONFIG_FILE="${{ steps.config-path.outputs.path }}" + + if [ -f "$CONFIG_FILE" ]; then + echo "Using config: $CONFIG_FILE" + echo "config_exists=true" >> $GITHUB_OUTPUT + else + echo "Error: Config file not found at $CONFIG_FILE" + echo "config_exists=false" >> $GITHUB_OUTPUT + + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "Manual trigger requires .github/via-config.viancfg to exist" + exit 1 + else + echo "No LabVIEW files changed; skipping VI Analyzer tests." + fi + fi + + - name: Pull Docker Image + if: steps.check-config.outputs.config_exists == 'true' + run: docker pull nationalinstruments/labview:2025q3patch1-linux + + - name: Run VI Analyzer tests + if: steps.check-config.outputs.config_exists == 'true' + env: + CONFIG_PATH: ${{ steps.config-path.outputs.path }} + run: | + set +e # Disable exit on error temporarily + + docker run --rm \ + -v "${{ github.workspace }}:/workspace" \ + nationalinstruments/labview:2025q3patch1-linux \ + bash -c "cd /workspace && chmod +x .github/scripts/run-via.sh && ./.github/scripts/run-via.sh '$CONFIG_PATH'" + + VIA_EXIT_CODE=$? + set -e # Re-enable exit on error + + chmod +x .github/scripts/parse-via-report.sh + ./.github/scripts/parse-via-report.sh "$VIA_EXIT_CODE" + + - name: Upload VI Analyzer Report + uses: actions/upload-artifact@v4 + if: always() # Upload even if tests fail + with: + name: vi-analyzer-report + path: vi-analyzer-report.htm + retention-days: 7 \ No newline at end of file diff --git a/Testing/Subfolder/test2.vi b/Testing/Subfolder/test2.vi new file mode 100644 index 0000000..2e2ca85 Binary files /dev/null and b/Testing/Subfolder/test2.vi differ diff --git a/Testing/test1.vi b/Testing/test1.vi new file mode 100644 index 0000000..0950c90 Binary files /dev/null and b/Testing/test1.vi differ