Skip to content

Commit

Permalink
Testing windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mbsantiago committed Jan 11, 2024
1 parent d0a2cca commit d5af9ee
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 65 deletions.
129 changes: 65 additions & 64 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@ on:
- "releases/**"

jobs:
# build-windows:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# - run: pip install -r requirements.txt pyinstaller sphinx
# sphinx-autobuild sphinx-book-theme
# - run: sphinx-build -b html 'docs/source' 'docs/build'
# - run: pyinstaller
# --add-data "whombat/migrations;whombat/migrations"
# --add-data "whombat/static;whombat/static"
# --add-data "whombat/templates;whombat/templates"
# --add-data "docs/build;docs/build"
# --hidden-import "logging.config"
# --hidden-import "passlib.handlers.bcrypt"
# --onefile app.py
# - run: mv "dist/app.exe" "dist/whombat-windows-${{ github.ref_name }}.exe"
# - uses: shogo82148/actions-upload-release-asset@v1
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: 'dist/whombat-windows-${{ github.ref_name }}.exe'

build-ubuntu:
runs-on: ubuntu-20.04
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -38,44 +14,69 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 21
- run:
make build-frontend
- run:
make build-guide
- run:
make bundle-pyinstaller
- run: |
mkdir dist/
chmod +x "back/dist/whombat"
mv back/dist/whombat "dist/whombat-ubuntu-${{ github.ref_name }}"
- shell: pwsh
run:
scripts\build-frontend.ps1
- shell: pwsh
run:
scripts\build-guide.ps1
- shell: pwsh
run:
scripts\bundle-pyinstaller.ps1
- run: mv "dist/app.exe" "dist/whombat-windows-${{ github.ref_name }}.exe"
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "dist/whombat-ubuntus-${{ github.ref_name }}"


build-macos:
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/setup-node@v1
with:
node-version: 21
- run:
make build-frontend
- run:
make build-guide
- run:
make bundle-pyinstaller
- run: |
mkdir dist/
chmod +x "back/dist/whombat"
mv back/dist/whombat "dist/whombat-macos-${{ github.ref_name }}"
- uses: shogo82148/actions-upload-release-asset@v1
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "dist/whombat-macos-${{ github.ref_name }}"
asset_path: 'dist/whombat-windows-${{ github.ref_name }}.exe'
#
# build-ubuntu:
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: "3.11"
# - uses: actions/setup-node@v1
# with:
# node-version: 21
# - run:
# make build-frontend
# - run:
# make build-guide
# - run:
# make bundle-pyinstaller
# - run: |
# mkdir dist/
# chmod +x "back/dist/whombat"
# mv back/dist/whombat "dist/whombat-ubuntu-${{ github.ref_name }}"
# - uses: shogo82148/actions-upload-release-asset@v1
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: "dist/whombat-ubuntus-${{ github.ref_name }}"
#
#
# build-macos:
# runs-on: macos-11
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: "3.11"
# - uses: actions/setup-node@v1
# with:
# node-version: 21
# - run:
# make build-frontend
# - run:
# make build-guide
# - run:
# make bundle-pyinstaller
# - run: |
# mkdir dist/
# chmod +x "back/dist/whombat"
# mv back/dist/whombat "dist/whombat-macos-${{ github.ref_name }}"
# - uses: shogo82148/actions-upload-release-asset@v1
# - uses: shogo82148/actions-upload-release-asset@v1
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: "dist/whombat-macos-${{ github.ref_name }}"
39 changes: 39 additions & 0 deletions scripts/bundle.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Move to the backend directory
cd back\

# Make sure you have python 3.11 installed
if (-not (python --version) -match "3.11") {
Write-Host "Please install python 3.11"
exit 1
}

# Make sure the build directory exists
if (-not (Test-Path "build")) {
New-Item -ItemType Directory -Name "build"
}

if (-not (Test-Path "build\.venv")) {
# Create a virtual environment if it doesn't exist
python -m venv build\.venv
}

build\.venv\Scripts\pip install -U pip setuptools wheel

build\.venv\Scripts\pip install pyinstaller

# Install whombat
build\.venv\Scripts\pip install .

# Run pyinstaller to bundle whombat into an executable file
build\.venv\Scripts\pyinstaller `
--hidden-import "app" `
--hidden-import "aiosqlite" `
--hidden-import "logging.config" `
--hidden-import "passlib.handlers.bcrypt" `
--add-data "src\whombat\migrations;whombat\migrations" `
--add-data "src\whombat\statics;whombat\statics" `
--add-data "src\whombat\user_guide;whombat\user_guide" `
--add-data "alembic.ini;." `
--name whombat `
--onefile `
app.py
1 change: 0 additions & 1 deletion scripts/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ build/.venv/bin/pyinstaller \
--add-data "src/whombat/statics:whombat/statics" \
--add-data "src/whombat/user_guide:whombat/user_guide" \
--add-data "alembic.ini:." \
--splash "../front/public/whombat512x512png.png" \
--name whombat \
--onefile \
app.py
25 changes: 25 additions & 0 deletions scripts/update_front.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This script is used to update the front end of the website

# Move to the root directory of the backend
cd back

# Delete the old static files
Remove-Item -Path src/whombat/statics/* -Recurse -Force

# Go to the root directory of the frontend
cd ../front

# Install the dependencies
npm install

# Run the build script
npm run build

# Make sure the statics folder exists
if (-not (Test-Path "../back/src/whombat/statics")) {
New-Item -Path "../back/src/whombat/statics" -ItemType Directory | Out-Null
}

# Move the static files to the backend
Move-Item -Path out/* -Destination ../back/src/whombat/statics/ -Force

16 changes: 16 additions & 0 deletions scripts/update_guide.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Move to the root directory of the backend
cd back

# Make sure there is a virtual environment
if (-not (Test-Path .venv)) {
python -m venv .venv
}

# Activate virtual environment
.venv\Scripts\activate

# Install necessary packages
pip install .[docs]

# Build the user guide
make build-guide

0 comments on commit d5af9ee

Please sign in to comment.