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: create-docker-image: name: Create docker image for console-test runs-on: ubuntu-22.04 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 trading app run: | 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 #---------------------------------------------- # export trading app docker image #---------------------------------------------- - 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: | echo ${{ steps.docker_build.outputs.digest }} echo ${{ steps.docker_build.outputs.imageid }} - 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: #---------------------------------------------- # load docker image #---------------------------------------------- - 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: | docker load --input /tmp/console-image.tar docker image ls -a #---------------------------------------------- # check-out tests repo #---------------------------------------------- - name: Checkout console test repo uses: actions/checkout@v3 with: repository: vegaprotocol/console-test ref: ${{ inputs.console-test-branch }} - name: Load console test envs id: console-test-env uses: falti/dotenv-action@v1.0.4 with: path: '.env.${{ inputs.console-test-branch }}' export-variables: true keys-case: upper log-variables: true #---------------------------------------------- # ----- 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 run: poetry install --no-interaction --no-root #---------------------------------------------- # install vega binaries #---------------------------------------------- - name: Install vega binaries 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 #---------------------------------------------- # run tests #---------------------------------------------- - name: Run tests run: CONSOLE_IMAGE_NAME=ci/trading:local poetry run pytest -v -s --numprocesses 4 --dist loadfile --durations=15 #---------------------------------------------- # 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