fix(trading): fix ci cypress issue (#5922)
This commit is contained in:
parent
b2777043b4
commit
c0f4278b81
@ -11,7 +11,6 @@
|
||||
"build:all": "nx run-many --all --target=build",
|
||||
"build-spec:all": "nx run-many --all --target=build-spec",
|
||||
"lint:all": "nx run-many --all --target=lint",
|
||||
"e2e:all": "nx run-many --all --target=e2e",
|
||||
"vegacapsule": "vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl",
|
||||
"release": "git checkout develop ; git pull ; node scripts/make-release.js",
|
||||
"trading:test": "cd apps/trading/e2e && poetry run pytest -k",
|
||||
|
@ -7,18 +7,18 @@ projects = []
|
||||
projects_e2e = []
|
||||
|
||||
previews = {
|
||||
'governance': 'not deployed',
|
||||
'explorer': 'not deployed',
|
||||
'trading': 'not deployed',
|
||||
'tools': 'not deployed',
|
||||
'governance': 'not deployed',
|
||||
'explorer': 'not deployed',
|
||||
'trading': 'not deployed',
|
||||
'tools': 'not deployed',
|
||||
}
|
||||
|
||||
main_apps = ['governance', 'explorer', 'trading']
|
||||
|
||||
preview_governance="not deployed"
|
||||
preview_trading="not deployed"
|
||||
preview_explorer="not deployed"
|
||||
preview_tools="not deployed"
|
||||
preview_governance = "not deployed"
|
||||
preview_trading = "not deployed"
|
||||
preview_explorer = "not deployed"
|
||||
preview_tools = "not deployed"
|
||||
|
||||
# take input from the pipeline
|
||||
parser = ArgumentParser()
|
||||
@ -30,7 +30,8 @@ parser.add_argument('--event-name', help='name of event in CI')
|
||||
args = parser.parse_args()
|
||||
|
||||
# run yarn affected command
|
||||
affected=check_output(f'yarn nx print-affected --base={environ["NX_BASE"]} --head={environ["NX_HEAD"]} --select=projects'.split()).decode('utf-8')
|
||||
affected = check_output(
|
||||
f'yarn nx print-affected --base={environ["NX_BASE"]} --head={environ["NX_HEAD"]} --select=projects'.split()).decode('utf-8')
|
||||
|
||||
|
||||
# print useful information
|
||||
@ -44,49 +45,54 @@ print(affected)
|
||||
print(">>>> eof debug")
|
||||
|
||||
# define affection actions -> add to projects arrays and generate preview link
|
||||
|
||||
|
||||
def affect_app(app, preview_name=None):
|
||||
print(f"{app} is affected")
|
||||
projects.append(app)
|
||||
if not preview_name:
|
||||
preview_name=app
|
||||
previews[app] = f'https://{preview_name}.{args.branch_slug}.vega.rocks'
|
||||
print(f"{app} is affected")
|
||||
projects.append(app)
|
||||
if not preview_name:
|
||||
preview_name = app
|
||||
previews[app] = f'https://{preview_name}.{args.branch_slug}.vega.rocks'
|
||||
|
||||
|
||||
# check appearance in the affected string for main apps
|
||||
for app in main_apps:
|
||||
if app in affected:
|
||||
affect_app(app)
|
||||
if app in affected:
|
||||
affect_app(app)
|
||||
|
||||
# if non of main apps is affected - test all of them
|
||||
if not projects:
|
||||
for app in main_apps:
|
||||
affect_app(app)
|
||||
for app in main_apps:
|
||||
affect_app(app)
|
||||
|
||||
# generate e2e targets
|
||||
projects_e2e = [f'{app}-e2e' for app in projects]
|
||||
|
||||
# remove trading-e2e because it doesn't exists any more (new target is: console-e2e)
|
||||
if "trading-e2e" in projects_e2e:
|
||||
projects_e2e.remove("trading-e2e")
|
||||
|
||||
# check affection for multisig-signer which is deployed only from develop and pull requests
|
||||
if args.event_name == 'pull_request' or 'develop' in args.github_ref:
|
||||
if 'multisig-signer' in affected:
|
||||
affect_app('multisig-signer', 'tools')
|
||||
if 'multisig-signer' in affected:
|
||||
affect_app('multisig-signer', 'tools')
|
||||
|
||||
# now parse apps that are deployed from develop but don't have previews
|
||||
if 'develop' in args.github_ref:
|
||||
for app in ['static', 'ui-toolkit']:
|
||||
if app in affected:
|
||||
projects.append(app)
|
||||
for app in ['static', 'ui-toolkit']:
|
||||
if app in affected:
|
||||
projects.append(app)
|
||||
|
||||
# if ref is in format release/{env}-{app} then only {app} is deployed
|
||||
if 'release' in args.github_ref:
|
||||
for app in main_apps:
|
||||
if f'{args.github_ref}'.endswith(app):
|
||||
projects = [app]
|
||||
projects_e2e = [f'{app}-e2e']
|
||||
for app in main_apps:
|
||||
if f'{args.github_ref}'.endswith(app):
|
||||
projects = [app]
|
||||
projects_e2e = [f'{app}-e2e']
|
||||
|
||||
|
||||
projects = json.dumps(projects)
|
||||
|
||||
# The trading project does not use the deafult NX e2e setup (cypress)
|
||||
projects_e2e.remove('trading-e2e')
|
||||
projects_e2e = json.dumps(projects_e2e)
|
||||
|
||||
print(f'Projects: {projects}')
|
||||
@ -94,20 +100,20 @@ print(f'Projects E2E: {projects_e2e}')
|
||||
|
||||
print('>> Previews')
|
||||
for preview, preview_value in previews.items():
|
||||
print(f'{preview}: {preview_value}')
|
||||
print(f'{preview}: {preview_value}')
|
||||
print('>> EOF Previews')
|
||||
|
||||
|
||||
lines_to_write = [
|
||||
f'PREVIEW_GOVERNANCE={previews["governance"]}',
|
||||
f'PREVIEW_EXPLORER={previews["explorer"]}',
|
||||
f'PREVIEW_TRADING={previews["trading"]}',
|
||||
f'PREVIEW_TOOLS={previews["tools"]}',
|
||||
f'PROJECTS={projects}',
|
||||
f'PROJECTS_E2E={projects_e2e}',
|
||||
f'PREVIEW_GOVERNANCE={previews["governance"]}',
|
||||
f'PREVIEW_EXPLORER={previews["explorer"]}',
|
||||
f'PREVIEW_TRADING={previews["trading"]}',
|
||||
f'PREVIEW_TOOLS={previews["tools"]}',
|
||||
f'PROJECTS={projects}',
|
||||
f'PROJECTS_E2E={projects_e2e}',
|
||||
]
|
||||
env_file = environ['GITHUB_ENV']
|
||||
print(f'Line to add to GITHUB_ENV file: {env_file}')
|
||||
print(lines_to_write)
|
||||
with open(env_file, 'a') as _f:
|
||||
_f.write('\n'.join(lines_to_write))
|
||||
_f.write('\n'.join(lines_to_write))
|
||||
|
Loading…
Reference in New Issue
Block a user