chore(trading): back merge run market sim on main (#6103)

This commit is contained in:
Ben 2024-03-26 14:21:05 +01:00 committed by GitHub
parent 6d4d0d548e
commit 5f8c725c5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 83 additions and 9 deletions

View File

@ -57,15 +57,14 @@ jobs:
#----------------------------------------------
- name: Build trading app
run: |
yarn env-cmd -f ./apps/trading/.env.stagnet1 yarn nx export trading
ENV_NAME="${{ needs.console-test-branch.outputs.console-branch == 'main' && 'mainnet' || 'stagnet1' }}"
yarn env-cmd -f ./apps/trading/.env.$ENV_NAME yarn nx export trading
DIST_LOCATION=dist/apps/trading/exported
mv $DIST_LOCATION dist-result
tree dist-result
#----------------------------------------------
# export trading app docker image
#----------------------------------------------
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@ -78,7 +77,7 @@ jobs:
load: true
build-args: |
APP=trading
ENV_NAME=stagnet1
ENV_NAME=${{ needs.console-test-branch.outputs.console-branch == 'main' && 'mainnet' || 'stagnet1' }}
tags: ci/trading:local
outputs: type=docker,dest=/tmp/console-image.tar
@ -182,12 +181,22 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
#----------------------------------------------
# Set up pyproject.toml based on branch
#----------------------------------------------
- name: Create pyproject.toml based on branch
run: |
if [ "${{ needs.console-test-branch.outputs.console-branch }}" = "main" ]; then
mv pyproject.main.toml pyproject.toml
elif [ "${{ needs.console-test-branch.outputs.console-branch }}" = "develop" ]; then
mv pyproject.develop.toml pyproject.toml
fi
working-directory: apps/trading/e2e
#----------------------------------------------
# install python dependencies
#----------------------------------------------
- name: Install dependencies
run: poetry install --no-interaction --no-root
run: poetry lock && poetry install --no-interaction --no-root
working-directory: apps/trading/e2e
#----------------------------------------------
# install vega binaries

1
.gitignore vendored
View File

@ -58,5 +58,6 @@ __pycache__/
apps/trading/e2e/logs/
apps/trading/e2e/.pytest_cache/
apps/trading/e2e/traces/
apps/trading/e2e/pyproject.toml
.nx/

View File

@ -1,3 +1,4 @@
CONSOLE_IMAGE_NAME=vegaprotocol/trading:latest
VEGA_VERSION=v0.75.1
LOCAL_SERVER=false
VEGA_ENV=STAGNET1

View File

@ -1,3 +1,4 @@
CONSOLE_IMAGE_NAME=vegaprotocol/trading:develop
VEGA_VERSION=v0.75.1
LOCAL_SERVER=false
VEGA_ENV=STAGNET1

View File

@ -1,3 +1,4 @@
CONSOLE_IMAGE_NAME=vegaprotocol/trading:main
VEGA_VERSION=v0.74.10
LOCAL_SERVER=false
VEGA_ENV=MAINNET

View File

@ -153,10 +153,13 @@ def init_page(vega: VegaServiceNull, browser: Browser, request: pytest.FixtureRe
raise e
# Set window._env_ so built app uses datanode from vega market sim
load_dotenv()
vega_env = os.getenv('VEGA_ENV')
env = json.dumps(
{
"VEGA_URL": f"http://localhost:{vega.data_node_rest_port}/graphql",
"VEGA_WALLET_URL": f"http://localhost:{vega.wallet_port}",
"VEGA_ENV": vega_env,
}
)
window_env = f"window._env_ = Object.assign({{}}, window._env_, {env})"

View File

@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
[[package]]
name = "certifi"
@ -1166,7 +1166,7 @@ profile = ["pytest-profiling", "snakeviz"]
type = "git"
url = "https://github.com/vegaprotocol/vega-market-sim.git/"
reference = "HEAD"
resolved_reference = "c7685cf9eacd829dceab34f9ebe79c125b127a97"
resolved_reference = "b2b4cd004800ba2732448f329b0fa8f0746d4d0b"
[[package]]
name = "websocket-client"

View File

@ -0,0 +1,29 @@
[tool.poetry]
name = "trading market-sim e2e"
version = "0.1.0"
description = ""
authors = ["Matthew Russell <mattrussell36@gmail.com>"]
readme = "README.md"
packages = [{include = "trading market-sim e2e"}]
[tool.poetry.dependencies]
python = ">=3.9,<3.11"
psutil = "^5.9.5"
pytest-playwright = "^0.4.2"
docker = "^6.1.3"
pytest-xdist = "^3.3.1"
python-dotenv = "^1.0.0"
vega-sim = { git = "https://github.com/vegaprotocol/vega-market-sim.git/" }
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
log_cli = true
log_cli_format = "%(asctime)s - %(name)s - %(levelname)s: %(message)s"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
log_cli_level = "INFO"
log_file_format = "%(asctime)s - %(name)s - %(levelname)s: %(message)s"
log_file_date_format = "%Y-%m-%d %H:%M:%S"
log_file_level = "INFO"

View File

@ -0,0 +1,29 @@
[tool.poetry]
name = "trading market-sim e2e"
version = "0.1.0"
description = ""
authors = ["Matthew Russell <mattrussell36@gmail.com>"]
readme = "README.md"
packages = [{include = "trading market-sim e2e"}]
[tool.poetry.dependencies]
python = ">=3.9,<3.11"
psutil = "^5.9.5"
pytest-playwright = "^0.4.2"
docker = "^6.1.3"
pytest-xdist = "^3.3.1"
python-dotenv = "^1.0.0"
vega-sim = { git = "https://github.com/vegaprotocol/vega-market-sim.git/", branch = "release/vega-v0.74.10" }
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
log_cli = true
log_cli_format = "%(asctime)s - %(name)s - %(levelname)s: %(message)s"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
log_cli_level = "INFO"
log_file_format = "%(asctime)s - %(name)s - %(levelname)s: %(message)s"
log_file_date_format = "%Y-%m-%d %H:%M:%S"
log_file_level = "INFO"

View File

@ -9,11 +9,11 @@ packages = [{include = "trading market-sim e2e"}]
[tool.poetry.dependencies]
python = ">=3.9,<3.11"
psutil = "^5.9.5"
vega-sim = {git = "https://github.com/vegaprotocol/vega-market-sim.git/"}
pytest-playwright = "^0.4.2"
docker = "^6.1.3"
pytest-xdist = "^3.3.1"
python-dotenv = "^1.0.0"
vega-sim = { git = "https://github.com/vegaprotocol/vega-market-sim.git/" }
[build-system]
requires = ["poetry-core"]