forked from OpenAdaptAI/OpenAdapt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
271 additions
and
162 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Release and PyPI Publish | |
on: | ||
push: | ||
branches: | ||
- main | ||
- '**' | ||
|
||
jobs: | ||
check_last_commit_author: | ||
|
@@ -23,38 +23,38 @@ jobs: | |
echo "skip_ci=true" >> $GITHUB_OUTPUT | ||
fi | ||
build-macos-executables: | ||
name: Build macOS app | ||
runs-on: macos-latest | ||
needs: check_last_commit_author | ||
if: ${{ needs.check_last_commit_author.outputs.skip_ci != 'true' }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
pip install poetry | ||
poetry install | ||
brew install nvm | ||
poetry run install-dashboard | ||
brew install [email protected] | ||
- name: Build executables | ||
run: | | ||
poetry run python -m openadapt.build | ||
cd dist | ||
zip -r ../OpenAdapt.app.zip OpenAdapt.app | ||
cd .. | ||
- name: Upload executables | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: OpenAdapt.app | ||
path: OpenAdapt.app.zip | ||
# build-macos-executables: | ||
# name: Build macOS app | ||
# runs-on: macos-latest | ||
# needs: check_last_commit_author | ||
# if: ${{ needs.check_last_commit_author.outputs.skip_ci != 'true' }} | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: '3.10' | ||
# - name: Install dependencies | ||
# run: | | ||
# pip install poetry | ||
# poetry install | ||
# brew install nvm | ||
# poetry run install-dashboard | ||
# brew install [email protected] | ||
# - name: Build executables | ||
# run: | | ||
# poetry run python -m openadapt.build | ||
# cd dist | ||
# zip -r ../OpenAdapt.app.zip OpenAdapt.app | ||
# cd .. | ||
# - name: Upload executables | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: OpenAdapt.app | ||
# path: OpenAdapt.app.zip | ||
|
||
build-windows-executables: | ||
name: Build Windows app | ||
|
@@ -93,72 +93,137 @@ jobs: | |
name: OpenAdapt | ||
path: OpenAdapt.zip | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [check_last_commit_author, build-macos-executables, build-windows-executables] | ||
if: ${{ needs.check_last_commit_author.outputs.skip_ci != 'true' }} | ||
concurrency: release | ||
permissions: | ||
id-token: write | ||
contents: write | ||
# test_on_macos: | ||
# name: Test on macOS | ||
# runs-on: macos-latest | ||
# needs: [build-macos-executables] | ||
# outputs: | ||
# macos_build_status: ${{ steps.test_on_macos.outputs.status }} | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
# - name: Download macOS executable | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: OpenAdapt.app | ||
# path: dist/ | ||
# - name: Run app | ||
# id: test_on_macos | ||
# run: | | ||
# ./build_scripts/test_app_run_macos.sh | ||
# EXIT_CODE=$? | ||
# if [ $EXIT_CODE -ne 0 ]; then | ||
# echo "macos_build_status=failed" >> $GITHUB_OUTPUT | ||
# fi | ||
|
||
test_on_windows: | ||
name: Test on Windows | ||
runs-on: windows-latest | ||
needs: [build-windows-executables] | ||
outputs: | ||
windows_build_status: ${{ steps.test_on_windows.outputs.windows_build_status }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install the latest version of the project | ||
run: | | ||
git pull | ||
pip install poetry | ||
poetry install | ||
- name: Download macOS executable | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: OpenAdapt.app | ||
path: dist/ | ||
- name: Download Windows executable | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: OpenAdapt | ||
path: dist/ | ||
- name: Python Semantic Release | ||
id: semantic_release | ||
uses: python-semantic-release/[email protected] | ||
with: | ||
github_token: ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication | ||
git_committer_name: "OpenAdapt Bot" | ||
git_committer_email: "[email protected]" | ||
- name: Upload release assets | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run app | ||
id: test_on_windows | ||
shell: powershell | ||
run: | | ||
./build_scripts/upload_release_artifacts.sh | ||
./build_scripts/test_app_run_windows.bat | ||
if ($LastExitCode -ne 0) { | ||
"windows_build_status=failed" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
} | ||
publish: | ||
name: Publish to PyPI | ||
needs: [check_last_commit_author, release] | ||
if: ${{ needs.check_last_commit_author.outputs.skip_ci != 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Publish to PyPI | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
pip install poetry | ||
poetry install | ||
poetry config pypi-token.pypi $PYPI_TOKEN | ||
poetry build | ||
poetry publish --no-interaction --skip-existing | ||
# consolidate_tests: | ||
# name: Consolidate test results | ||
# runs-on: ubuntu-latest | ||
# needs: [test_on_windows, test_on_macos] | ||
# outputs: | ||
# skip_ci: ${{ steps.consolidate_test_results.outputs.skip_ci }} | ||
# steps: | ||
# - name: Consolidate test results | ||
# id: consolidate_test_results | ||
# run: | | ||
# if [ "${{ needs.test_on_windows.outputs.windows_build_status }}" = "failed" ] || [ "${{ needs.test_on_macos.outputs.macos_build_status }}" = "failed" ]; then | ||
# echo "Skip CI" | ||
# echo "skip_ci=true" >> $GITHUB_OUTPUT | ||
# fi | ||
|
||
# release: | ||
# runs-on: ubuntu-latest | ||
# needs: [consolidate_tests] | ||
# if: ${{ needs.consolidate_tests.outputs.skip_ci != 'true' }} | ||
# concurrency: release | ||
# permissions: | ||
# id-token: write | ||
# contents: write | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
# token: ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: '3.10' | ||
# - name: Install the latest version of the project | ||
# run: | | ||
# git pull | ||
# pip install poetry | ||
# poetry install | ||
# - name: Download macOS executable | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: OpenAdapt.app | ||
# path: dist/ | ||
# - name: Download Windows executable | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: OpenAdapt | ||
# path: dist/ | ||
# - name: Python Semantic Release | ||
# id: semantic_release | ||
# uses: python-semantic-release/[email protected] | ||
# with: | ||
# github_token: ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication | ||
# git_committer_name: "OpenAdapt Bot" | ||
# git_committer_email: "[email protected]" | ||
# - name: Upload release assets | ||
# env: | ||
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# run: | | ||
# ./build_scripts/upload_release_artifacts.sh | ||
|
||
# publish: | ||
# name: Publish to PyPI | ||
# needs: [release] | ||
# if: ${{ needs.consolidate_tests.outputs.skip_ci != 'true' }} | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# ref: main | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: '3.10' | ||
# - name: Publish to PyPI | ||
# env: | ||
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
# run: | | ||
# pip install poetry | ||
# poetry install | ||
# poetry config pypi-token.pypi $PYPI_TOKEN | ||
# poetry build | ||
# poetry publish --no-interaction --skip-existing |
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 |
Oops, something went wrong.