Skip to content

Commit

Permalink
WIP: release test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fixstars-momoko committed Jul 18, 2024
1 parent dd4d184 commit 55b72c1
Showing 1 changed file with 13 additions and 334 deletions.
347 changes: 13 additions & 334 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,352 +6,31 @@ on:
- "v*.*.*" # vYY.MM.Patch example v23.08.00 etc.

jobs:
generate-version-info:
runs-on: ubuntu-latest
generate_config:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install PyYAML
run: pip install pyyaml

- name: Sensing-Dev version info
run: |
mkdir build && cd build
echo "{" > version_info.json
echo "\"Sensing-Dev\" : \"${GITHUB_REF#refs/tags/}\"" >> version_info.json
echo "}" >> version_info.json
- name: Add component version info
run: |
python ${GITHUB_WORKSPACE}/installer/scripts/get_component_version.py ${GITHUB_WORKSPACE}/installer/config.yml ${GITHUB_WORKSPACE}/build/version_info.json
- name: Upload version_info.json
uses: actions/upload-artifact@v2
with:
name: version_info.json
path: build/version_info.json

- name: Release version_info.json
uses: softprops/action-gh-release@v1
with:
files: |
build/version_info.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}



uses: actions/[email protected]


release-windows:
needs: [generate-version-info]
runs-on: windows-latest

steps:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.11.4"

- name: Install Conan and PyYAML via pip
run: |
python -m pip install conan
python -m pip install PyYAML
- name: Disable Perl (remove from PATH)
run: choco uninstall strawberryperl -n

- name: Install WiX Toolset
run: choco install wixtoolset -y

- name: Checkout repository
uses: actions/[email protected]
uses: actions/setup-python@v5
with:
submodules: recursive
python-version: "3.11.4"

- name: Create and enter build directory
- name: Create config for Linux
run: |
cd installer
mkdir build
cd build
- name: Run CMake
working-directory: installer/build
run: cmake -G "Visual Studio 17 2022" -A x64 ../

- name: Build
working-directory: installer/build
run: cmake --build . --config Release

- name: Generate liscence files
working-directory: installer/build
run: cmake -G "Visual Studio 17 2022" -A x64 ../

- name: Create package zip
working-directory: installer/build
run: cpack -G "ZIP"

- name: Create package without opencv
working-directory: installer/build
run: cmake -G "Visual Studio 17 2022" -A x64 ../ -DOPENCV_ACTION="use_existing"

- name: Create package zip
working-directory: installer/build
run: cpack -G "ZIP"

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
installer/tools/installer*.ps1
installer/build/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}





release-linux:
needs: [generate-version-info]
runs-on: ubuntu-latest
env:
LD_LIBRARY_PATH: /opt/sensing-dev/lib:/opt/sensing-dev/lib/x86_64-linux-gnu

steps:
- name: Checkout repository
uses: actions/[email protected]
with:
submodules: recursive

- name: Make the script files executable
run: |
chmod +x ${GITHUB_WORKSPACE}/installer/tools/setup.sh
- name: Run the script to install
run: |
sudo bash ${GITHUB_WORKSPACE}/installer/tools/setup.sh --develop-test
- name: Check if /opt/sensing-dev exists
id: check_files
uses: andstor/file-existence-action@v3
with:
files: /opt/sensing-dev
fail: true

- name: Test Environment variable for Aravis
run: |
/opt/sensing-dev/bin/arv-tool-0.8
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 -v ${{ github.ref_name }}
# Todo: adding the test to check OpenCV, ion-kit, Aravis, GOjbect
- name: Release
- name: Release version_info.json
uses: softprops/action-gh-release@v1
with:
files: |
installer/tools/setup.sh
${{ github.workspace }}/build/
${{ github.workspace }}/installer/tools
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}





test-installer-ps1-zip:
needs: [release-windows]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, windows-2022]
options: [ "-user $env:USERNAME -InstallOpenCV", "-user $env:USERNAME"]
version: ['current']
exclude:
- version: "v23.11.01"
options: "-user $env:USERNAME -InstallOpenCV"

env:
INSTALL_PATH: "$env:LOCALAPPDATA"
SDK_NAME : "sensing-dev"
VERSION : ${{ matrix.version == 'current' && github.ref_name || matrix.version}}

