-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config, build): refactor config; build executables
* feat(config): Make changes to config to use pydantic settings * chore: Refactor all uses of config to use the config object from the config module * refactor(config): Remove unused code, fix typos and add comments for clearer information * refactor: Add more comments and change variable names * fix(record): Fix progress bar * feature(config): Re-read config value only if it changes * update README --------- Co-authored-by: Richard Abrich <[email protected]>
- Loading branch information
Showing
103 changed files
with
2,397 additions
and
1,050 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 |
---|---|---|
@@ -1,38 +1,127 @@ | ||
name: Semantic Release and PyPI Publish | ||
name: Release and PyPI Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-macos-executables: | ||
name: Build macOS app | ||
runs-on: macos-latest | ||
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 | ||
runs-on: windows-latest | ||
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: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
- name: Install dependencies | ||
run: | | ||
pip install poetry | ||
poetry install | ||
cd openadapt/app/dashboard | ||
npm install | ||
cd ../../../ | ||
- name: Build executables | ||
run: | | ||
poetry run python -m openadapt.build | ||
cd dist | ||
7z a -tzip ../OpenAdapt.zip OpenAdapt | ||
cd .. | ||
- name: Upload executables | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: OpenAdapt | ||
path: OpenAdapt.zip | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [build-macos-executables, build-windows-executables] | ||
concurrency: release | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication | ||
- 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: relekang/python-semantic-release@master | ||
with: | ||
github_token: ${{ secrets.ADMIN_TOKEN }} # Use the new token for authentication | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
git_committer_name: "OpenAdapt Bot" | ||
git_committer_email: "[email protected]" | ||
|
||
- name: Install the latest version of the project | ||
run: | | ||
git pull | ||
pip install poetry | ||
poetry install | ||
- name: Upload release assets | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
./build_scripts/upload_release_artifacts.sh | ||
publish: | ||
name: Publish to PyPI | ||
needs: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Publish to PyPI | ||
|
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
84 changes: 0 additions & 84 deletions
84
alembic/versions/b206c80f7640_add_recording_inputevent_screenshot_.py
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""Get the version of the package.""" | ||
|
||
import importlib.metadata | ||
|
||
|
||
def get_version() -> str: | ||
"""Get the version of the package.""" | ||
return importlib.metadata.version("openadapt") | ||
|
||
|
||
if __name__ == "__main__": | ||
print(get_version()) |
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,12 @@ | ||
#!/bin/bash | ||
|
||
# This script is used to run the OpenAdapt app on macOS from a terminal, because otherwise there are times | ||
# when the app doesn't record events properly, and is extremely slow when updating events to the database. | ||
# This bash script replaces the location of the actual executable file, which is copied to a different location | ||
# when the app is built. This script is used to run the app from the terminal, and is not used in the actual app. | ||
|
||
BASH_LOCATION=$(dirname $0) | ||
|
||
osascript -e 'tell app "Terminal" | ||
do script "cd '$BASH_LOCATION' && ./OpenAdapt.app; exit;" | ||
end tell' |
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,5 @@ | ||
VERSION="v$(poetry run python -m build_scripts.get_version)" | ||
mv dist/OpenAdapt.zip dist/OpenAdapt-$VERSION.zip | ||
mv dist/OpenAdapt.app.zip dist/OpenAdapt-$VERSION.app.zip | ||
echo "Uploading release artifacts for version $VERSION" | ||
gh release upload $VERSION dist/OpenAdapt-$VERSION.zip dist/OpenAdapt-$VERSION.app.zip |
Oops, something went wrong.