Cicd/update for v24.08.00 #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Windows Config and test installation with script | |
# This workflow generate and copy | |
# 1. config_Windows.json based on the current latest config & release tag | |
# 2. installer.ps1 | |
# to artifact | |
# | |
# Then test installation with combination of | |
# [latest release, config_Windows.json] | |
# [MSVC 2019 and 2022] | |
# [with/without OpenCV] | |
# | |
# Note that MSVC 2022 (17.10 or later in the future) cannot find OpenCV 4.5.5 | |
# So install OpenCV 4.10.0 for MSVC 2022 | |
# Reference: https://github.com/Sensing-Dev/sensing-dev-installer/pull/111 | |
# | |
# For Aravis, we did not add the Python test yet | |
# TODO: after separate C++ and Python installation of Aravis, setup test | |
on: | |
pull_request: | |
branches: | |
- main | |
### modify here for update ##################################################### | |
env: | |
TEST_CONFIG_VERSION_SDK: v99.99.99 | |
LATEST_RELEASED_SDK: v24.05.06 | |
LATEST_OPENCV_VERSION: 4.10.0 | |
LATEST_OPENCV_BIN_PATH: opencv/build/x64/vc16/bin | |
################################################################################ | |
jobs: | |
set_env: | |
runs-on: windows-latest | |
outputs: | |
LATEST_RELEASED_SDK: ${{ steps.set-vars.outputs.LATEST_RELEASED_SDK }} | |
LATEST_OPENCV_VERSION: ${{ steps.set-vars.outputs.LATEST_OPENCV_VERSION }} | |
LATEST_OPENCV_BIN_PATH: ${{ steps.set-vars.outputs.LATEST_OPENCV_BIN_PATH }} | |
steps: | |
- name: Set environment variables | |
id: set-vars | |
run: | | |
echo "LATEST_RELEASED_SDK=${{ env.LATEST_RELEASED_SDK}}" >> $env:GITHUB_OUTPUT | |
echo "LATEST_OPENCV_VERSION=${{ env.LATEST_OPENCV_VERSION}}" >> $env:GITHUB_OUTPUT | |
echo "LATEST_OPENCV_BIN_PATH=${{ env.LATEST_OPENCV_BIN_PATH}}" >> $env:GITHUB_OUTPUT | |
generate_config: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11.4" | |
- name: Create config for Windows | |
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 -v ${{ env.TEST_CONFIG_VERSION_SDK}} | |
- 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/testcases | |
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_RELEASED_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') && (matrix.install_option == '-version v24.05.06'))}} | |
run: | | |
cd ${{ github.workspace }}/test | |
powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 ${{ matrix.install_option }} ${{ matrix.with_openCV }} -verbose | |
- name: Install with the script from Artifacts (with the latest MSVC with Sensing-Dev v24.05.06 or earlier) | |
if: ${{(matrix.os == 'windows-latest') && (matrix.with_openCV == '-InstallOpenCV') && (matrix.install_option == '-version v24.05.06')}} | |
run: | | |
cd ${{ github.workspace }}/test | |
powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 ${{ matrix.install_option }} -verbose | |
$targetDir= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User") | |
Invoke-WebRequest -Uri https://github.com/opencv/opencv/releases/download/${{ needs.set_env.outputs.LATEST_OPENCV_VERSION }}/opencv-${{ needs.set_env.outputs.LATEST_OPENCV_VERSION }}-windows.exe -OutFile opencv-${{ needs.set_env.outputs.LATEST_OPENCV_VERSION }}-windows.exe | |
Start-Process -FilePath opencv-${{ needs.set_env.outputs.LATEST_OPENCV_VERSION }}-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" | |
} else { | |
Write-Output "File does not exist: $filePath" | |
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 | |
- 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 | |
- name: Test opencv (general) | |
if: ${{ !((matrix.os == 'windows-latest') && (matrix.install_option == '-version v24.05.06')) && (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 | |
- name: Test opencv (with the latest MSVC with OpenCV) | |
if: ${{(matrix.os == 'windows-latest') && (matrix.with_openCV == '-InstallOpenCV') && (matrix.install_option == '-version v24.05.06')}} | |
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" | |
$OpenCVBin = Join-Path -Path $SENSING_DEV_ROOT -ChildPath ${{ needs.set_env.outputs.LATEST_OPENCV_BIN_PATH }} | |
$env:PATH="$env:PATH;$OpenCVBin" | |
cd ${{ github.workspace }}/download/installer/testcases/cpp/opencv_test && cmake ./ | |
cmake --build . --config Release | |
cd Release && ./opencv_test | |
test_python: | |
runs-on: ${{ matrix.os }} | |
needs: [set_env, generate_config] | |
strategy: | |
matrix: | |
os: [windows-2019, windows-latest] | |
python_version: ["3.10", "3.11"] | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: install-test-for-windows | |
path: download | |
- name: Get config content and install python modules | |
run: | | |
$comp_info = Get-Content -Path ${{ github.workspace }}/download/build/config_Windows.json -Raw | ConvertFrom-Json | |
$ionkit_version = $comp_info.ion_kit.version | |
$gendc_separator_version = $comp_info.gendc_separator.version | |
if ( $ionkit_version.StartsWith("v") ){ | |
$ionkit_version = $ionkit_version.substring(1) | |
} | |
if ( $gendc_separator_version.StartsWith("v") ){ | |
$gendc_separator_version = $gendc_separator_version.substring(1) | |
} | |
pip install ion-python==$ionkit_version | |
pip install gendc-python==$gendc_separator_version | |
pip install numpy | |
pip install opencv-python | |
# - name: Test Aravis | |
# run: | | |
# cd ${{ github.workspace }}/download/installer/testcases/python | |
# python aravis_test.py | |
- name: Test ion-kit | |
run: | | |
cd ${{ github.workspace }}/download/installer/testcases/python | |
python ionkit_test.py | |
- name: Test OpenCV | |
run: | | |
cd ${{ github.workspace }}/download/installer/testcases/python | |
python opencv_test.py | |