-
Notifications
You must be signed in to change notification settings - Fork 18
215 lines (176 loc) · 6.76 KB
/
ci.yml
File metadata and controls
215 lines (176 loc) · 6.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: CI Pipeline
run-name: "CI ${{ github.sha }} (#${{ github.run_id }}.${{ github.run_attempt }})"
env:
LABVIEW_IMAGE: nationalinstruments/labview:latest-windows
concurrency:
group: ci-pipeline-${{ github.repository }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
pull_request:
branches:
- main
- develop
- release/*
- feature/*
- hotfix/*
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- main
- develop
- release/*
- hotfix/*
- feature/*
workflow_dispatch:
jobs:
via-tests:
name: Run VI Analyzer tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Run VI Analyzer tests
uses: ni/open-source/via-lv-docker@actions
with:
config_path: ${{ github.event_name == 'workflow_dispatch' && '.github/via_config/Actor_Framework.viancfg' || '' }}
base_branch: origin/${{ github.event.pull_request.base.ref || 'develop' }}
labview_version: 'latest-linux'
- name: Upload VI Analyzer Report
uses: actions/upload-artifact@v6
if: always()
with:
name: vi-analyzer-report
path: vi-analyzer-report.htm
retention-days: 7
create-artifact:
name: Create distribution artifact
needs: via-tests
uses: ./.github/workflows/create-distribution-artifact.yml
with:
upload-artifact: true
install-into-labview:
name: Mass Compile Actor Framework VIs
needs: create-artifact
runs-on: windows-latest
steps:
- name: Download distribution artifact
uses: actions/download-artifact@v7
with:
name: actor-framework-distribution
path: distribution
- name: Show downloaded artifact contents
shell: pwsh
run: |
Get-ChildItem -Path "${{ github.workspace }}\distribution" -Recurse
- name: Pull LabVIEW container image
shell: pwsh
run: |
docker pull $env:LABVIEW_IMAGE
- name: Resolve LabVIEW image metadata
shell: pwsh
run: |
$imageEnv = docker image inspect --format '{{json .Config.Env}}' $env:LABVIEW_IMAGE | ConvertFrom-Json
$lvYearEntry = $imageEnv | Where-Object { $_ -like 'LV_YEAR=*' } | Select-Object -First 1
if (-not $lvYearEntry) {
throw "LV_YEAR was not found in image metadata for $env:LABVIEW_IMAGE"
}
$lvYear = $lvYearEntry.Substring("LV_YEAR=".Length)
$containerName = "af-lv$lvYear"
"LV_YEAR=$lvYear" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"AF_CONTAINER_NAME=$containerName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "Resolved LV_YEAR=$lvYear"
Write-Host "Resolved AF_CONTAINER_NAME=$containerName"
- name: Create and start container
shell: pwsh
run: |
docker create --name $env:AF_CONTAINER_NAME `
$env:LABVIEW_IMAGE `
powershell -NoLogo -NoProfile -Command "Start-Sleep -Seconds 3600"
docker start $env:AF_CONTAINER_NAME
- name: Copy distribution into container
shell: pwsh
run: |
docker cp "${{ github.workspace }}\distribution" "$($env:AF_CONTAINER_NAME):C:\staging"
- name: Overlay files into LabVIEW directory and mass compile
shell: pwsh
run: |
$script = @'
$lvRoot = "C:\Program Files\National Instruments\LabVIEW $env:LV_YEAR"
$labviewCli = "C:\Program Files (x86)\National Instruments\Shared\LabVIEW CLI\LabVIEWCLI.exe"
$stagingRoot = "C:\staging"
$logRoot = "C:\mass-compile-logs"
$overlayFolders = @("menus", "vi.lib", "resource")
# Only these folders will be mass compiled
$compileTargets = @(
"vi.lib\ActorFramework"
)
if (-not (Test-Path $lvRoot)) {
throw "LabVIEW root not found at: $lvRoot"
}
if (-not (Test-Path $labviewCli)) {
throw "LabVIEWCLI not found at: $labviewCli"
}
New-Item -ItemType Directory -Path $logRoot -Force | Out-Null
foreach ($folder in $overlayFolders) {
$source = Join-Path $stagingRoot $folder
$destination = Join-Path $lvRoot $folder
if (Test-Path $source) {
Write-Host "Overlaying $source -> $destination"
New-Item -ItemType Directory -Path $destination -Force | Out-Null
Copy-Item -Path (Join-Path $source '*') -Destination $destination -Recurse -Force
}
}
# Mass compile only selected folders
foreach ($relativeTarget in $compileTargets) {
$targetPath = Join-Path $lvRoot $relativeTarget
if (-not (Test-Path $targetPath)) {
Write-Warning "Mass compile target not found, skipping: $targetPath"
continue
}
$safeName = $relativeTarget -replace '[\\/:*?""<>|]', '_'
$logFile = Join-Path $logRoot "$safeName-masscompile.log"
Write-Host "Mass compiling $targetPath"
& $labviewCli `
-OperationName MassCompile `
-DirectoryToCompile $targetPath `
-MassCompileLogFile $logFile `
-Headless
if ($LASTEXITCODE -ne 0) {
throw "Mass compile failed for $targetPath with exit code $LASTEXITCODE"
}
}
'@
$tempScript = Join-Path $env:RUNNER_TEMP "copy-and-masscompile.ps1"
Set-Content -Path $tempScript -Value $script
docker cp $tempScript "$($env:AF_CONTAINER_NAME):C:\copy-and-masscompile.ps1"
if ($LASTEXITCODE -ne 0) {
throw "Failed to copy script into container"
}
docker exec `
-e LV_YEAR="$env:LV_YEAR" `
$env:AF_CONTAINER_NAME `
powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File C:\copy-and-masscompile.ps1
- name: Copy mass compile logs from container
if: always()
shell: pwsh
run: |
New-Item -ItemType Directory -Path "${{ github.workspace }}\mass-compile-logs" -Force | Out-Null
docker cp "$($env:AF_CONTAINER_NAME):C:\mass-compile-logs" "${{ github.workspace }}\mass-compile-logs"
- name: Upload mass compile logs
if: always()
uses: actions/upload-artifact@v6
with:
name: mass-compile-logs
path: mass-compile-logs
retention-days: 7
- name: Cleanup container
if: always()
shell: pwsh
run: |
docker rm -f $env:AF_CONTAINER_NAME