chore(ci): separate export docker image job in console-test workflow (#4980)
This commit is contained in:
parent
63a6e4ecbd
commit
f433a030ff
102
.github/workflows/console-test-run.yml
vendored
102
.github/workflows/console-test-run.yml
vendored
@ -16,9 +16,9 @@ on:
|
|||||||
- develop
|
- develop
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-tests:
|
create-docker-image:
|
||||||
name: run-tests
|
name: Create docker image for console-test
|
||||||
runs-on: 8-cores
|
runs-on: ubuntu-22.04
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
@ -55,23 +55,68 @@ jobs:
|
|||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# build trading
|
# build trading
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Build affected spec
|
- name: Build trading app
|
||||||
run: |
|
run: |
|
||||||
yarn env-cmd -f ./apps/trading/.env.stagnet1 yarn nx export trading
|
yarn env-cmd -f ./apps/trading/.env.stagnet1 yarn nx export trading
|
||||||
|
DIST_LOCATION=dist/apps/trading/exported
|
||||||
|
mv $DIST_LOCATION dist-result
|
||||||
|
tree dist-result
|
||||||
|
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# run trading server
|
# export trading app docker image
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Run trading server
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and export to local Docker
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: docker/node-outside-docker.Dockerfile
|
||||||
|
load: true
|
||||||
|
build-args: |
|
||||||
|
APP=trading
|
||||||
|
ENV_NAME=stagnet1
|
||||||
|
tags: ci/trading:local
|
||||||
|
outputs: type=docker,dest=/tmp/console-image.tar
|
||||||
|
|
||||||
|
- name: Verify docker image created
|
||||||
run: |
|
run: |
|
||||||
docker run -d -p 80:4200 -v $PWD/docker/nginx.conf:/etc/nginx/conf.d/default.conf -v $PWD/dist/apps/trading/exported:/usr/share/nginx/html nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629
|
echo ${{ steps.docker_build.outputs.digest }}
|
||||||
sleep 5
|
echo ${{ steps.docker_build.outputs.imageid }}
|
||||||
docker ps
|
|
||||||
|
- name: Upload docker image for console-test usage
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: console-image
|
||||||
|
path: /tmp/console-image.tar
|
||||||
|
|
||||||
|
run-tests:
|
||||||
|
name: run-tests
|
||||||
|
runs-on: 8-cores
|
||||||
|
needs: create-docker-image
|
||||||
|
timeout-minutes: 20
|
||||||
|
steps:
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# check if container persists between runs
|
# load docker image
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Check server
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Download docker image from previous job
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: console-image
|
||||||
|
path: /tmp
|
||||||
|
|
||||||
|
- name: Load Docker image
|
||||||
run: |
|
run: |
|
||||||
docker ps
|
docker load --input /tmp/console-image.tar
|
||||||
|
docker image ls -a
|
||||||
|
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# check-out tests repo
|
# check-out tests repo
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
@ -80,45 +125,54 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repository: vegaprotocol/console-test
|
repository: vegaprotocol/console-test
|
||||||
ref: ${{ inputs.console-test-branch }}
|
ref: ${{ inputs.console-test-branch }}
|
||||||
path: './console-test'
|
|
||||||
|
|
||||||
- name: Load console test envs
|
- name: Load console test envs
|
||||||
id: console-test-env
|
id: console-test-env
|
||||||
uses: falti/dotenv-action@v1.0.4
|
uses: falti/dotenv-action@v1.0.4
|
||||||
with:
|
with:
|
||||||
path: './console-test/.env.${{ inputs.console-test-branch }}'
|
path: '.env.${{ inputs.console-test-branch }}'
|
||||||
export-variables: true
|
export-variables: true
|
||||||
keys-case: upper
|
keys-case: upper
|
||||||
log-variables: true
|
log-variables: true
|
||||||
|
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# install dependencies if cache does not exist
|
# ----- Setup python -----
|
||||||
|
#----------------------------------------------
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
#----------------------------------------------
|
||||||
|
# ----- install & configure poetry -----
|
||||||
|
#----------------------------------------------
|
||||||
|
- name: Install Poetry
|
||||||
|
uses: snok/install-poetry@v1
|
||||||
|
with:
|
||||||
|
virtualenvs-create: true
|
||||||
|
virtualenvs-in-project: true
|
||||||
|
virtualenvs-path: .venv
|
||||||
|
|
||||||
|
#----------------------------------------------
|
||||||
|
# install python dependencies
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
working-directory: ./console-test
|
|
||||||
run: poetry install --no-interaction --no-root
|
run: poetry install --no-interaction --no-root
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# install vega binaries
|
# install vega binaries
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Install vega binaries
|
- name: Install vega binaries
|
||||||
working-directory: ./console-test
|
|
||||||
run: poetry run python -m vega_sim.tools.load_binaries --force --version ${{ env.VEGA_VERSION }}
|
run: poetry run python -m vega_sim.tools.load_binaries --force --version ${{ env.VEGA_VERSION }}
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# install playwright
|
# install playwright
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: install playwright
|
- name: install playwright
|
||||||
run: poetry run playwright install --with-deps chromium
|
run: poetry run playwright install --with-deps chromium
|
||||||
working-directory: ./console-test
|
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# run tests
|
# run tests
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
working-directory: ./console-test
|
run: CONSOLE_IMAGE_NAME=ci/trading:local poetry run pytest -v -s --numprocesses 4 --dist loadfile --durations=15
|
||||||
run: poetry run pytest -v -s --numprocesses 4 --dist loadfile --durations=15
|
|
||||||
- name: Check files
|
|
||||||
run: |
|
|
||||||
ls -al .
|
|
||||||
ls -al console-test
|
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# upload traces
|
# upload traces
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user