From dd34621025ae678841bedcde01e029e057059da8 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 11 Dec 2024 02:24:04 +0100 Subject: [PATCH] Add opencv test. --- .github/workflows/test-windows.yml | 133 +++++++++++++++++++++++++++++ test/opencv/opencv.py | 3 + test/opencv/requirements.txt | 2 + 3 files changed, 138 insertions(+) create mode 100644 test/opencv/opencv.py create mode 100644 test/opencv/requirements.txt diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 552c56b..12f9571 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -41,6 +41,29 @@ jobs: metacall faas --version | findstr /R "^v.*\..*\..*" IF %ERRORLEVEL% NEQ 0 exit /B 1 + - name: Uninstall MetaCall + shell: cmd + env: + METACALL_INSTALL_DEBUG: 1 + run: | + powershell -NoProfile -ExecutionPolicy unrestricted ./install.ps1 -Uninstall + + - name: Uninstall Test + shell: pwsh + run: | + $MetaCallPath = "$env:LocalAppData\MetaCall" + Write-Output "Checking MetaCall installation directory: $MetaCallPath" + If (Test-Path $MetaCallPath) { + Write-Error "MetaCall installation directory still exists" + exit 1 + } + $MetaCallBinary = (Get-Command metacall -ErrorAction SilentlyContinue) + If ($MetaCallBinary) { + Write-Error "MetaCall binary is still available" + exit 2 + } + Write-Output "Uninstall verification passed." + install-from-path: name: Install MetaCall via Path Installation runs-on: windows-latest @@ -84,6 +107,29 @@ jobs: metacall faas --version | findstr /R "^v.*\..*\..*" IF %ERRORLEVEL% NEQ 0 exit /B 1 + - name: Uninstall MetaCall + shell: cmd + env: + METACALL_INSTALL_DEBUG: 1 + run: | + powershell -NoProfile -ExecutionPolicy unrestricted ./install.ps1 -Uninstall + + - name: Uninstall Test + shell: pwsh + run: | + $MetaCallPath = "$env:LocalAppData\MetaCall" + Write-Output "Checking MetaCall installation directory: $MetaCallPath" + If (Test-Path $MetaCallPath) { + Write-Error "MetaCall installation directory still exists" + exit 1 + } + $MetaCallBinary = (Get-Command metacall -ErrorAction SilentlyContinue) + If ($MetaCallBinary) { + Write-Error "MetaCall binary is still available" + exit 2 + } + Write-Output "Uninstall verification passed." + install-path-with-whitespaces: name: Install MetaCall via Path With Whitespaces runs-on: windows-latest @@ -127,3 +173,90 @@ jobs: IF %ERRORLEVEL% NEQ 0 exit /B 1 metacall faas --version | findstr /R "^v.*\..*\..*" IF %ERRORLEVEL% NEQ 0 exit /B 1 + + - name: Uninstall MetaCall + shell: cmd + env: + METACALL_INSTALL_DEBUG: 1 + run: | + powershell -NoProfile -ExecutionPolicy unrestricted ./install.ps1 -Uninstall -InstallDir '%cd%\install folder with spaces' + + - name: Uninstall Test + shell: pwsh + run: | + $MetaCallPath = Join-Path (Get-Location) "install folder with spaces" + Write-Output "Checking MetaCall installation directory: $MetaCallPath" + If (Test-Path $MetaCallPath) { + Write-Error "MetaCall installation directory still exists" + exit 1 + } + $MetaCallBinary = (Get-Command metacall -ErrorAction SilentlyContinue) + If ($MetaCallBinary) { + Write-Error "MetaCall binary is still available" + exit 2 + } + Write-Output "Uninstall verification passed." + + install-version-opencv: + name: Install MetaCall with Specific Version + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Install MetaCall + powershell -NoProfile -ExecutionPolicy unrestricted ./install.ps1 -Version 0.1.7 + + - name: NodeJS Test + shell: cmd + run: | + metacall ./test/script.js | findstr "123456" + IF %ERRORLEVEL% NEQ 0 exit /B 1 + + - name: Python Test + shell: cmd + run: | + metacall pip install -r test/requirements.txt | findstr "Successfully installed" + IF %ERRORLEVEL% NEQ 0 exit /B 1 + metacall ./test/requirements.py | findstr "123456" + IF %ERRORLEVEL% NEQ 0 exit /B 1 + + - name: Python OpenCV Test + shell: cmd + run: | + metacall pip install -r test/opencv/requirements.txt +# | findstr "Successfully installed" +# IF %ERRORLEVEL% NEQ 0 exit /B 1 + metacall ./test/opencv/opencv.py +# | findstr "123456" +# IF %ERRORLEVEL% NEQ 0 exit /B 1 + + - name: Deploy & FaaS Test + shell: cmd + run: | + metacall deploy --version | findstr /R "^v.*\..*\..*" + IF %ERRORLEVEL% NEQ 0 exit /B 1 + metacall faas --version | findstr /R "^v.*\..*\..*" + IF %ERRORLEVEL% NEQ 0 exit /B 1 + + + - name: Uninstall MetaCall + shell: cmd + env: + METACALL_INSTALL_DEBUG: 1 + run: | + powershell -NoProfile -ExecutionPolicy unrestricted ./install.ps1 -Uninstall + + - name: Uninstall Test + shell: pwsh + run: | + $MetaCallPath = "$env:LocalAppData\MetaCall" + Write-Output "Checking MetaCall installation directory: $MetaCallPath" + If (Test-Path $MetaCallPath) { + Write-Error "MetaCall installation directory still exists" + exit 1 + } + $MetaCallBinary = (Get-Command metacall -ErrorAction SilentlyContinue) + If ($MetaCallBinary) { + Write-Error "MetaCall binary is still available" + exit 2 + } + Write-Output "Uninstall verification passed." diff --git a/test/opencv/opencv.py b/test/opencv/opencv.py new file mode 100644 index 0000000..bf75d7d --- /dev/null +++ b/test/opencv/opencv.py @@ -0,0 +1,3 @@ +import cv2 +print(cv2.__version__) +print('123456') diff --git a/test/opencv/requirements.txt b/test/opencv/requirements.txt new file mode 100644 index 0000000..25cfaf2 --- /dev/null +++ b/test/opencv/requirements.txt @@ -0,0 +1,2 @@ +opencv-contrib-python-headless==3.3.0.9 +numpy==1.21.6