1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-27 10:48:22 +00:00
trezor-wallet/.gitlab-ci.yml
Vladimir Volek 46fe6d00fc Integration tests (#311)
* Add base test env

* Add eslint rules for cypress

* Add configs and scripts in package json

* Added docker file for bridge and emualator

* Bridge install progress

* Bridge install next step

* Add task for integration tests

* Fixed deps

* Added baseUrl

* Added baseUrl fix

* Added npx

* Added caching for cypress bin

* Added path to binary

* Install cypress

* Finalized dockerfile

* Fixed bridge lib path

* Fixed path for binary

* Adjust script again

* Run all the things properly

* Try to run the tests

* First POC test

* First POC test in gitlab

* Fixed flow

* Fixed gitlab test url, try docker service

* export artifacts

* Test only integration tests in CI

* Test only integration tests in CI 2

* Test only integration tests in CI 3

* Added tests for initialize device

* Try to add docker in only one step

* Turn on other integration steps

* Correct node version

* Ignore cache in flow

* Run bridge and emulator in debug link mode

* Fix param

* Try to run new config in CI

* init device in docker

* Remove docker image after run

* Remove amp

* Fix path

* Artifacts on fail

* Artifacts on fail with volume

* Artifacts on fail with volume 2

* Install mkdir

* Install mkdir again

* test

* test 2

* test 3

* test 4

* test 5

* test 6

* test 7

* test 8

* test 9

* test 10

* test 11

* test 12

* test 13

* test 14

* test 15

* test 16

* test 17

* Revert "test 17"

This reverts commit f3f6c0d690.

* test 18

* test 19

* test 20

* test 21 try chrome

* test 22

* test 23

* test 24

* test 25

* test 25 try to install chrome again

* test 25 try to install chrome again

* Added missing deps

* Added debug

* Install chromium

* Install chromium 2

* turn on chromium

* turn off debug

* turn on debug

* fix folder

* turn off debug

* Fix init device

* Add header dashboard test

* Bring things back

* clean

* clean fix

* Build image in CI

* Added stage step

* Added docker image

* Added service

* Added tests to docker image

* Refactor a bit

* Correct registry image

* Build wallet again

* Add test for dashbaord content

* new node version, more tests

* Remove unused code

* typo

* Correct snapshots, moved deps to dev, beta disclaimer prop
2019-02-05 14:26:40 +01:00

182 lines
4.3 KiB
YAML

image: node:10.15.1
variables:
CYPRESS_CACHE_FOLDER: "$CI_PROJECT_DIR/cache/Cypress"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules
- ${CYPRESS_CACHE_FOLDER}
stages:
- test
- build
- deploy
- integration tests
lint:
stage: test
script:
- yarn install
- yarn run lint
flow:
stage: test
script:
- yarn install
- yarn run flow
unit:
stage: test
script:
- yarn install
- yarn run test
build development:
stage: build
script:
- yarn install
- yarn run build:dev
artifacts:
expire_in: 1 week
paths:
- build/dev
build beta:
stage: build
script:
- yarn install
- yarn run build:beta
only:
- beta
artifacts:
expire_in: 1 week
paths:
- build/beta
- scripts/s3sync.sh
build stable:
stage: build
script:
- yarn install
- yarn run build:stable
only:
- stable
artifacts:
expire_in: 1 week
paths:
- build/stable
- scripts/s3sync.sh
build emulator and bridge image:
variables:
CONTAINER_NAME: "$CI_REGISTRY/emulator-bridge-tests"
image: docker:latest
services:
- docker:dind
before_script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
stage: build
when: manual
script:
- docker pull $CONTAINER_NAME:latest || true
- docker build --cache-from $CONTAINER_NAME:latest --tag $CONTAINER_NAME:$CI_COMMIT_SHA --tag $CONTAINER_NAME:latest .
- docker push $CONTAINER_NAME:$CI_COMMIT_SHA
- docker push $CONTAINER_NAME:latest
deploy review:
stage: deploy
variables:
GIT_STRATEGY: none
dependencies:
- build development
environment:
name: $CI_BUILD_REF_NAME
url: $BASE_REVIEW_URL/$CI_BUILD_REF_NAME
on_stop: delete review
script:
- echo "Deploy a review app"
- '[ -z "${DEPLOY_BASE_DIR}" ] && echo "Deploy base dir cannot be empty" && exit 255'
- env
- mkdir -p "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}"
- echo "Copy dev build to web server ${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}..."
- rsync --delete -va build/dev/ "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}/"
- curl "https://api.telegram.org/bot699197118:AAGXNTaC5Q-ljmy_dMvaIvAKy1XjlkA3Iss/sendMessage?chat_id=-1001354778014&text=https://trezor-wallet-dev.trezor.io/${CI_BUILD_REF_NAME}"
- 'echo "Remove working dir, workaround for cache" && rm -r ./*'
only:
- branches
tags:
- deploy
deploy stage beta:
stage: deploy
variables:
GIT_STRATEGY: none
AWS_ACCESS_KEY_ID: $STAGE_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $STAGE_AWS_SECRET_ACCESS_KEY
when: manual
dependencies:
- build beta
script:
- scripts/s3sync.sh stage beta
only:
- beta
tags:
- deploy
deploy stage stable:
stage: deploy
variables:
GIT_STRATEGY: none
AWS_ACCESS_KEY_ID: $STAGE_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $STAGE_AWS_SECRET_ACCESS_KEY
when: manual
dependencies:
- build stable
script:
- scripts/s3sync.sh stage stable
only:
- stable
tags:
- deploy
delete review:
before_script: []
stage: deploy
variables:
GIT_STRATEGY: none
when: manual
environment:
name: $CI_BUILD_REF_NAME
action: stop
script:
- '[ -z "${DEPLOY_BASE_DIR}" ] && echo "Deploy dir can not be empty" && exit 1'
- '[ -z "${CI_BUILD_REF_NAME}" ] && echo "Build name can not be empty" && exit 1'
- '[ ! -d "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}" ] && echo "Folder can not be found, skipping..." && exit 0'
- 'rm -r "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}"'
only:
- branches
tags:
- deploy
integration tests:
image: docker:latest
services:
- docker:dind
stage: integration tests
script:
- 'export SHARED_PATH="$(dirname ${CI_PROJECT_DIR})/shared"'
- rm -r ${SHARED_PATH} || true
- docker build -t wallet-emulator-bridge-tests .
- mkdir -p ${SHARED_PATH}/trezor-wallet/screenshots
- mkdir -p ${SHARED_PATH}/trezor-wallet/videos
- docker run --volume ${SHARED_PATH}/trezor-wallet/screenshots:/trezor-wallet/test/screenshots --volume ${SHARED_PATH}/trezor-wallet/videos:/trezor-wallet/test/videos --rm wallet-emulator-bridge-tests
- find ${SHARED_PATH}
- mkdir trezor-wallet
- cp -r ${SHARED_PATH}/ trezor-wallet/
artifacts:
when: always
expire_in: 1 week
paths:
- trezor-wallet/