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:all": "nx run-many --all --target=build",
|
||||||
"build-spec:all": "nx run-many --all --target=build-spec",
|
"build-spec:all": "nx run-many --all --target=build-spec",
|
||||||
"lint:all": "nx run-many --all --target=lint",
|
"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",
|
"vegacapsule": "vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl",
|
||||||
"release": "git checkout develop ; git pull ; node scripts/make-release.js",
|
"release": "git checkout develop ; git pull ; node scripts/make-release.js",
|
||||||
"trading:test": "cd apps/trading/e2e && poetry run pytest -k",
|
"trading:test": "cd apps/trading/e2e && poetry run pytest -k",
|
||||||
|
@ -7,18 +7,18 @@ projects = []
|
|||||||
projects_e2e = []
|
projects_e2e = []
|
||||||
|
|
||||||
previews = {
|
previews = {
|
||||||
'governance': 'not deployed',
|
'governance': 'not deployed',
|
||||||
'explorer': 'not deployed',
|
'explorer': 'not deployed',
|
||||||
'trading': 'not deployed',
|
'trading': 'not deployed',
|
||||||
'tools': 'not deployed',
|
'tools': 'not deployed',
|
||||||
}
|
}
|
||||||
|
|
||||||
main_apps = ['governance', 'explorer', 'trading']
|
main_apps = ['governance', 'explorer', 'trading']
|
||||||
|
|
||||||
preview_governance="not deployed"
|
preview_governance = "not deployed"
|
||||||
preview_trading="not deployed"
|
preview_trading = "not deployed"
|
||||||
preview_explorer="not deployed"
|
preview_explorer = "not deployed"
|
||||||
preview_tools="not deployed"
|
preview_tools = "not deployed"
|
||||||
|
|
||||||
# take input from the pipeline
|
# take input from the pipeline
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
@ -30,7 +30,8 @@ parser.add_argument('--event-name', help='name of event in CI')
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# run yarn affected command
|
# 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
|
# print useful information
|
||||||
@ -44,49 +45,54 @@ print(affected)
|
|||||||
print(">>>> eof debug")
|
print(">>>> eof debug")
|
||||||
|
|
||||||
# define affection actions -> add to projects arrays and generate preview link
|
# define affection actions -> add to projects arrays and generate preview link
|
||||||
|
|
||||||
|
|
||||||
def affect_app(app, preview_name=None):
|
def affect_app(app, preview_name=None):
|
||||||
print(f"{app} is affected")
|
print(f"{app} is affected")
|
||||||
projects.append(app)
|
projects.append(app)
|
||||||
if not preview_name:
|
if not preview_name:
|
||||||
preview_name=app
|
preview_name = app
|
||||||
previews[app] = f'https://{preview_name}.{args.branch_slug}.vega.rocks'
|
previews[app] = f'https://{preview_name}.{args.branch_slug}.vega.rocks'
|
||||||
|
|
||||||
|
|
||||||
# check appearance in the affected string for main apps
|
# check appearance in the affected string for main apps
|
||||||
for app in main_apps:
|
for app in main_apps:
|
||||||
if app in affected:
|
if app in affected:
|
||||||
affect_app(app)
|
affect_app(app)
|
||||||
|
|
||||||
# if non of main apps is affected - test all of them
|
# if non of main apps is affected - test all of them
|
||||||
if not projects:
|
if not projects:
|
||||||
for app in main_apps:
|
for app in main_apps:
|
||||||
affect_app(app)
|
affect_app(app)
|
||||||
|
|
||||||
# generate e2e targets
|
# generate e2e targets
|
||||||
projects_e2e = [f'{app}-e2e' for app in projects]
|
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
|
# 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 args.event_name == 'pull_request' or 'develop' in args.github_ref:
|
||||||
if 'multisig-signer' in affected:
|
if 'multisig-signer' in affected:
|
||||||
affect_app('multisig-signer', 'tools')
|
affect_app('multisig-signer', 'tools')
|
||||||
|
|
||||||
# now parse apps that are deployed from develop but don't have previews
|
# now parse apps that are deployed from develop but don't have previews
|
||||||
if 'develop' in args.github_ref:
|
if 'develop' in args.github_ref:
|
||||||
for app in ['static', 'ui-toolkit']:
|
for app in ['static', 'ui-toolkit']:
|
||||||
if app in affected:
|
if app in affected:
|
||||||
projects.append(app)
|
projects.append(app)
|
||||||
|
|
||||||
# if ref is in format release/{env}-{app} then only {app} is deployed
|
# if ref is in format release/{env}-{app} then only {app} is deployed
|
||||||
if 'release' in args.github_ref:
|
if 'release' in args.github_ref:
|
||||||
for app in main_apps:
|
for app in main_apps:
|
||||||
if f'{args.github_ref}'.endswith(app):
|
if f'{args.github_ref}'.endswith(app):
|
||||||
projects = [app]
|
projects = [app]
|
||||||
projects_e2e = [f'{app}-e2e']
|
projects_e2e = [f'{app}-e2e']
|
||||||
|
|
||||||
|
|
||||||
projects = json.dumps(projects)
|
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)
|
projects_e2e = json.dumps(projects_e2e)
|
||||||
|
|
||||||
print(f'Projects: {projects}')
|
print(f'Projects: {projects}')
|
||||||
@ -94,20 +100,20 @@ print(f'Projects E2E: {projects_e2e}')
|
|||||||
|
|
||||||
print('>> Previews')
|
print('>> Previews')
|
||||||
for preview, preview_value in previews.items():
|
for preview, preview_value in previews.items():
|
||||||
print(f'{preview}: {preview_value}')
|
print(f'{preview}: {preview_value}')
|
||||||
print('>> EOF Previews')
|
print('>> EOF Previews')
|
||||||
|
|
||||||
|
|
||||||
lines_to_write = [
|
lines_to_write = [
|
||||||
f'PREVIEW_GOVERNANCE={previews["governance"]}',
|
f'PREVIEW_GOVERNANCE={previews["governance"]}',
|
||||||
f'PREVIEW_EXPLORER={previews["explorer"]}',
|
f'PREVIEW_EXPLORER={previews["explorer"]}',
|
||||||
f'PREVIEW_TRADING={previews["trading"]}',
|
f'PREVIEW_TRADING={previews["trading"]}',
|
||||||
f'PREVIEW_TOOLS={previews["tools"]}',
|
f'PREVIEW_TOOLS={previews["tools"]}',
|
||||||
f'PROJECTS={projects}',
|
f'PROJECTS={projects}',
|
||||||
f'PROJECTS_E2E={projects_e2e}',
|
f'PROJECTS_E2E={projects_e2e}',
|
||||||
]
|
]
|
||||||
env_file = environ['GITHUB_ENV']
|
env_file = environ['GITHUB_ENV']
|
||||||
print(f'Line to add to GITHUB_ENV file: {env_file}')
|
print(f'Line to add to GITHUB_ENV file: {env_file}')
|
||||||
print(lines_to_write)
|
print(lines_to_write)
|
||||||
with open(env_file, 'a') as _f:
|
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