Skip to content

Commit

Permalink
Leverage open for test invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
spotlightishere committed May 16, 2024
1 parent b2b1f37 commit 1f823b9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
files: scripts/linux.sh
build-macos:
name: Build NSO-RPC - MacOS
# We cannot use arm64 macOS runners until setup-python permits specifying an architecture.
# See also: https://github.com/actions/setup-python/issues/547
runs-on: macos-12
steps:
- uses: actions/checkout@v4
Expand All @@ -69,11 +71,13 @@ jobs:
# Subsequent invocations will all use the x86_64 `python3` binary within the venv.
- name: Build
run: >
cd scripts &&
arch -x86_64 /bin/bash ./build.sh &&
cd ../client/dist &&
arch -x86_64 /bin/bash ../../scripts/tests/macos_test.sh &&
rm output.log &&
arch -x86_64 /bin/bash ./scripts/build.sh
- name: Test
run: >
arch -x86_64 /bin/bash ./scripts/tests/macos_test.sh
- name: Create Distributions
run: >
cd ./client/dist &&
ln -s /Applications "Applications (admin)" &&
hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg &&
zip -yr mac-portable.zip NSO-RPC.app/
Expand All @@ -86,22 +90,23 @@ jobs:
client/dist/mac-portable.zip
build-universal2:
name: Build NSO-RPC - Universal2
runs-on: macos-12
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.4
- name: Install Python 3.11.4 and build NSO-RPC
run: >
curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg &&
sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target / &&
sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target /
- name: Build
run: >
alias python3=python3.11 &&
cd scripts/macos-universal2 &&
bash ./build.sh &&
cd ../../client/dist &&
bash ../../scripts/tests/macos_test.sh &&
rm output.log &&
bash ./scripts/macos-universal2/build.sh
- name: Test
run: >
bash ./scripts/tests/macos_test.sh
- name: Create Distributions
run: >
cd client/dist &&
ln -s /Applications "Applications (admin)" &&
hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg &&
zip -yr mac-universal2-portable.zip NSO-RPC.app/
Expand Down
8 changes: 6 additions & 2 deletions scripts/tests/macos_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ YELLOW='\033[0;33m'
NC='\033[0m'

# Start the application in the background
../../client/dist/NSO-RPC.app/Contents/MacOS/NSO-RPC > output.log 2>&1 &
APP_PID=$!
open --stdout output.log --stderr output.log ../../client/dist/NSO-RPC.app
APP_PID=$(pgrep -n NSO-RPC)

sleep 10
kill $APP_PID
Expand All @@ -24,5 +24,9 @@ if echo "$output" | grep -q "Launch error"; then
exit 1
else
echo -e "${GREEN}Test Passed!${NC}"
# TODO(spotlightishere): Resolve issues with test invocation
if [ -f output.log ]; then
rm output.log
fi
exit 0
fi

0 comments on commit 1f823b9

Please sign in to comment.