Skip to content

Commit c1075f1

Browse files
authored
Improve macOS app test script reliability and error handling (#885)
* Improve macOS app test script reliability and error handling * Update actions/setup-python to v5 to resolve deprecation warnings
1 parent 99bbe0e commit c1075f1

File tree

3 files changed

+25
-37
lines changed

3 files changed

+25
-37
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
repository: ${{ env.REPO }}
3131

3232
- name: Set up Python
33-
uses: actions/setup-python@v3
33+
uses: actions/setup-python@v5
3434
with:
3535
python-version: '3.10'
3636

.github/workflows/release-and-publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
fetch-depth: 0
3636
- name: Set up Python
37-
uses: actions/setup-python@v4
37+
uses: actions/setup-python@v5
3838
with:
3939
python-version: '3.10'
4040
- name: Install dependencies
@@ -73,7 +73,7 @@ jobs:
7373
with:
7474
fetch-depth: 0
7575
- name: Set up Python
76-
uses: actions/setup-python@v4
76+
uses: actions/setup-python@v5
7777
with:
7878
python-version: '3.10'
7979
- name: Set up Node.js
@@ -184,7 +184,7 @@ jobs:
184184
fetch-depth: 0
185185
token: ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication
186186
- name: Set up Python
187-
uses: actions/setup-python@v4
187+
uses: actions/setup-python@v5
188188
with:
189189
python-version: '3.10'
190190
- name: Install the latest version of the project
@@ -235,7 +235,7 @@ jobs:
235235
with:
236236
ref: main
237237
- name: Set up Python
238-
uses: actions/setup-python@v4
238+
uses: actions/setup-python@v5
239239
with:
240240
python-version: '3.10'
241241
- name: Publish to PyPI

build_scripts/test_app_run_macos.sh

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,41 @@
11
#!/bin/bash
22

3-
# unzip the app
4-
3+
# Unzip the app
54
ZIPFILE_PATH="$(pwd)/dist/OpenAdapt.app.zip"
65
unzip -o "$ZIPFILE_PATH" -d "$(pwd)/dist"
76

8-
APP_PATH="$(pwd)/dist/OpenAdapt.app/Contents/MacOS/OpenAdapt.app"
9-
10-
# print current directory
7+
# Current directory for reference
118
echo "Current directory: $(pwd)"
12-
echo "App path: $APP_PATH"
13-
14-
# Run the app
15-
open "$APP_PATH"
169

17-
# Allow some time for the application to launch
18-
sleep 30
10+
# Path to the app
11+
APP_PATH="$(pwd)/dist/OpenAdapt.app"
12+
EXECUTABLE_PATH="$APP_PATH/Contents/MacOS/OpenAdapt"
13+
echo "App path: $APP_PATH"
14+
echo "Executable path: $EXECUTABLE_PATH"
1915

20-
# Verify that the executable exists
21-
if [ -z "$APP_PATH" ]; then
22-
echo "Error: Could not find executable in $APP_PATH"
16+
# Verify app exists
17+
if [ ! -d "$APP_PATH" ]; then
18+
echo "Error: Could not find app at $APP_PATH"
2319
exit 1
2420
fi
2521

26-
# Get the process IDs
27-
PIDS=$(pgrep -f "$APP_PATH")
28-
29-
# Verify that the process IDs were found
30-
if [ -z "$PIDS" ]; then
31-
echo "Error: Could not find process IDs for $APP_PATH"
22+
if [ ! -f "$EXECUTABLE_PATH" ]; then
23+
echo "Error: Could not find executable at $EXECUTABLE_PATH"
3224
exit 1
3325
fi
3426

35-
# Variable to track if any process is still running
36-
ALL_PROCESSES_RUNNING=true
27+
# Run the app
28+
open "$APP_PATH"
3729

38-
# Check if the processes are still running
39-
for PID in $PIDS; do
40-
if ! ps -p $PID > /dev/null; then
41-
echo "Process $PID is not running"
42-
ALL_PROCESSES_RUNNING=false
43-
break
44-
fi
45-
done
30+
# Wait for app to start
31+
sleep 30
4632

47-
# Set the exit code variable based on the processes' status
48-
if [ "$ALL_PROCESSES_RUNNING" = true ]; then
33+
# Check for running process - try both the app name and binary name
34+
if pgrep -f "OpenAdapt" > /dev/null || pgrep -f "OpenAdapt.app" > /dev/null; then
35+
echo "Process is running"
4936
EXIT_CODE=0
5037
else
38+
echo "Error: Could not find process IDs for OpenAdapt"
5139
EXIT_CODE=1
5240
fi
5341

0 commit comments

Comments
 (0)