Allow dispatch options to control build [skip actions]

This commit is contained in:
Sebastien L
2022-10-06 11:31:43 -04:00
parent 83592b7079
commit f70f973ca9
2 changed files with 25 additions and 20 deletions

View File

@@ -11,9 +11,9 @@ on:
description: 'Release' description: 'Release'
required: true required: true
type: boolean type: boolean
push: # push:
branches: # branches:
- '**4.3' # - '**4.3'
jobs: jobs:
bootstrap: bootstrap:
@@ -27,6 +27,12 @@ jobs:
release_flag: ${{ steps.build_flags.outputs.release_flag }} release_flag: ${{ steps.build_flags.outputs.release_flag }}
mock: ${{ steps.build_flags.outputs.mock }} mock: ${{ steps.build_flags.outputs.mock }}
steps: steps:
- name: Set Build options from workflow dispatch event
run: |
ui_build_option="" && [[ ${{ inputs.ui_build }} ]] && ui_build_option="--ui_build"
release_build_option="" && [[ ${{ inputs.release_build }} ]] && release_build_option="--force"
echo "ui_build_option=$ui_build_option" >> $GITHUB_ENV
echo "release_build_option=$release_build_option" >> $GITHUB_ENV
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -47,8 +53,7 @@ jobs:
# --mock - to mock the compilation part - this is to be used for testing only # --mock - to mock the compilation part - this is to be used for testing only
# --force - to force a release build even if the last commit message doesn't contain the word "release" # --force - to force a release build even if the last commit message doesn't contain the word "release"
# --ui_build - to force a ui_build even if the last commit message doesn't contain "[ui-build]" # --ui_build - to force a ui_build even if the last commit message doesn't contain "[ui-build]"
build_tools.py build_flags build_tools.py build_flags ${{ env.ui_build_option }} ${{ env.release_build_option }}
preparation: preparation:
name: Preparation name: Preparation
needs: bootstrap needs: bootstrap

View File

@@ -44,7 +44,7 @@ try:
from genericpath import isdir from genericpath import isdir
except ImportError as ex: except ImportError as ex:
print(f'::error::Failed importing module {ex.name}, using interpreter {sys.executable}. \n Installed packages:') print(f'::error Failed importing module {ex.name}, using interpreter {sys.executable}. \n Installed packages:')
installed_packages = pkg_resources.working_set installed_packages = pkg_resources.working_set
installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages]) installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages])
print('\n'.join(installed_packages_list)) print('\n'.join(installed_packages_list))
@@ -226,9 +226,9 @@ class BinFile():
os.makedirs(target_folder, exist_ok=True) os.makedirs(target_folder, exist_ok=True)
shutil.copyfile(self.source_full_path, self.target_fullpath, follow_symlinks=True) shutil.copyfile(self.source_full_path, self.target_fullpath, follow_symlinks=True)
except Exception as ex: except Exception as ex:
print(f'::error::Error while copying {self.source_full_path} to {self.target_fullpath}' ) print(f'::error Error while copying {self.source_full_path} to {self.target_fullpath}' )
print(f'::error::Content of {os.path.dirname(self.source_full_path.rstrip())}:') print(f'::error Content of {os.path.dirname(self.source_full_path.rstrip())}:')
print('\n::error::'.join(get_file_list(os.path.dirname(self.source_full_path.rstrip())))) print('\n::error '.join(get_file_list(os.path.dirname(self.source_full_path.rstrip()))))
raise raise
return self.target_fullpath return self.target_fullpath
def get_attributes(self): def get_attributes(self):
@@ -383,7 +383,7 @@ class Releases():
cls.last_commit=cls.repo[target] cls.last_commit=cls.repo[target]
logger.info(f'Last commit for {head.shorthand} is {format_commit(cls.last_commit)}') logger.info(f'Last commit for {head.shorthand} is {format_commit(cls.last_commit)}')
except Exception as e: except Exception as e:
print(f'::error::Unable to retrieve last commit for {head.shorthand}/{target}: {e}') print(f'::error Unable to retrieve last commit for {head.shorthand}/{target}: {e}')
cls.last_commit=None cls.last_commit=None
return cls.last_commit return cls.last_commit
@classmethod @classmethod
@@ -393,9 +393,9 @@ class Releases():
logger.info(f'Opening repository from {path}') logger.info(f'Opening repository from {path}')
cls.repo=Repository(path=path) cls.repo=Repository(path=path)
except GitError as ex: except GitError as ex:
print(f'::error::Unable to access the repository.') print(f'::error Unable to access the repository.')
print(f'::error::Content of {path}:') print(f'::error Content of {path}:')
print('\n::error::'.join(get_file_list(path,1))) print('\n::error '.join(get_file_list(path,1)))
raise raise
return cls.repo return cls.repo
@classmethod @classmethod
@@ -455,7 +455,7 @@ class Releases():
break break
except Exception as e: except Exception as e:
print(f'::error::Unable to get commit list starting at {last.id}: {e}') print(f'::error Unable to get commit list starting at {last.id}: {e}')
return commit_list return commit_list
@@ -491,10 +491,10 @@ def parse_json(filename:str):
logger.debug(f'Loading json\n{content}') logger.debug(f'Loading json\n{content}')
return json.loads(content) return json.loads(content)
except JSONDecodeError as ex: except JSONDecodeError as ex:
print(f'::error::Error parsing {content}') print(f'::error Error parsing {content}')
except Exception as ex: except Exception as ex:
print(f'::error::Unable to parse flasher args json file. Content of {folder}:') print(f'::error Unable to parse flasher args json file. Content of {folder}:')
print('\n::error::'.join(get_file_list(folder))) print('\n::error '.join(get_file_list(folder)))
raise raise
def write_github_env(args): def write_github_env(args):
@@ -571,9 +571,9 @@ def handle_artifacts(args):
os.makedirs(target_dir, exist_ok=True) os.makedirs(target_dir, exist_ok=True)
shutil.copyfile(source, target, follow_symlinks=True) shutil.copyfile(source, target, follow_symlinks=True)
except Exception as ex: except Exception as ex:
print(f'::error::Error while copying {source} to {target}' ) print(f'::error Error while copying {source} to {target}' )
print(f'::error::Content of {target_dir}:') print(f'::error Content of {target_dir}:')
print('\n::error::'.join(get_file_list(os.path.dirname(attr[0].rstrip())))) print('\n::error '.join(get_file_list(os.path.dirname(attr[0].rstrip()))))
raise raise
def delete_folder(path): def delete_folder(path):