diff --git a/.github/workflows/console-test-run.yml b/.github/workflows/console-test-run.yml index 5a51bebbf..02a29e334 100644 --- a/.github/workflows/console-test-run.yml +++ b/.github/workflows/console-test-run.yml @@ -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 diff --git a/.gitignore b/.gitignore index 9cd427913..36af10d23 100644 --- a/.gitignore +++ b/.gitignore @@ -58,5 +58,6 @@ __pycache__/ apps/trading/e2e/logs/ apps/trading/e2e/.pytest_cache/ apps/trading/e2e/traces/ +apps/trading/e2e/pyproject.toml .nx/ diff --git a/apps/trading/e2e/.env b/apps/trading/e2e/.env index 18fdedc02..1c625731d 100644 --- a/apps/trading/e2e/.env +++ b/apps/trading/e2e/.env @@ -1,3 +1,4 @@ CONSOLE_IMAGE_NAME=vegaprotocol/trading:latest VEGA_VERSION=v0.75.1 LOCAL_SERVER=false +VEGA_ENV=STAGNET1 diff --git a/apps/trading/e2e/.env.develop b/apps/trading/e2e/.env.develop index bd59c02ba..6f305c9c2 100644 --- a/apps/trading/e2e/.env.develop +++ b/apps/trading/e2e/.env.develop @@ -1,3 +1,4 @@ CONSOLE_IMAGE_NAME=vegaprotocol/trading:develop VEGA_VERSION=v0.75.1 LOCAL_SERVER=false +VEGA_ENV=STAGNET1 \ No newline at end of file diff --git a/apps/trading/e2e/.env.main b/apps/trading/e2e/.env.main index 829921752..c005265f0 100644 --- a/apps/trading/e2e/.env.main +++ b/apps/trading/e2e/.env.main @@ -1,3 +1,4 @@ CONSOLE_IMAGE_NAME=vegaprotocol/trading:main VEGA_VERSION=v0.74.10 LOCAL_SERVER=false +VEGA_ENV=MAINNET \ No newline at end of file diff --git a/apps/trading/e2e/conftest.py b/apps/trading/e2e/conftest.py index fa9c4477a..1f7e3ef7e 100644 --- a/apps/trading/e2e/conftest.py +++ b/apps/trading/e2e/conftest.py @@ -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})" diff --git a/apps/trading/e2e/poetry.lock b/apps/trading/e2e/poetry.lock index 9cd48c2f9..6cf748905 100644 --- a/apps/trading/e2e/poetry.lock +++ b/apps/trading/e2e/poetry.lock @@ -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" diff --git a/apps/trading/e2e/pyproject.develop.toml b/apps/trading/e2e/pyproject.develop.toml new file mode 100644 index 000000000..43910257a --- /dev/null +++ b/apps/trading/e2e/pyproject.develop.toml @@ -0,0 +1,29 @@ +[tool.poetry] +name = "trading market-sim e2e" +version = "0.1.0" +description = "" +authors = ["Matthew Russell "] +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" diff --git a/apps/trading/e2e/pyproject.main.toml b/apps/trading/e2e/pyproject.main.toml new file mode 100644 index 000000000..c1196b8ea --- /dev/null +++ b/apps/trading/e2e/pyproject.main.toml @@ -0,0 +1,29 @@ +[tool.poetry] +name = "trading market-sim e2e" +version = "0.1.0" +description = "" +authors = ["Matthew Russell "] +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" diff --git a/apps/trading/e2e/pyproject.toml b/apps/trading/e2e/pyproject.toml index 244aa1379..43910257a 100644 --- a/apps/trading/e2e/pyproject.toml +++ b/apps/trading/e2e/pyproject.toml @@ -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"]