Add --ci-build to Windows build script, and do more to make the build in CircleCI

This commit is contained in:
Micah Lee 2022-03-30 08:29:16 -07:00
parent 6002516c56
commit 935f9bec5b
2 changed files with 176 additions and 146 deletions

View file

@ -80,11 +80,18 @@ jobs:
choco install python --version=3.9.12
choco install 7zip
choco install go
choco install dotnet3.5
choco install wixtoolset
- run:
name: Install poetry
command: (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
- run:
name: Install poetry dependencies
command: |
cd ~\project
cd ~\project\desktop
poetry install
- run:
name: Build
command: |
cd ~\project\desktop
poetry run python .\package\build-windows.py --ci-build

View file

@ -4,6 +4,7 @@ import inspect
import subprocess
import shutil
import uuid
import argparse
import xml.etree.ElementTree as ET
@ -160,6 +161,18 @@ def wix_build_components_xml(root, data):
def main():
parser = argparse.ArgumentParser(
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=48)
)
parser.add_argument(
"--ci-build",
action="store_true",
dest="ci_build",
help="Build in CI, don't code sign",
)
args = parser.parse_args()
ci_build = bool(args.ci_build)
desktop_dir = os.path.join(root, "desktop")
print("○ Clean up from last build")
@ -426,6 +439,10 @@ def main():
freed_mb = int(freed_bytes / 1024 / 1024)
print(f"○ Freed {freed_mb} mb")
if ci_build:
print("Doing a CI build, skipping code signing and msi packaging")
else:
print(f"○ Signing onionshare.exe")
sign(os.path.join("build", "exe.win32-3.9", "onionshare.exe"), desktop_dir)
@ -494,7 +511,9 @@ def main():
Compressed="yes",
SummaryCodepage="1252",
)
ET.SubElement(product_el, "Media", Id="1", Cabinet="product.cab", EmbedCab="yes")
ET.SubElement(
product_el, "Media", Id="1", Cabinet="product.cab", EmbedCab="yes"
)
ET.SubElement(
product_el,
"Icon",
@ -538,7 +557,9 @@ def main():
wix_build_dir_xml(product_el, data)
component_ids = wix_build_components_xml(product_el, data)
feature_el = ET.SubElement(product_el, "Feature", Id="DefaultFeature", Level="1")
feature_el = ET.SubElement(
product_el, "Feature", Id="DefaultFeature", Level="1"
)
for component_id in component_ids:
ET.SubElement(feature_el, "ComponentRef", Id=component_id)
ET.SubElement(feature_el, "ComponentRef", Id="ApplicationShortcuts")
@ -574,7 +595,9 @@ def main():
)
sign(os.path.join(desktop_dir, "build", "OnionShare.msi"))
final_msi_filename = os.path.join(desktop_dir, "dist", f"OnionShare-{version}.msi")
final_msi_filename = os.path.join(
desktop_dir, "dist", f"OnionShare-{version}.msi"
)
print(f"○ Final MSI: {final_msi_filename}")
os.makedirs(os.path.join(desktop_dir, "dist"), exist_ok=True)
os.rename(