Update Build Script
This commit is contained in:
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -26,8 +26,8 @@ jobs:
|
|||||||
# os & python versions
|
# os & python versions
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os-name: [ ubuntu-latest, ubuntu-16.04, macOS-latest, windows-latest ]
|
os-name: [ ubuntu-latest, ubuntu-18.04, macOS-latest, windows-latest ]
|
||||||
python-version: [ 3.7 ]
|
python-version: [ 3.8 ]
|
||||||
# needs: [ install-test ]
|
# needs: [ install-test ]
|
||||||
steps:
|
steps:
|
||||||
# checkout commit
|
# checkout commit
|
||||||
@@ -88,8 +88,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# install/release on not xenial
|
# install/release on not xenial
|
||||||
os-name: [ ubuntu-latest, macOS-latest, windows-latest ]
|
os-name: [ ubuntu-latest, ubuntu-18.04, macOS-latest, windows-latest ]
|
||||||
python-version: [ 3.7 ]
|
python-version: [ 3.8 ]
|
||||||
|
|
||||||
needs: [ install-build ]
|
needs: [ install-build ]
|
||||||
steps:
|
steps:
|
||||||
@@ -150,9 +150,9 @@ jobs:
|
|||||||
# os & python versions
|
# os & python versions
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# release only on bionic
|
# release only on focal/bionic
|
||||||
os-name: [ ubuntu-latest ]
|
os-name: [ ubuntu-latest ]
|
||||||
python-version: [ 3.7 ]
|
python-version: [ 3.8 ]
|
||||||
|
|
||||||
needs: [ install-prepare-release ]
|
needs: [ install-prepare-release ]
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
console = True
|
console = False # <--- change this to True to enable command prompt when the app runs
|
||||||
|
|
||||||
|
if sys.platform.find("mac") or sys.platform.find("osx"):
|
||||||
|
console = False
|
||||||
|
|
||||||
BINARY_SLUG = "DungeonRandomizer"
|
BINARY_SLUG = "DungeonRandomizer"
|
||||||
|
|
||||||
@@ -27,9 +30,6 @@ def recurse_for_py_files(names_so_far):
|
|||||||
hiddenimports = []
|
hiddenimports = []
|
||||||
binaries = []
|
binaries = []
|
||||||
|
|
||||||
#if sys.platform.find("windows"):
|
|
||||||
# binaries.append(("ucrtbase.dll","."))
|
|
||||||
|
|
||||||
a = Analysis([f"./{BINARY_SLUG}.py"],
|
a = Analysis([f"./{BINARY_SLUG}.py"],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
binaries=binaries,
|
binaries=binaries,
|
||||||
@@ -46,6 +46,7 @@ a = Analysis([f"./{BINARY_SLUG}.py"],
|
|||||||
# https://stackoverflow.com/questions/17034434/how-to-remove-exclude-modules-and-files-from-pyinstaller
|
# https://stackoverflow.com/questions/17034434/how-to-remove-exclude-modules-and-files-from-pyinstaller
|
||||||
excluded_binaries = [
|
excluded_binaries = [
|
||||||
'VCRUNTIME140.dll',
|
'VCRUNTIME140.dll',
|
||||||
|
'ucrtbase.dll',
|
||||||
'msvcp140.dll',
|
'msvcp140.dll',
|
||||||
'mfc140u.dll']
|
'mfc140u.dll']
|
||||||
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
||||||
@@ -64,4 +65,4 @@ exe = EXE(pyz,
|
|||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
runtime_tmpdir=None,
|
runtime_tmpdir=None,
|
||||||
console=console ) # <--- change this to True to enable command prompt when the app runs
|
console=console )
|
||||||
|
|||||||
9
Gui.spec
9
Gui.spec
@@ -3,10 +3,11 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
console = True
|
console = False # <--- change this to True to enable command prompt when the app runs
|
||||||
|
|
||||||
if sys.platform.find("mac") or sys.platform.find("osx"):
|
if sys.platform.find("mac") or sys.platform.find("osx"):
|
||||||
console = False
|
console = False
|
||||||
|
|
||||||
BINARY_SLUG = "Gui"
|
BINARY_SLUG = "Gui"
|
||||||
|
|
||||||
def recurse_for_py_files(names_so_far):
|
def recurse_for_py_files(names_so_far):
|
||||||
@@ -29,9 +30,6 @@ def recurse_for_py_files(names_so_far):
|
|||||||
hiddenimports = []
|
hiddenimports = []
|
||||||
binaries = []
|
binaries = []
|
||||||
|
|
||||||
#if sys.platform.find("windows"):
|
|
||||||
# binaries.append(("ucrtbase.dll","."))
|
|
||||||
|
|
||||||
a = Analysis([f"./{BINARY_SLUG}.py"],
|
a = Analysis([f"./{BINARY_SLUG}.py"],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
binaries=binaries,
|
binaries=binaries,
|
||||||
@@ -48,6 +46,7 @@ a = Analysis([f"./{BINARY_SLUG}.py"],
|
|||||||
# https://stackoverflow.com/questions/17034434/how-to-remove-exclude-modules-and-files-from-pyinstaller
|
# https://stackoverflow.com/questions/17034434/how-to-remove-exclude-modules-and-files-from-pyinstaller
|
||||||
excluded_binaries = [
|
excluded_binaries = [
|
||||||
'VCRUNTIME140.dll',
|
'VCRUNTIME140.dll',
|
||||||
|
'ucrtbase.dll',
|
||||||
'msvcp140.dll',
|
'msvcp140.dll',
|
||||||
'mfc140u.dll']
|
'mfc140u.dll']
|
||||||
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
||||||
@@ -66,4 +65,4 @@ exe = EXE(pyz,
|
|||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
runtime_tmpdir=None,
|
runtime_tmpdir=None,
|
||||||
console=console ) # <--- change this to True to enable command prompt when the app runs
|
console=console )
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
import os # for env vars
|
import os # for env vars
|
||||||
import stat # file statistics
|
import stat # file statistics
|
||||||
|
|
||||||
|
global UBUNTU_VERSIONS
|
||||||
|
global DEFAULT_EVENT
|
||||||
|
global DEFAULT_REPO_SLUG
|
||||||
|
global FILENAME_CHECKS
|
||||||
|
global FILESIZE_CHECK
|
||||||
|
UBUNTU_VERSIONS = {
|
||||||
|
"latest": "focal",
|
||||||
|
"20.04": "focal",
|
||||||
|
"18.04": "bionic",
|
||||||
|
"16.04": "xenial"
|
||||||
|
}
|
||||||
|
DEFAULT_EVENT = "event"
|
||||||
|
DEFAULT_REPO_SLUG = "miketrethewey/ALttPDoorRandomizer"
|
||||||
|
FILENAME_CHECKS = [ "Gui", "DungeonRandomizer" ]
|
||||||
|
FILESIZE_CHECK = (6 * 1024 * 1024) # 6MB
|
||||||
|
|
||||||
# take number of bytes and convert to string with units measure
|
# take number of bytes and convert to string with units measure
|
||||||
def convert_bytes(num):
|
def convert_bytes(num):
|
||||||
for x in ["bytes","KB","MB","GB","TB","PB"]:
|
for x in ["bytes","KB","MB","GB","TB","PB"]:
|
||||||
@@ -16,9 +32,8 @@ def file_size(file_path):
|
|||||||
|
|
||||||
# prepare environment variables
|
# prepare environment variables
|
||||||
def prepare_env():
|
def prepare_env():
|
||||||
DEFAULT_EVENT = "event"
|
global DEFAULT_EVENT
|
||||||
DEFAULT_REPO_SLUG = "miketrethewey/ALttPDoorRandomizer"
|
global DEFAULT_REPO_SLUG
|
||||||
|
|
||||||
env = {}
|
env = {}
|
||||||
|
|
||||||
# get app version
|
# get app version
|
||||||
@@ -33,7 +48,7 @@ def prepare_env():
|
|||||||
env["BRANCH"] = os.getenv("TRAVIS_BRANCH","")
|
env["BRANCH"] = os.getenv("TRAVIS_BRANCH","")
|
||||||
env["GITHUB_ACTOR"] = os.getenv("GITHUB_ACTOR","MegaMan.EXE")
|
env["GITHUB_ACTOR"] = os.getenv("GITHUB_ACTOR","MegaMan.EXE")
|
||||||
env["GITHUB_SHA"] = os.getenv("GITHUB_SHA","")
|
env["GITHUB_SHA"] = os.getenv("GITHUB_SHA","")
|
||||||
env["GITHUB_RUN_ID"] = os.getenv("GITHUB_RUN_ID","")
|
env["GITHUB_RUN_NUMBER"] = os.getenv("GITHUB_RUN_NUMBER","")
|
||||||
env["GITHUB_SHA_SHORT"] = env["GITHUB_SHA"]
|
env["GITHUB_SHA_SHORT"] = env["GITHUB_SHA"]
|
||||||
# commit data
|
# commit data
|
||||||
env["COMMIT_ID"] = os.getenv("TRAVIS_COMMIT",os.getenv("GITHUB_SHA",""))
|
env["COMMIT_ID"] = os.getenv("TRAVIS_COMMIT",os.getenv("GITHUB_SHA",""))
|
||||||
@@ -57,7 +72,7 @@ def prepare_env():
|
|||||||
env["GITHUB_SHA_SHORT"] = env["GITHUB_SHA"][:7]
|
env["GITHUB_SHA_SHORT"] = env["GITHUB_SHA"][:7]
|
||||||
|
|
||||||
# ci data
|
# ci data
|
||||||
env["BUILD_NUMBER"] = os.getenv("TRAVIS_BUILD_NUMBER",env["GITHUB_RUN_ID"])
|
env["BUILD_NUMBER"] = os.getenv("TRAVIS_BUILD_NUMBER",env["GITHUB_RUN_NUMBER"])
|
||||||
|
|
||||||
GITHUB_TAG = os.getenv("TRAVIS_TAG",os.getenv("GITHUB_TAG",""))
|
GITHUB_TAG = os.getenv("TRAVIS_TAG",os.getenv("GITHUB_TAG",""))
|
||||||
OS_NAME = os.getenv("TRAVIS_OS_NAME",os.getenv("OS_NAME","")).replace("macOS","osx")
|
OS_NAME = os.getenv("TRAVIS_OS_NAME",os.getenv("OS_NAME","")).replace("macOS","osx")
|
||||||
@@ -68,10 +83,8 @@ def prepare_env():
|
|||||||
OS_VERSION = OS_NAME[OS_NAME.find('-')+1:]
|
OS_VERSION = OS_NAME[OS_NAME.find('-')+1:]
|
||||||
OS_NAME = OS_NAME[:OS_NAME.find('-')]
|
OS_NAME = OS_NAME[:OS_NAME.find('-')]
|
||||||
if OS_NAME == "linux" or OS_NAME == "ubuntu":
|
if OS_NAME == "linux" or OS_NAME == "ubuntu":
|
||||||
if OS_VERSION == "latest":
|
if OS_VERSION in UBUNTU_VERSIONS:
|
||||||
OS_VERSION = "bionic"
|
OS_VERSION = UBUNTU_VERSIONS[OS_VERSION]
|
||||||
elif OS_VERSION == "16.04":
|
|
||||||
OS_VERSION = "xenial"
|
|
||||||
OS_DIST = OS_VERSION
|
OS_DIST = OS_VERSION
|
||||||
|
|
||||||
if OS_VERSION == "" and not OS_DIST == "" and not OS_DIST == "notset":
|
if OS_VERSION == "" and not OS_DIST == "" and not OS_DIST == "notset":
|
||||||
@@ -115,8 +128,8 @@ def prepare_filename(BUILD_FILENAME):
|
|||||||
# find a binary file if it's executable
|
# find a binary file if it's executable
|
||||||
# failing that, assume it's over 6MB
|
# failing that, assume it's over 6MB
|
||||||
def find_binary(listdir):
|
def find_binary(listdir):
|
||||||
FILENAME_CHECKS = [ "Gui", "DungeonRandomizer" ]
|
global FILENAME_CHECKS
|
||||||
FILESIZE_CHECK = (6 * 1024 * 1024) # 6MB
|
global FILESIZE_CHECK
|
||||||
|
|
||||||
BUILD_FILENAMES = []
|
BUILD_FILENAMES = []
|
||||||
executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
|
executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ for BUILD_FILENAME in BUILD_FILENAMES:
|
|||||||
print("Dest Filename: " + DEST_FILENAME)
|
print("Dest Filename: " + DEST_FILENAME)
|
||||||
if not BUILD_FILENAME == "":
|
if not BUILD_FILENAME == "":
|
||||||
print("Build Filesize: " + common.file_size(BUILD_FILENAME))
|
print("Build Filesize: " + common.file_size(BUILD_FILENAME))
|
||||||
|
else:
|
||||||
|
exit(1)
|
||||||
|
|
||||||
if not BUILD_FILENAME == "":
|
if not BUILD_FILENAME == "":
|
||||||
move(
|
move(
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ for dirname in ["resources","user","meta","manifests"]:
|
|||||||
if os.path.isdir(dirpath):
|
if os.path.isdir(dirpath):
|
||||||
os.chmod(dirpath,0o755)
|
os.chmod(dirpath,0o755)
|
||||||
|
|
||||||
|
# nuke git files
|
||||||
|
for git in [ os.path.join(".", ".gitattrubutes"), os.path.join(".", ".gitignore") ]:
|
||||||
|
if os.path.isfile(git):
|
||||||
|
os.remove(git)
|
||||||
|
|
||||||
# nuke travis file if it exists
|
# nuke travis file if it exists
|
||||||
for travis in [ os.path.join(".", ".travis.yml"), os.path.join(".", ".travis.off") ]:
|
for travis in [ os.path.join(".", ".travis.yml"), os.path.join(".", ".travis.off") ]:
|
||||||
if os.path.isfile(travis):
|
if os.path.isfile(travis):
|
||||||
@@ -95,7 +100,10 @@ if len(BUILD_FILENAMES) > 0:
|
|||||||
|
|
||||||
# .zip if windows
|
# .zip if windows
|
||||||
# .tar.gz otherwise
|
# .tar.gz otherwise
|
||||||
ZIP_FILENAME = os.path.join("..","deploy",env["REPO_NAME"]) if len(BUILD_FILENAMES) > 1 else os.path.join("..","deploy",os.path.splitext(BUILD_FILENAME)[0])
|
if len(BUILD_FILENAMES) > 1:
|
||||||
|
ZIP_FILENAME = os.path.join("..","deploy",env["REPO_NAME"])
|
||||||
|
else:
|
||||||
|
ZIP_FILENAME = os.path.join("..","deploy",os.path.splitext(BUILD_FILENAME)[0])
|
||||||
if env["OS_NAME"] == "windows":
|
if env["OS_NAME"] == "windows":
|
||||||
make_archive(ZIP_FILENAME,"zip")
|
make_archive(ZIP_FILENAME,"zip")
|
||||||
ZIP_FILENAME += ".zip"
|
ZIP_FILENAME += ".zip"
|
||||||
@@ -125,3 +133,6 @@ else:
|
|||||||
print("No Zip to prepare: " + ZIP_FILENAME)
|
print("No Zip to prepare: " + ZIP_FILENAME)
|
||||||
|
|
||||||
print("Git tag: " + env["GITHUB_TAG"])
|
print("Git tag: " + env["GITHUB_TAG"])
|
||||||
|
|
||||||
|
if (len(BUILD_FILENAMES) == 0) or (ZIP_FILENAME == ""):
|
||||||
|
exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user