2023-07-28 05:32:07 +00:00
|
|
|
name: (CI) Console tests
|
|
|
|
|
2023-07-12 11:06:48 +00:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
github-sha:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-07-28 05:32:07 +00:00
|
|
|
|
2023-07-12 11:06:48 +00:00
|
|
|
jobs:
|
2023-07-28 05:32:07 +00:00
|
|
|
run-tests:
|
|
|
|
name: run-tests
|
2023-09-07 11:22:01 +00:00
|
|
|
runs-on: console-test
|
2023-08-09 13:18:24 +00:00
|
|
|
timeout-minutes: 20
|
2023-07-12 11:06:48 +00:00
|
|
|
steps:
|
2023-07-28 05:32:07 +00:00
|
|
|
#----------------------------------------------
|
|
|
|
# check-out frontend-monorepo
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Checkout console test repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
ref: ${{ inputs.github-sha }}
|
|
|
|
#----------------------------------------------
|
|
|
|
# cache node modules
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Cache node modules
|
|
|
|
id: cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
|
|
|
# comment out "restore-keys" if you need to rebuild yarn from 0
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-cache-node-modules-
|
|
|
|
#----------------------------------------------
|
|
|
|
# install deps if cache missing
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: yarn install
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
run: yarn install --pure-lockfile
|
|
|
|
#----------------------------------------------
|
|
|
|
# build trading
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Build affected spec
|
|
|
|
run: |
|
|
|
|
yarn env-cmd -f ./apps/trading/.env.stagnet1 yarn nx export trading
|
|
|
|
#----------------------------------------------
|
|
|
|
# run trading server
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Run trading server
|
|
|
|
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
|
|
|
|
sleep 5
|
|
|
|
docker ps
|
|
|
|
#----------------------------------------------
|
|
|
|
# check if container persists between runs
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Check server
|
|
|
|
run: |
|
|
|
|
docker ps
|
|
|
|
#----------------------------------------------
|
|
|
|
# check-out tests repo
|
|
|
|
#----------------------------------------------
|
2023-07-12 11:06:48 +00:00
|
|
|
- name: Checkout console test repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: vegaprotocol/console-test
|
|
|
|
path: './console-test'
|
2023-07-28 05:32:07 +00:00
|
|
|
#----------------------------------------------
|
|
|
|
# install dependencies if cache does not exist
|
|
|
|
#----------------------------------------------
|
2023-07-12 11:06:48 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
working-directory: ./console-test
|
2023-07-28 05:32:07 +00:00
|
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
|
|
run: poetry install --no-interaction --no-root
|
|
|
|
#----------------------------------------------
|
|
|
|
# install vega binaries
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Install vega binaries
|
2023-07-12 11:06:48 +00:00
|
|
|
working-directory: ./console-test
|
2023-07-28 05:32:07 +00:00
|
|
|
run: poetry run python -m vega_sim.tools.load_binaries --force
|
|
|
|
#----------------------------------------------
|
|
|
|
# install playwright
|
|
|
|
#----------------------------------------------
|
2023-07-12 11:06:48 +00:00
|
|
|
- name: install playwright
|
|
|
|
run: poetry run playwright install
|
|
|
|
working-directory: ./console-test
|
2023-07-28 05:32:07 +00:00
|
|
|
#----------------------------------------------
|
|
|
|
# run tests
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Run tests
|
2023-07-12 11:06:48 +00:00
|
|
|
working-directory: ./console-test
|
2023-09-07 11:22:01 +00:00
|
|
|
run: poetry run pytest -v -s --numprocesses 2 --dist loadfile --durations=20
|
2023-07-28 05:32:07 +00:00
|
|
|
- name: Check files
|
|
|
|
run: |
|
|
|
|
ls -al .
|
|
|
|
ls -al console-test
|
|
|
|
#----------------------------------------------
|
|
|
|
# upload traces
|
|
|
|
#----------------------------------------------
|
2023-07-12 11:06:48 +00:00
|
|
|
- name: Upload Playwright Trace
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: playwright-trace
|
|
|
|
path: ./traces/
|
|
|
|
retention-days: 15
|