steps:
- name: Checkout repository
uses: actions/[email protected]
with:
submodules: recursive
- name: Create and enter build directory
run: |
mkdir build
cd build
- name: Download installer
working-directory: build
run: |
$url = "https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/installer.ps1"
# $url = "https://github.com/Sensing-Dev/sensing-dev-installer/releases/download/${{ env.VERSION }}/installer.ps1"
Invoke-WebRequest $url -OutFile .\installer.ps1
- name: Test help
working-directory: build
run: |
Get-Help .\installer.ps1 -full
- name: Check if installation exists
working-directory: build
run: |
try {
Get-Package sensing-dev
Write-Error "Package exists"
}
catch {
Write-Host $_
}
- name: Installation using ZIP
working-directory: build
run: |
Write-Host "USERNAME = $env:USERNAME"
powershell.exe -ExecutionPolicy Bypass -File .\installer.ps1 -version ${{ env.VERSION }} ${{ matrix.options }}
- name: Test Env installation ZIP
working-directory: build
run: |
$expected_install_path = Join-Path -Path "${{ env.INSTALL_PATH }}" -ChildPath "${{ env.SDK_NAME }}"
Write-Host "expected_install_path : $expected_install_path"
$GST_PLUGIN_PATH = [Environment]::GetEnvironmentVariable("GST_PLUGIN_PATH", "User")
Write-Host GST_PLUGIN_PATH = $GST_PLUGIN_PATH
if(${expected_install_path} -eq ${GST_PLUGIN_PATH}){
$env:GST_PLUGIN_PATH=${GST_PLUGIN_PATH}
}
else {
Write-Error "env:GST_PLUGIN_PATH required environment variable are not set"
}
$SENSING_DEV_ROOT= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
Write-Host SENSING_DEV_ROOT = $SENSING_DEV_ROOT
if(${expected_install_path} -eq ${SENSING_DEV_ROOT}){
$env:SENSING_DEV_ROOT=${SENSING_DEV_ROOT}
}
else {
Write-Error "env:SENSING_DEV_ROOT required environment variable are not set"
}
$PATH = [Environment]::GetEnvironmentVariable("PATH", "User")
Write-Host PATH = $PATH
$BinPATH = Join-Path -Path "$expected_install_path" -ChildPath "bin"
if($PATH -split ";" -contains $BinPATH)
{
$env:PATH="$env:PATH;$PATH"
}
else {
Write-Error "env:PATH Does not contain '$BinPATH'"
}
$PYTHONPATH= [Environment]::GetEnvironmentVariable("PYTHONPATH", "User")
Write-Host PYTHONPATH = $PYTHONPATH
- name: Test files installation ZIP
working-directory: build
run: |
$SENSING_DEV_ROOT= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
$env:SENSING_DEV_ROOT=${SENSING_DEV_ROOT}
tree $env:SENSING_DEV_ROOT /a
echo "::group::bin"
tree $env:SENSING_DEV_ROOT/bin /f /a
echo "::endgroup::"
echo "::group::include"
tree $env:SENSING_DEV_ROOT/include /f /a
echo "::endgroup::"
echo "::group::lib"
tree $env:SENSING_DEV_ROOT/lib /f /a
echo "::endgroup::"
echo "::group::license"
tree $env:SENSING_DEV_ROOT/license /f /a
echo "::endgroup::"
echo "::group::share"
tree $env:SENSING_DEV_ROOT/share /f /a
echo "::endgroup::"
echo "::group::tools"
tree $env:SENSING_DEV_ROOT/tools /f /a
echo "::endgroup::"
- name: Test arvis
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 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 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.options == '-user $env:USERNAME -InstallOpenCV' && matrix.os == 'windows-2019'
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 installer/testcases/cpp/opencv_test && cmake ./
cmake --build . --config Release
cd Release && ./opencv_test
echo "opencv test passed"
- name: Check if version_info.json exists
run: |
$expected_install_path = Join-Path -Path "${{ env.INSTALL_PATH }}" -ChildPath "${{ env.SDK_NAME }}"
$target_file = Join-Path -Path "$expected_install_path" -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: Uninstallation
working-directory: build
run: |
$SENSING_DEV_ROOT= [Environment]::GetEnvironmentVariable("SENSING_DEV_ROOT", "User")
$env:SENSING_DEV_ROOT=${SENSING_DEV_ROOT}
Remove-Item "$env:SENSING_DEV_ROOT" -Recurse -Force
test-setup-sh:
needs: [release-linux]
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/[email protected]
with:
submodules: recursive

- name: Download installer
run: |
mkdir setup_dir && cd setup_dir
wget -O setup.sh https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/setup.sh
chmod +x ${GITHUB_WORKSPACE}/setup_dir/setup.sh
sudo bash setup.sh --install-opencv --version ${{ github.ref_name }}
- name: Check if version_info.json exists
id: check_files
uses: andstor/file-existence-action@v3
with:
files: "/opt/sensing-dev/version_info.json"
fail: true

0 comments on commit 55b72c1

Please sign in to comment.