-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add CI scripts to run the app after build (#709)
* feat: Add scripts to run the app after build * feat: Log error in a file * chore: Add TODO for future additions of logging --------- Co-authored-by: Richard Abrich <[email protected]>
- Loading branch information
Showing
4 changed files
with
186 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
# unzip the app | ||
|
||
ZIPFILE_PATH="$(pwd)/dist/OpenAdapt.app.zip" | ||
unzip -o "$ZIPFILE_PATH" -d "$(pwd)/dist" | ||
|
||
APP_PATH="$(pwd)/dist/OpenAdapt.app/Contents/MacOS/OpenAdapt.app" | ||
|
||
# print current directory | ||
echo "Current directory: $(pwd)" | ||
echo "App path: $APP_PATH" | ||
|
||
# Run the app | ||
open "$APP_PATH" | ||
|
||
# Allow some time for the application to launch | ||
sleep 30 | ||
|
||
# Verify that the executable exists | ||
if [ -z "$APP_PATH" ]; then | ||
echo "Error: Could not find executable in $APP_PATH" | ||
exit 1 | ||
fi | ||
|
||
# Get the process IDs | ||
PIDS=$(pgrep -f "$APP_PATH") | ||
|
||
# Verify that the process IDs were found | ||
if [ -z "$PIDS" ]; then | ||
echo "Error: Could not find process IDs for $APP_PATH" | ||
exit 1 | ||
fi | ||
|
||
# Variable to track if any process is still running | ||
ALL_PROCESSES_RUNNING=true | ||
|
||
# Check if the processes are still running | ||
for PID in $PIDS; do | ||
if ! ps -p $PID > /dev/null; then | ||
echo "Process $PID is not running" | ||
ALL_PROCESSES_RUNNING=false | ||
break | ||
fi | ||
done | ||
|
||
# Set the exit code variable based on the processes' status | ||
if [ "$ALL_PROCESSES_RUNNING" = true ]; then | ||
EXIT_CODE=0 | ||
else | ||
EXIT_CODE=1 | ||
fi | ||
|
||
echo "Exit code: $EXIT_CODE" | ||
exit $EXIT_CODE |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@echo off | ||
|
||
REM Unzip the distribution | ||
set "ZIP_PATH=%cd%\dist\OpenAdapt.zip" | ||
7z x %ZIP_PATH% -o%cd%\dist | ||
|
||
REM Path to the .exe file | ||
set "APP_PATH=%cd%\dist\OpenAdapt\OpenAdapt.exe" | ||
|
||
REM Run the app | ||
start %APP_PATH% | ||
|
||
REM Allow some time for the application to launch | ||
ping -n 30 127.0.0.1 >nul | ||
|
||
REM Verify that the executable exists | ||
if not exist "%APP_PATH%" ( | ||
echo Error: Could not find executable in %APP_PATH% | ||
exit /b 1 | ||
) | ||
|
||
REM Get the process IDs | ||
for /f "tokens=2" %%i in ('tasklist /fi "imagename eq OpenAdapt.exe" /nh') do ( | ||
set "PID=%%i" | ||
) | ||
|
||
REM Verify that the process ID was found | ||
if not defined PID ( | ||
echo Error: Could not find process IDs for %APP_PATH% | ||
exit /b 1 | ||
) | ||
|
||
REM Variable to track if any process is still running | ||
set "ALL_PROCESSES_RUNNING=true" | ||
|
||
REM Check if the processes are still running | ||
tasklist /fi "pid eq %PID%" /nh | find /i "OpenAdapt.exe" >nul | ||
if errorlevel 1 ( | ||
echo Process %PID% is not running | ||
set "ALL_PROCESSES_RUNNING=false" | ||
) | ||
|
||
REM Set the exit code variable based on the processes' status | ||
if "%ALL_PROCESSES_RUNNING%"=="true" ( | ||
set "EXIT_CODE=0" | ||
) else ( | ||
set "EXIT_CODE=1" | ||
) | ||
|
||
echo Exit code: %EXIT_CODE% | ||
exit /b %EXIT_CODE% |
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