Files
trezor-suite/ci/test.yml
2022-07-28 17:50:26 +02:00

307 lines
9.6 KiB
YAML

.run_everything_rules: &run_everything_rules
refs:
- develop
- releases
- schedules
- /^release\//
# @trezor/suite-web
.e2e web:
stage: integration testing
dependencies:
- install
variables:
COMPOSE_PROJECT_NAME: $CI_JOB_ID
COMPOSE_FILE: ./docker/docker-compose.suite-ci.yml
## Tells Cypress where is the index of application
CYPRESS_ASSET_PREFIX: /web
CYPRESS_baseUrl: ${DEV_SERVER_URL}/suite-web/${CI_BUILD_REF_NAME}
## should tests do snapshot testing
# cypress open todo. temporarily turned off (messaging system)
CYPRESS_SNAPSHOT: 0
## reporter url
TRACK_SUITE_URL: https://track-suite.herokuapp.com
## when debugging or developing tests it does not make sense to have retries,
## in other cases retries are useful to avoid occasional failures due to flaky tests
ALLOW_RETRY: 1
before_script:
- docker login $CI_DEPENDENCY_PROXY_SERVER -u $CI_DEPENDENCY_PROXY_USER -p $CI_DEPENDENCY_PROXY_PASSWORD
script:
- yarn install --pure-lockfile --cache-folder .yarn --prefer-offline
- docker-compose pull
- docker-compose up -d ${CONTAINERS}
- docker-compose run test-run
after_script:
- docker cp ${CI_JOB_ID}_trezor-user-env-unix_1:/trezor-user-env/logs/debugging.log trezor-user-env-debugging.log
- docker cp ${CI_JOB_ID}_trezor-user-env-unix_1:/trezor-user-env/logs/emulator_bridge.log tenv-emulator-bridge-debugging.log
- docker cp ${CI_JOB_ID}_trezor-user-env-unix_1:/trezor-user-env/docker/version.txt trezor-user-env-version.txt
- docker-compose down
- docker network prune -f
artifacts:
expire_in: 7 days
when: always
paths:
- ./packages/integration-tests/projects/suite-web/snapshots
- ./packages/integration-tests/projects/suite-web/screenshots
- ./packages/integration-tests/projects/suite-web/videos
- download-snapshots.sh
- trezor-user-env-debugging.log
- tenv-emulator-bridge-debugging.log
- trezor-user-env-version.txt
interruptible: true
.suite web base:
extends: .e2e web
parallel:
matrix:
- TEST_GROUP:
[
"@group:suite",
"@group:onboarding",
"@group:device-management",
"@group:settings",
"@group:metadata",
"@group:passphrase",
]
CONTAINERS: "trezor-user-env-unix"
- TEST_GROUP: "@group:wallet"
CONTAINERS: "trezor-user-env-unix bitcoin-regtest"
# fragile group is dependent on external powers which means it might fail when some external resource
# is modified. We still believe it might be worth having to fix such broken test time to time.
.suite web fragile base:
extends: .e2e web
allow_failure: true # most importantly - when a test in this category fails, it does not make entire pipeline fail
parallel:
matrix:
- TEST_GROUP: "@group:fragile"
CONTAINERS: "trezor-user-env-unix"
suite web:
extends: .suite web base
suite web snapshots:
extends: .suite web base
when: manual
variables:
CYPRESS_SNAPSHOT: 1
CYPRESS_updateSnapshots: 1
suite web fragile:
extends: .suite web fragile base
suite web fragile snapshots:
extends: .suite web fragile base
when: manual
variables:
CYPRESS_SNAPSHOT: 1
CYPRESS_updateSnapshots: 1
# Tests against latest trezor-firmware master
suite web 2-master:
extends: .suite web base
only:
refs:
- schedules
variables:
FIRMWARE: 2-master
suite web 2-master manual:
extends: .suite web base
except:
refs:
- schedules
when: manual
variables:
FIRMWARE: 2-master
# TODO scheduled jobs against beta chrome channel
# TODO scheduled jobs against suite.trezor.io
# @trezor/suite-desktop
.e2e desktop:
stage: integration testing
dependencies:
- install
variables:
COMPOSE_FILE: ./docker/docker-compose.suite-desktop-ci.yml
before_script:
- docker login $CI_DEPENDENCY_PROXY_SERVER -u $CI_DEPENDENCY_PROXY_USER -p $CI_DEPENDENCY_PROXY_PASSWORD
script:
- yarn install --pure-lockfile --cache-folder .yarn --prefer-offline
# 3 next steps could be removed if we passed packages/suite-desktop/dist and build folder as an artifact
# but since this is run only in nightly builds it can be probably built inside the job for now..
- yarn workspace @trezor/suite-data msg-system-sign-config
- yarn workspace @trezor/suite-desktop build:linux
- docker-compose pull
- docker-compose up -d trezor-user-env-unix
- docker-compose run test-run
after_script:
- docker-compose down
- docker network prune -f
artifacts:
expire_in: 7 days
when: always
paths:
- ./packages/integration-tests/projects/suite-desktop/screenshots
interruptible: true
suite desktop:
extends: .e2e desktop
only:
<<: *run_everything_rules
suite desktop manual:
extends: .e2e desktop
except:
<<: *run_everything_rules
when: manual
# @trezor/transport
.e2e transport:
stage: integration testing
variables:
COMPOSE_FILE: ./docker/docker-compose.transport-test.yml
script:
- yarn install --pure-lockfile --cache-folder .yarn --prefer-offline
- yarn workspace @trezor/utils build:lib
- yarn workspace @trezor/transport build:lib
# run e2e tests
- ./docker/docker-transport-test.sh
after_script:
- docker-compose down
- docker network prune -f
interruptible: true
transport:
extends: .e2e transport
only:
<<: *run_everything_rules
transport manual:
extends: .e2e transport
except:
<<: *run_everything_rules
when: manual
# @trezor/connect-popup (via @trezor/connect-explorer)
.e2e connect-popup:
stage: integration testing
variables:
COMPOSE_PROJECT_NAME: $CI_JOB_ID
COMPOSE_FILE: ./docker/docker-compose.connect-popup-ci.yml
URL: ${DEV_SERVER_URL}/connect-explorer/${CI_BUILD_REF_NAME}/
script:
- yarn install --pure-lockfile --cache-folder .yarn --prefer-offline
- docker-compose pull
- docker-compose up -d trezor-user-env-unix
- docker-compose run test-run
after_script:
- docker-compose down
- docker network prune -f
artifacts:
expire_in: 7 days
when: always
paths:
- ./packages/integration-tests/projects/connect-popup/screenshots
- ./packages/integration-tests/connect-popup-overview.html
- ./packages/integration-tests/test-results
interruptible: true
connect-popup:
extends: .e2e connect-popup
# temporary so that it does not block connect beta releases
allow_failure: true
dependencies:
- install
- connect-web build
only:
<<: *run_everything_rules
connect-popup manual:
extends: .e2e connect-popup
needs:
- install
- connect-web build
- connect-explorer deploy dev manual
except:
<<: *run_everything_rules
when: manual
.connect:
stage: integration testing
dependencies:
- install
variables:
COMPOSE_PROJECT_NAME: $CI_JOB_ID
COMPOSE_FILE: ./docker/docker-compose.connect-test.yml
TESTS_INCLUDED_METHODS: $TESTS_INCLUDED_METHODS
TESTS_EXCLUDED_METHODS: $TESTS_EXCLUDED_METHODS
TESTS_PATTERN: $TESTS_PATTERN
TESTS_SCRIPT: yarn workspace @trezor/integration-tests test:connect:${TESTS_ENVIRONMENT}
TESTS_FIRMWARE: $TESTS_FIRMWARE
TESTS_USE_TX_CACHE: $TESTS_MOCK_BACKENDS
TESTS_USE_WS_CACHE: $TESTS_MOCK_BACKENDS
before_script:
- docker-compose down
- docker network prune -f
script:
- git submodule update --init --recursive
- yarn install --pure-lockfile --cache-folder .yarn --prefer-offline
# should not be needed, rather hand over artifacts?
- if [ "$TESTS_ENVIRONMENT" == "web" ]; then yarn workspace @trezor/connect-iframe build; else echo "else"; fi
# should not be needed, rather hand over artifacts?
- if [ "$TESTS_ENVIRONMENT" == "web" ]; then yarn workspace @trezor/connect-web build; else echo "else"; fi
# switch node version for testing.
# todo: nvm is present in base image but not available here
# - sed -i "/\"node\"/d" package.json
# - nvm install ${TESTS_NODE_VERSION}
- docker-compose pull
- docker-compose up -d trezor-user-env-unix
- docker-compose run test-run
after_script:
- docker-compose down
- docker network prune -f
parallel:
matrix:
- TESTS_ENVIRONMENT: ["node", "web"]
TESTS_PATTERN: "init authorizeCoinJoin passphrase"
TESTS_FIRMWARE: ["2-master", "2.2.0"]
# todo:
# TESTS_NODE_VERSION: ["12", "14", "16"]
- TESTS_ENVIRONMENT: ["node", "web"]
TESTS_PATTERN: "methods"
TESTS_FIRMWARE: ["2-master", "2.2.0"]
# todo:
# TESTS_NODE_VERSION: ["12", "14", "16"]
TESTS_INCLUDED_METHODS:
[
"applySettings,applyFlags,getFeatures,getFirmwareHash",
"signTransaction",
"getAccountInfo,getAddress,getPublicKey,signMessage,verifyMessage,composeTransaction,getOwnershipId,getOwnershipProof",
"stellarGetAddress,stellarSignTransaction",
"cardanoGetAddress,cardanoGetNativeScriptHash,cardanoGetPublicKey,cardanoSignTransaction",
"eosGetPublicKey,eosSignTransaction",
"ethereumGetAddress,ethereumGetPublicKey,ethereumSignMessage,ethereumSignTransaction,ethereumVerifyMessage,ethereumSignTypedData",
"nemGetAddress,nemSignTransaction",
"rippleGetAddress,rippleSignTransaction",
"tezosGetAddress,tezosGetPublicKey,tezosSignTransaction",
"binanceGetAddress,binanceGetPublicKey,binanceSignTransaction",
]
TESTS_MOCK_BACKENDS: "false"
interruptible: true
connect:
extends: .connect
only:
refs:
- schedules # only nightly jobs, this is too heavy for develop branches at the moment
connect manual:
extends: .connect
except:
refs:
- schedules
when: manual