142 lines
5.0 KiB
YAML
142 lines
5.0 KiB
YAML
name: (CI) Console tests
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
github-sha:
|
|
required: true
|
|
type: string
|
|
workflow_dispatch:
|
|
inputs:
|
|
console-test-branch:
|
|
type: choice
|
|
description: 'main: v0.72.14, develop: v0.73.0-preview7'
|
|
options:
|
|
- main
|
|
- develop
|
|
|
|
jobs:
|
|
run-tests:
|
|
name: run-tests
|
|
runs-on: 8-cores
|
|
timeout-minutes: 20
|
|
steps:
|
|
#----------------------------------------------
|
|
# check-out frontend-monorepo
|
|
#----------------------------------------------
|
|
- name: Checkout frontend-monorepo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ inputs.github-sha || github.sha }}
|
|
#----------------------------------------------
|
|
# cache node modules
|
|
#----------------------------------------------
|
|
- name: setup node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
cache: yarn
|
|
|
|
- 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
|
|
#----------------------------------------------
|
|
- name: Checkout console test repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: vegaprotocol/console-test
|
|
ref: ${{ inputs.console-test-branch }}
|
|
path: './console-test'
|
|
|
|
- name: Load console test envs
|
|
id: console-test-env
|
|
uses: falti/dotenv-action@v1.0.4
|
|
with:
|
|
path: './console-test/.env.${{ inputs.console-test-branch }}'
|
|
export-variables: true
|
|
keys-case: upper
|
|
log-variables: true
|
|
|
|
#----------------------------------------------
|
|
# install dependencies if cache does not exist
|
|
#----------------------------------------------
|
|
- name: Install dependencies
|
|
working-directory: ./console-test
|
|
run: poetry install --no-interaction --no-root
|
|
#----------------------------------------------
|
|
# 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 }}
|
|
#----------------------------------------------
|
|
# install playwright
|
|
#----------------------------------------------
|
|
- name: install playwright
|
|
run: poetry run playwright install --with-deps chromium
|
|
working-directory: ./console-test
|
|
#----------------------------------------------
|
|
# run tests
|
|
#----------------------------------------------
|
|
- name: Run tests
|
|
working-directory: ./console-test
|
|
run: poetry run pytest -v -s --numprocesses 4 --dist loadfile --durations=15
|
|
- name: Check files
|
|
run: |
|
|
ls -al .
|
|
ls -al console-test
|
|
#----------------------------------------------
|
|
# upload traces
|
|
#----------------------------------------------
|
|
- name: Upload Playwright Trace
|
|
uses: actions/upload-artifact@v3
|
|
if: always()
|
|
with:
|
|
name: playwright-trace
|
|
path: ./traces/
|
|
retention-days: 15
|
|
#----------------------------------------------
|
|
# ----- upload logs -----
|
|
#----------------------------------------------
|
|
- name: Upload worker logs
|
|
uses: actions/upload-artifact@v3
|
|
if: always()
|
|
with:
|
|
name: worker-logs
|
|
path: ./logs/
|
|
retention-days: 15
|