Skip to content

Commit

Permalink
feat(worker): deploy AntaresWebWorker on its own
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Jun 13, 2024
1 parent 472883b commit 31a498d
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#file: noinspection YAMLSchemaValidation
name: deploy
on:
push:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/worker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: worker
on:
push:
branches:
- "master"
- "worker/**"

jobs:
binary:
runs-on: windows-latest

steps:
- name: 🐙 Checkout GitHub repo (+ download lfs dependencies)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 🐍 Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: 🐍 Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: 📦 Packaging AntaresWebWorker
run: bash ./package_worker.sh
working-directory: scripts

- name: 🚀 Upload binary
uses: actions/upload-artifact@v3
with:
name: AntaresWebWorker
path: dist/AntaresWebWorker.exe
45 changes: 45 additions & 0 deletions AntaresWebWorker.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

a = Analysis(
["antarest/worker/archive_worker_service.py"],
pathex=[],
binaries=[],
datas=[("resources", "resources")],
hiddenimports=["pythonjsonlogger.jsonlogger"],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(
a.pure,
a.zipped_data,
cipher=block_cipher,
)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name="AntaresWebWorker",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
2 changes: 1 addition & 1 deletion scripts/package_antares_web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Antares Web Packaging -- Desktop Version
#
# This script is launch by the GitHub Workflow `.github/workflows/deploy.yml`.
# It builds the Desktop version of the Web Application and the Worker Application.
# It builds the Desktop version of the Web Application.
# Make sure you run the `npm install` stage before running this script.

set -e
Expand Down
17 changes: 17 additions & 0 deletions scripts/package_worker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# AntaresWebWorker packaging
#
# This script is launch by the GitHub Workflow `.github/workflows/worker.yml`.
# It builds the AntaresWebWorker.

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
PROJECT_DIR=$(dirname -- "${SCRIPT_DIR}")
DIST_DIR="${PROJECT_DIR}/dist"

echo "INFO: Generating the Worker Application..."
pushd ${PROJECT_DIR}
pyinstaller --distpath ${DIST_DIR} AntaresWebWorker.spec
popd

chmod +x "${DIST_DIR}/AntaresWebWorker"

0 comments on commit 31a498d

Please sign in to comment.