Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
put all tests together
Browse files Browse the repository at this point in the history
Improve test framework with scanAccounts and signOperation capability
  • Loading branch information
gre committed Jan 13, 2020
1 parent dabbaf4 commit d9071e2
Show file tree
Hide file tree
Showing 67 changed files with 3,688 additions and 4,367 deletions.
137 changes: 115 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,155 @@ workflows:
version: 2
build-test-lint:
jobs:
- mac
- debian
# - ios
# - android
- mac-main-tests
# - debian-cli-tests

jobs:
mac:
ios:
working_directory: ~/live-common
macos:
xcode: "11.3.0"
steps:
- run:
name: pre-start simulator
command: xcrun instruments -w "iPhone X (12.4)" || true
- checkout
- run:
name: "versions"
command: |
node -v
yarn -v
ruby -v
- run:
name: Install all
command: |
yarn install
cd mobile-test-app
bundle install
yarn
cd ios && bundle exec pod install
- run:
name: run tests
command: cd mobile-test-app && yarn ios:test
no_output_timeout: 1h

android:
working_directory: ~/live-common
docker:
- image: circleci/android:api-28-node
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout

- run:
name: Show list of system-images
command: sdkmanager --list --verbose | grep system-images

- run:
name: Setup emulator
command: |
sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
echo "no" | avdmanager create avd -n test -k "system-images;android-25;google_apis;armeabi-v7a"
- run:
name: Launch emulator
command: |
export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib
emulator -avd test -noaudio -no-boot-anim -no-window
background: true

- run:
name: "versions"
command: |
node -v
yarn -v
ruby -v
- restore_cache:
name: Restore Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}-{{ checksum "mobile-test-app/Gemfile.lock" }}
- run:
name: Install Dependencies
command: |
yarn install --frozen-lockfile
cd mobile-test-app
bundle install
yarn
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}-{{ checksum "mobile-test-app/Gemfile.lock" }}
paths:
- ~/.cache/yarn

- run:
name: run tests
command: cd mobile-test-app && yarn android:build

mac-main-tests:
working_directory: ~/live-common
macos:
xcode: "10.2.1"
steps:
- checkout
- run: node -v
- run:
name: "versions"
command: |
node -v
yarn -v
- run:
name: Install Dependencies
command: |
yarn global add yalc codecov
yarn install --frozen-lockfile
- run: yarn global add yalc codecov
cd cli
yarn --frozen-lockfile
cd -
yarn ci-setup-cli
- run: yarn ci-lint
- run: yarn ci-test-common && npx codecov
- run:
command: yarn ci-test-cli
no_output_timeout: 1h

debian:
debian-cli-tests:
working_directory: ~/live-common
docker:
- image: circleci/node:8-stretch-browsers
- image: circleci/node:12-stretch
steps:
- run: sudo apt-get update
# - run: sudo apt-get update
- run: sudo apt-get install -y libudev-dev libusb-1.0-0-dev jq
# - run:
# name: Install latest yarn
# command: |
# curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - ;
# echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list ;
# sudo apt-get update && sudo apt-get install yarn
# sudo rm /usr/local/bin/yarn # remove docker yarn
- checkout
- run:
name: Install latest yarn
name: "versions"
command: |
curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - ;
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list ;
sudo apt-get update && sudo apt-get install yarn
sudo rm /usr/local/bin/yarn # remove docker yarn
- checkout

node -v
yarn -v
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- yarn-packages-{{ checksum "yarn.lock" }}-with-cli-{{ checksum "cli/yarn.lock" }}
- run:
name: Install Dependencies
command: |
yarn global add yalc codecov
yarn install --frozen-lockfile
cd cli
yarn --frozen-lockfile
cd -
yarn ci-setup-cli
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
key: yarn-packages-{{ checksum "yarn.lock" }}-with-cli-{{ checksum "cli/yarn.lock" }}
paths:
- ~/.cache/yarn

- run: yarn ci-lint
- run: yarn ci-test-common && npx codecov
- run:
command: yarn ci-test-cli
no_output_timeout: 1h
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
src/__tests__
src/partners/icons/*/*.js
src/data/icons

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
libcoredb/

dbdata
tmp
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.14.1
1 change: 0 additions & 1 deletion cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
lib/
dbdata/
libcoredb/
cli/.yalc/@ledgerhq/live-common/
cli/yalc.lock
src/commands-index.js
33 changes: 12 additions & 21 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@ledgerhq/hw-transport-mocker": "5.3.0",
"@ledgerhq/hw-transport-node-ble": "5.3.0",
"@ledgerhq/hw-transport-node-hid": "5.3.0",
"@ledgerhq/ledger-core": "5.1.0",
"@ledgerhq/live-common": "^11.0.0-rc.0",
"@ledgerhq/ledger-core": "5.2.0",
"@ledgerhq/live-common": "rc",
"@ledgerhq/logs": "5.3.0",
"asciichart": "^1.5.9",
"axios": "0.19.0",
Expand Down Expand Up @@ -46,29 +46,20 @@
"prepublishOnly": "rm -rf lib && babel --ignore __tests__ -d lib src",
"watch": "babel -wsd lib src",
"flow": "flow",
"test-jest": "rm -rf libcoredb && mkdir libcoredb && jest --maxWorkers 10",
"test-e2e": "./scripts/tests.sh",
"test": "yarn run test-jest && yarn run test-e2e",
"test": "yarn run test-e2e",
"testOne": "./scripts/testOne.sh",
"createTest": "./scripts/createTest.sh"
},
"devDependencies": {
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-export-default-from": "^7.5.2",
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-import-meta": "^7.2.0",
"@babel/preset-env": "^7.7.7",
"@babel/preset-flow": "^7.0.0",
"babel-jest": "^24.9.0",
"jest": "^24.9.0"
},
"jest": {
"testPathIgnorePatterns": [
".yalc",
"lib/"
]
"@babel/cli": "^7.8.0",
"@babel/core": "^7.8.0",
"@babel/plugin-proposal-class-properties": "^7.8.0",
"@babel/plugin-proposal-export-default-from": "^7.8.0",
"@babel/plugin-proposal-export-namespace-from": "^7.8.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.0",
"@babel/plugin-syntax-import-meta": "^7.8.0",
"@babel/preset-env": "^7.8.2",
"@babel/preset-flow": "^7.8.0"
}
}
4 changes: 3 additions & 1 deletion cli/scripts/testOne.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ fi
if [ -d "./expected" ]; then
diff ./output ./expected
if [ $? -ne 0 ]; then
tail -300 $VERBOSE_FILE
echo "$name: Unexpected result."
echo "--- recent logs ---"
tail $VERBOSE_FILE
echo "$name: FAILED."
exit 1
fi
fi
Expand Down
Loading

0 comments on commit d9071e2

Please sign in to comment.