Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ jobs:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python 3.10
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version: "3.13"
- name: Install release dependencies
run: |
# pandoc is required for README.rst -> README.md conversion
Expand All @@ -102,9 +102,16 @@ jobs:
# Extract the release the release to avoid the double zip
unzip dist/*.zip -d dist/
rm dist/sbot-simulator*.zip
- name: Make installer
run: poe installer
- name: Save built release
uses: actions/upload-artifact@v6
with:
name: ${{ steps.release.outputs.RELEASE_NAME }}
path: |
dist/*
- name: Save built installer
uses: actions/upload-artifact@v6
with:
name: install.bat
path: dist-gh-release/install.bat
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/
build/
develop-eggs/
dist/
dist-gh-release/
downloads/
eggs/
.eggs/
Expand Down
7 changes: 7 additions & 0 deletions assets/install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:: sbot_simulator install script
:: This script has been generated for sbot_simulator version __RELEASE__.

wget https://github.com/sourcebots/sbot_simulator/releases/download/__RELEASE__/sbot-simulator-__RELEASE__.zip
unzip -d sbot-simulator-__RELEASE__/ sbot-simulator-__RELEASE__.zip
cd sbot-simulator-__RELEASE__/
C:\Apps\Python315\python.exe scripts/setup.py
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ cmd = "ruff check --fix-only $PYFOLDERS"
help = "Build the release archive."
cmd = "python ./scripts/generate_release.py"

[tool.poe.tasks.installer]
help = "Build the installer script"
cmd = "python ./scripts/generate_installer.py"

[tool.poe.tasks.setup]
help = "Setup the virtual environment for running Webots."
cmd = "python -m ./scripts/setup.py"
Expand Down
36 changes: 36 additions & 0 deletions scripts/generate_installer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""Generates an install.bat script for running on a target to install the simulator."""
import logging
import os
import re
import subprocess
from pathlib import Path

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
project_root = Path(__file__).parents[1]


try:
version = subprocess.check_output(
['git', 'describe', '--tags', '--always'],
cwd=str(project_root),
).decode().strip()
except subprocess.CalledProcessError:
logger.exception("Failed to get version from git")
exit(1)

(project_root / "dist-gh-release").mkdir(exist_ok=True)
os.chdir(str(project_root / "dist-gh-release"))

logger.info("Loading template")
with open((project_root / "assets" / "install.bat"), "r") as f:
source = f.read()

script = re.sub("__RELEASE__", version, source)

logger.info("Writing script")
with open((project_root / "dist-gh-release" / "install.bat"), "w") as f:
f.write(script)

logger.info("Success")