forked from Sensing-Dev/sensing-dev-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (135 loc) · 6.33 KB
/
develop-Windows.yml
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
on:
push:
branches-ignore:
- main # This will run the build and test jobs for every push on all branches except for dev to main
pull_request:
branches:
- '*' # This will run the build and test jobs for pull requests to all branches
jobs:
set_env:
runs-on: windows-latest
env:
LATEST_RELEASED_SDK: v24.05.06
LATEST_OPENCV_VERSION: 4.10.0
outputs:
latest_sdk: ${{ steps.set-vars.outputs.latest_sdk }}
latest_opencv: ${{ steps.set-vars.outputs.latest_opencv }}
steps:
- name: Set environment variables
id: set-vars
run: |
echo "::set-output name=latest_sdk::${{ env.LATEST_RELEASED_SDK}}"
echo "::set-output name=latest_opencv::${{ env.LATEST_OPENCV_VERSION}}"
generate_config:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.11.4"
- name: Create and enter the build directory
run: |
cd installer
mkdir build && cd build
python -m pip install --upgrade pip
pip install -r ${{ github.workspace }}/installer/src/requirements.txt
python ${{ github.workspace }}/installer/src/generate_config.py -p Windows
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: install-test-for-windows
path: |
${{ github.workspace }}/build/config_Windows.json
${{ github.workspace }}/installer/tools/installer.ps1
${{ github.workspace }}/installer/test/cpp
test_installation:
runs-on: ${{ matrix.os }}
needs: [set_env, generate_config]
strategy:
matrix:
os: [windows-2019, windows-latest]
install_option : ["-version ${{ needs.set_env.outputs.latest_sdk }}", "-configPath config_Windows.json"]
with_openCV : ["", "-InstallOpenCV"]
# exclude:
# - os: windows-latest
# with_openCV: "-InstallOpenCV"
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
name: install-test-for-windows
path: download
- name: Set all items under test directory
run: |
New-Item -ItemType Directory -Path ${{ github.workspace }}/test | Out-Null
Move-Item -Path ${{ github.workspace }}/download/build/config_Windows.json -Destination ${{ github.workspace }}/test
Move-Item -Path ${{ github.workspace }}/download/installer/tools/installer.ps1 -Destination ${{ github.workspace }}/test
- name: Install with the script from Artifacts (general)
if: ${{ !((matrix.os == 'windows-latest') && (matrix.with_openCV == '-InstallOpenCV'))}}
run: |
cd ${{ github.workspace }}/test
powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 ${{ matrix.install_option }} ${{ matrix.with_openCV }}
- name: Install with the script from Artifacts (with the latest MSVC with OpenCV)
if: ${{(matrix.os == 'windows-latest') && (matrix.with_openCV == '-InstallOpenCV')}}
run: |
cd ${{ github.workspace }}/test
powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 ${{ matrix.install_option }}
$targetDir= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
Invoke-WebRequest -Uri https://github.com/opencv/opencv/releases/download/${{ needs.set_env.outputs.latest_opencv }}/opencv-${{ needs.set_env.outputs.latest_opencv }}-windows.exe -OutFile opencv-${{ needs.set_env.outputs.latest_opencv }}-windows.exe
Start-Process -FilePath opencv-${{ needs.set_env.outputs.latest_opencv }}-windows.exe -ArgumentList "-o`"$targetDir`" -y" -Wait
- name: Check if OpenCV exists on Windows
if: ${{ (matrix.with_openCV == '-InstallOpenCV') }}
id: check_opencv
run: |
$filePath = "${env:LOCALAPPDATA}\sensing-dev\opencv"
if (Test-Path $filePath) {
Write-Output "File exists: $filePath"
Write-Output "::set-output name=file_exists::true"
} else {
Write-Output "File does not exist: $filePath"
Write-Output "::set-output name=file_exists::false"
exit 1
}
- name: Check if version_info.json exists
run: |
$SENSING_DEV_ROOT= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
$target_file = Join-Path -Path "$SENSING_DEV_ROOT" -ChildPath "version_info.json"
if (Test-Path $target_file){
echo "version_info.json exists."
} else{
echo "version_info.json does not exist."
exit 1
}
- name: Test Aravis installation and Path
run: |
$PATH = [Environment]::GetEnvironmentVariable("PATH", "User")
$SENSING_DEV_ROOT= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
$env:PATH="$env:PATH;$PATH"
$env:SENSING_DEV_ROOT=${SENSING_DEV_ROOT}
cd ${{ github.workspace }}/download/installer/testcases/cpp/aravis_test && cmake ./
cmake --build . --config Release
cd Release && ls && ./aravis_test
echo "aravis test passed"
- name: Test ion-kit
run: |
$PATH = [Environment]::GetEnvironmentVariable("PATH", "User")
$SENSING_DEV_ROOT= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
$env:PATH="$env:PATH;$PATH"
$env:SENSING_DEV_ROOT=${SENSING_DEV_ROOT}
cd ${{ github.workspace }}/download/installer/testcases/cpp/ionkit_test && cmake ./
cmake --build . --config Release
cd Release && ls && ./ionkit_test
echo "ion-kit test passed"
- name: Test opencv
if: ${{ (matrix.with_openCV == '-InstallOpenCV') }}
run: |
$PATH = [Environment]::GetEnvironmentVariable("PATH", "User")
$SENSING_DEV_ROOT= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
$env:SENSING_DEV_ROOT=${SENSING_DEV_ROOT}
$env:PATH="$env:PATH;$PATH"
cd ${{ github.workspace }}/download/installer/testcases/cpp/opencv_test && cmake ./
cmake --build . --config Release
cd Release && ./opencv_test
echo "opencv test passed"