-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a build for a standalone Hedy package on Windows. The end result will be a directory with an executable and some data files hidden in a directory called `_internal`. It will use the dev database in JSON format. The build is triggered with the (hidden) doit task `doit run _offline`; this also adds a GitHub Workflows script that performs the build.
- Loading branch information
Showing
14 changed files
with
381 additions
and
37 deletions.
There are no files selected for viewing
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,59 @@ | ||
name: Build offline Hedy | ||
on: | ||
# Can be run on-demand | ||
workflow_dispatch: {} | ||
|
||
# Runs when 'deploy to prod' runs | ||
workflow_run: | ||
workflows: ["Deploy to hedy.org"] | ||
types: [requested] | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
cache: 'pip' | ||
- name: Set up NodeJS 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'npm' | ||
- name: 'Install npx' | ||
run: npm install -g npx | ||
- run: pip install -r requirements.txt | ||
name: 'Python requirements' | ||
- run: doit run _offline | ||
- name: Smoke test the build | ||
run: cd dist && offlinehedy/run-hedy-server --smoketest | ||
|
||
- uses: fregante/daily-version-action@v2 | ||
name: Create tag if necessary | ||
id: daily-version | ||
|
||
- name: Create zip file | ||
# Because we're on Windows | ||
run: | | ||
cd dist/offlinehedy && Compress-Archive -Path . -Destination ../../offlinehedy-${{ steps.daily-version.outputs.version }}.zip | ||
- if: steps.daily-version.outputs.created | ||
name: Create Release | ||
uses: shogo82148/actions-create-release@v1 | ||
id: create_release | ||
with: | ||
tag_name: ${{ steps.daily-version.outputs.version }} | ||
generate_release_notes: true | ||
|
||
- name: Upload Assets | ||
if: steps.daily-version.outputs.created | ||
uses: shogo82148/actions-upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: '*.zip' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
_ _ _ | ||
| | | | | | | ||
| |__| | ___ __| |_ _ | ||
| __ |/ _ \/ _` | | | | | ||
| | | | __/ (_| | |_| | | ||
|_| |_|\___|\__,_|\__, | | ||
__/ | | ||
o f f l i n e |___/ | ||
|
||
Welcome to offline Hedy! You can use offline Hedy to run Hedy on your own | ||
computer, and it can be used by anyone on the same network. | ||
|
||
|
||
For you | ||
======= | ||
|
||
When you first start up offline Hedy on a Windows computer, two things can | ||
happen: | ||
|
||
- Windows Firewall will ask you whether or not to allow network connections. | ||
You should click "Allow". | ||
- Windows Defender may say that Hedy is a dangerous program and ask you whether | ||
or not it should be run. You should click "More Info" and then "Run Anyway". | ||
|
||
You can create a teacher account for yourself by visiting the following link | ||
and then clicking "Create Account". | ||
|
||
http://localhost/invite/newteacher | ||
|
||
You can also use one of the built-in accounts, which is named "teacher1" | ||
with password "123456". | ||
|
||
|
||
For students | ||
============ | ||
|
||
When Hedy starts up, it will print a web address made from numbers. Your students | ||
should type this address into the address bar of their browser. | ||
|
||
The address will look something like this, but it will be different on every | ||
computer. It can also change every time your computer starts up: | ||
|
||
http://192.168.31.13/ | ||
|
||
|
||
Upgrading to a newer version | ||
============================ | ||
|
||
All your data and your student's data is stored in the file `database.json` | ||
that you will see in the program's directory. When you download a newer version | ||
of Offline Hedy it will come with its own empty database. To keep all programs | ||
around, you can copy over the `database.json` file from the old version to the | ||
new version of Hedy. | ||
|
||
To keep it simple, you can also start fresh and use the newer version only for a | ||
different class or different year. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#---------------------------------------------------------- | ||
# PyInstaller configuration file | ||
# | ||
# This file controls how we build a standalone distribution of | ||
# Hedy that can run in environments where Internet access might | ||
# be spotty. | ||
#---------------------------------------------------------- | ||
# -*- mode: python ; coding: utf-8 -*- | ||
from os import path | ||
import sys | ||
|
||
dirname = 'offlinehedy' | ||
appname = 'run-hedy-server' | ||
|
||
# Find the venv directory. We need to be able to pass this to | ||
# pyinstaller, otherwise it will not bundle the libraries we installed | ||
# from the venv. | ||
venv_dir = [p for p in sys.path if 'site-packages' in p][0] | ||
|
||
|
||
data_files = [ | ||
# Files | ||
('README.md', '.'), | ||
('static_babel_content.json', '.'), | ||
|
||
# Folders | ||
('content', 'content'), | ||
('grammars', 'grammars'), | ||
('grammars-Total', 'grammars-Total'), | ||
('prefixes', 'prefixes'), | ||
('static', 'static'), | ||
('templates', 'templates'), | ||
('translations', 'translations'), | ||
] | ||
|
||
a = Analysis( | ||
['app.py'], | ||
pathex=[venv_dir], | ||
binaries=[], | ||
datas=data_files, | ||
hiddenimports=[], | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
noarchive=False, | ||
) | ||
pyz = PYZ(a.pure) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name=appname, | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.datas, | ||
strip=False, | ||
upx=False, | ||
upx_exclude=[], | ||
name=dirname, | ||
) |
Oops, something went wrong.