Skip to content

Commit 1c7eff0

Browse files
authored
Improve VIDiff: Detect binary files, Add logic for added/deleted VIs (#49)
1 parent 5c4fd56 commit 1c7eff0

20 files changed

Lines changed: 340 additions & 60 deletions

.github/workflows/mirror-to-gitlab.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
mirror-to-gitlab:
10+
if: github.repository == 'ni/labview-for-containers'
1011
runs-on: ubuntu-latest
1112
steps:
1213
- name: Checkout repository

.github/workflows/run-vi-analyzer-linux-container.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ jobs:
2626
-v "${{ github.workspace }}:/workspace" \
2727
nationalinstruments/labview:latest-linux \
2828
bash -c "cd /workspace/examples/cicd-examples/helper-scripts/run-vi-analyzer && chmod +x run-vi-analyzer.sh && ./run-vi-analyzer.sh"
29+
30+
- name: Upload VI Analyzer report
31+
if: always()
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: vi-analyzer-report-linux
35+
path: ${{ github.workspace }}/examples/cicd-examples/Test-VIs/via-results-temp/

.github/workflows/run-vi-analyzer-windows-container.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ jobs:
2626
-v "${{ github.workspace }}:C:\workspace"
2727
nationalinstruments/labview:latest-windows
2828
powershell -File "C:\workspace\examples\cicd-examples\helper-scripts\run-vi-analyzer\run-vi-analyzer.ps1" -WorkspaceRoot "C:\workspace"
29+
30+
- name: Upload VI Analyzer report
31+
if: always()
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: vi-analyzer-report-windows
35+
path: ${{ github.workspace }}\examples\cicd-examples\Test-VIs\via-results-temp\

.github/workflows/vidiff-linux-container.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
id: changed-vis
3434
run: |
3535
cd pr
36-
CHANGED_VIS=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- '*.vi' || true)
36+
CHANGED_VIS=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }} ${{ github.sha }} || true)
3737
if [ -z "$CHANGED_VIS" ]; then
38-
echo "No .vi files changed."
38+
echo "No changed files detected."
3939
echo "has_changes=false" >> "$GITHUB_OUTPUT"
4040
else
4141
echo "Changed VI files:"
@@ -78,7 +78,6 @@ jobs:
7878
mkdir -p metadata
7979
echo "${{ github.event.pull_request.number }}" > metadata/pr_number
8080
echo "linux" > metadata/platform
81-
echo "${{ steps.changed-vis.outputs.vi_files }}" > metadata/vi_files
8281
8382
- name: Upload metadata
8483
if: steps.changed-vis.outputs.has_changes == 'true'

.github/workflows/vidiff-windows-container.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
shell: bash
3535
run: |
3636
cd pr
37-
CHANGED_VIS=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- '*.vi' || true)
37+
CHANGED_VIS=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }} ${{ github.sha }} || true)
3838
if [ -z "$CHANGED_VIS" ]; then
39-
echo "No .vi files changed."
39+
echo "No changed files detected."
4040
echo "has_changes=false" >> "$GITHUB_OUTPUT"
4141
else
4242
echo "Changed VI files:"
@@ -81,7 +81,6 @@ jobs:
8181
mkdir -p metadata
8282
echo "${{ github.event.pull_request.number }}" > metadata/pr_number
8383
echo "windows" > metadata/platform
84-
echo "${{ steps.changed-vis.outputs.vi_files }}" > metadata/vi_files
8584
8685
- name: Upload metadata
8786
if: steps.changed-vis.outputs.has_changes == 'true'
-744 Bytes
Binary file not shown.

examples/cicd-examples/helper-scripts/run-vi-analyzer/run-vi-analyzer.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ if (Test-Path -Path $ReportPath) {
5656

5757
Write-Host "Number of failed tests: $failedCount"
5858

59+
# Copy report to workspace for artifact upload
60+
$resultsDir = Join-Path $WorkspaceRoot "examples\cicd-examples\Test-VIs\via-results-temp"
61+
if (-not (Test-Path -Path $resultsDir)) {
62+
New-Item -ItemType Directory -Path $resultsDir -Force | Out-Null
63+
}
64+
if (Test-Path -Path $ReportPath) {
65+
Copy-Item -Path $ReportPath -Destination (Join-Path $resultsDir "Results.txt") -Force
66+
}
67+
5968
if ($failedCount -gt 0) {
6069
Write-Host "Some tests failed. Exiting with error." -ForegroundColor Red
6170
Write-Host "########################################################################################"

examples/cicd-examples/helper-scripts/run-vi-analyzer/run-vi-analyzer.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ echo "ReportPath: $REPORT_PATH"
1818
echo " "
1919

2020
# Run the LabVIEWCLI VIA command.
21+
CLI_EXIT=0
2122
LabVIEWCLI -LogToConsole TRUE \
2223
-OperationName RunVIAnalyzer \
2324
-ConfigPath $CONFIG_FILE \
2425
-ReportPath $REPORT_PATH \
2526
-LabVIEWPath $LABVIEW_PATH \
26-
-Headless
27+
-Headless || CLI_EXIT=$?
2728

2829
echo "Done running of VI Analyzer Tests"
2930
echo "Printing Results..."
@@ -47,6 +48,11 @@ fi
4748

4849
echo "Number of failed tests: $FAILED_COUNT"
4950

51+
# Copy report to workspace for artifact upload
52+
RESULTS_DIR='/workspace/examples/cicd-examples/Test-VIs/via-results-temp'
53+
mkdir -p "$RESULTS_DIR"
54+
cp "$REPORT_PATH" "$RESULTS_DIR/Results.txt" 2>/dev/null || true
55+
5056
# 4) Exit based on count
5157
if (( FAILED_COUNT > 0 )); then
5258
echo "✖ Some tests failed. Exiting with error."
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)