-
-
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.
Closes: #5
- Loading branch information
Showing
13 changed files
with
151 additions
and
191 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,55 @@ | ||
name: Build Release Artifacts | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
artifacts: | ||
name: Package & upload release artifacts | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Compile skyportal lib | ||
run: | | ||
python -m pip install mpy-cross | ||
python ./compile.py | ||
- name: Build base bundle | ||
run: | | ||
tar -cvf bundle_base.tar \ | ||
./assets/* \ | ||
./lib/* \ | ||
./boot.py \ | ||
./code.py \ | ||
./constants.py \ | ||
./pyportal_startup.bmp \ | ||
./pyportal_startup.wav \ | ||
./secrets.py | ||
- name: Create non-compiled bundle | ||
run: | | ||
cp bundle_base.tar skyportal_bundle.tar | ||
tar -rvf skyportal_bundle.tar ./skyportal/* | ||
gzip skyportal_bundle.tar | ||
- name: Create compiled bundle | ||
run: | | ||
cp bundle_base.tar skyportal_bundle_compiled.tar | ||
tar -rvf skyportal_bundle_compiled.tar -C ./dist/ . | ||
gzip skyportal_bundle_compiled.tar | ||
- name: Upload artifacts | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | ||
gh release upload ${{ github.event.release.tag_name }} skyportal_bundle.tar.gz skyportal_bundle_compiled.tar.gz |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,31 @@ | ||
import time | ||
from pathlib import Path | ||
|
||
import mpy_cross | ||
|
||
SOURCE_DIR = Path("./skyportal") | ||
DEST_DIR = Path("./dist/lib/skyportal") | ||
|
||
|
||
if __name__ == "__main__": | ||
DEST_DIR.mkdir(parents=True, exist_ok=True) | ||
|
||
to_compile = list(SOURCE_DIR.glob("*.py")) | ||
print(f"Found {len(to_compile)} *.py files to compile") | ||
for filepath in to_compile: | ||
mpy_cross.run(filepath) | ||
|
||
time.sleep(1) # Lazy wait for subprocesses to finish | ||
|
||
compiled = list(SOURCE_DIR.glob("*.mpy")) | ||
if len(compiled) != len(to_compile): | ||
raise RuntimeError( | ||
f"Number of compiled files less than original source ({len(compiled)} < {len(to_compile)}), may need a longer wait" # noqa: E501 | ||
) | ||
|
||
print(f"Compiled {len(compiled)} files ... moving to {DEST_DIR}") | ||
for filepath in compiled: | ||
dest = DEST_DIR / filepath.name | ||
dest.unlink(missing_ok=True) | ||
|
||
filepath.rename(DEST_DIR / filepath.name) |
Binary file not shown.
Oops, something went wrong.