Skip to content

Commit

Permalink
Merge pull request #2649 from EdgeApp/william/fix-travis
Browse files Browse the repository at this point in the history
Only use Travis to run code-quality checks
  • Loading branch information
thehobbit85 authored May 26, 2021
2 parents ea98c0d + 6e9ca28 commit 6de5ffa
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 183 deletions.
83 changes: 8 additions & 75 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,11 @@
language: node_js
node_js:
- "10.15.3"
sudo: required
cache:
directories:
- $HOME/.npm
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
- 14
before_install:
- cp env.example.json env.json
install:
- yarn install --frozen-lockfile --ignore-optional --network-concurrency 1
script:
- npm i react-native-cli -g
matrix:
include:
- language: android
os: linux
jdk: oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
sudo: required
node_js: false
before_install:
- nvm install 10.15.3
- nvm use 10.15.3
- node --version
# install NDK
- openssl aes-256-cbc -K $encrypted_e28d423744bc_key -iv $encrypted_e28d423744bc_iv -in env.json.enc -out env.json -d
- git clone https://github.com/Airbitz/android-ndk-linux.git $HOME/android-ndk-root
- export ANDROID_NDK_HOME=$HOME/android-ndk-root
- echo "y" | sdkmanager "cmake;3.6.4111459"
- npm install -g yarn@1.5.1
- echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
install:
- travis_retry yarn install --network-concurrency 1 --child-concurrency 1 --ignore-optional
android:
components:
- tools
- platform-tools
- build-tools-23.0.1
- build-tools-23.0.3
- build-tools-25.0.1
- build-tools-25.0.3
- android-23
- android-25
- android-27
- extra
- extra-android-m2repository
- extra-android-support
- extra-google-google_play_services
- extra-google-m2repository
- addon-google_apis-google-16
- cmake
licenses:
- '.+'
# before_script:
# - npm run precommit
script:
- cd android && ./gradlew assembleDebug && ./gradlew assembleRelease
- language: objective-c
os: osx
osx_image: xcode10.2
node_js: false
before_install:
- nvm install 10.15.3
- nvm use 10.15.3
- node --version
- openssl aes-256-cbc -K $encrypted_e28d423744bc_key -iv $encrypted_e28d423744bc_iv -in env.json.enc -out env.json -d
- npm install -g yarn@1.5.1
install:
- travis_retry gem install xcpretty xcpretty-travis-formatter
- travis_retry yarn install --network-concurrency 1 --child-concurrency 1

xcode_project: ios/edge.xcworkspace
xcode_scheme: ios/edge
script:
- cd ios
- node ../execKeepAlive.js 'xcodebuild -workspace edge.xcworkspace -derivedDataPath build clean build -scheme edge -configuration release -sdk iphonesimulator12.2 CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=""' | xcpretty -f `xcpretty-travis-formatter`
- yarn lint
- yarn flow
- npm run test
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pipeline {

stage ("Test") {
steps {
sh "npm run cover"
sh "JEST_JENKINS=1 yarn cover --ci"
}
}

Expand Down
10 changes: 3 additions & 7 deletions env.example.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"-------- api keys --------": 0,
"AIRBITZ_API_KEY": "",
"BUGSNAG_API_KEY": "",

"-------- GUI plugin options --------": 0,
"PLUGIN_API_KEYS": {
Expand All @@ -22,13 +23,11 @@
"apiKey": ""
},
"x_ETHEREUM_INIT": {
"etherscanApiKey": "",
"etherscanApiKey": [],
"infuraProjectId": "",
"blockchairApiKey": "",
"alethioApiKey": "",
"amberdataApiKey": "",
"alchemyApiKey": "",
"ethGasStationApiKey": ""
"amberdataApiKey": ""
},
"x_FAAST_INIT": {
"affiliateId": "",
Expand All @@ -53,9 +52,6 @@
"affiliateContract": "",
"apiKey": ""
},
"X_COINSWITCH_INIT": {
"apiKey": ""
},
"X_FIO_INIT": {
"fioRegApiToken": ""
},
Expand Down
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
preset: 'react-native',
coverageDirectory: './coverage',
setupFiles: ['./jestSetup.js'],

// Ignore tests in the e2e folder:
testPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/e2e'],

// Don't run node_modules through Babel, except specific ones that still need it:
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(edge-components/|@react-native|react-native|react-navigation))']
}

// Produce junit and cobertura output when on Jenkins:
if (process.env.JEST_JENKINS != null) {
config.coverageReporters = ['html', 'cobertura']
config.reporters = ['default', ['jest-junit', { outputDirectory: './coverage' }]]
}

module.exports = config
10 changes: 4 additions & 6 deletions testSetup.js → jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint-disable flowtype/require-valid-file-annotation */
/* globals jest */

import dateformat from 'dateformat'
import RNPermissionsMock from 'react-native-permissions/mock'
jest.useFakeTimers()

jest.mock('usb', () => {})
jest.mock('react-native-gesture-handler', () => ({
PanGestureHandler() {}
}))

jest.mock('dateformat', () => (number, format) => dateformat(number, format, true)) // force timezone to UTC
// force timezone to UTC
jest.mock('dateformat', () => (number, format) => require('dateformat')(number, format, true))

jest.mock('@react-native-firebase/analytics', () => () => ({
logEvent() {},
Expand Down Expand Up @@ -145,9 +145,7 @@ jest.mock('react-native-localize', () => {
}
})

jest.mock('react-native-permissions', () => {
return RNPermissionsMock
})
jest.mock('react-native-permissions', () => require('react-native-permissions/mock'))

global.__reanimatedWorkletInit = jest.fn()
jest.mock('react-native-reanimated', () => {
Expand Down
36 changes: 3 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"android:logcat": "adb logcat *:S ReactNative:V ReactNativeJS:V",
"android:release": "cd android && ./gradlew assembleRelease; cd ../",
"android:release-install": "npm run android:clean && npm run android:release && adb install android/app/build/outputs/apk/release/app-release.apk",
"cover": "jest --coverage",
"cover": "jest --config jest.config.js --coverage",
"fix": "npm run lint -- --fix",
"flow": "flow",
"flow-coverage": "flow-coverage-report",
Expand All @@ -39,7 +39,7 @@
"prepare": "./prepare-assets.sh",
"server": "node ./loggingServer.js",
"start": "react-native start",
"test": "jest",
"test": "jest --config jest.config.js",
"test-android": "detox build --configuration android.emu.debug && detox test --configuration android.emu.debug -l verbose",
"test-ios": "detox build --configuration ios.sim.debug && detox test --configuration ios.sim.debug",
"test:e2e": "detox test -c ios.sim.debug",
Expand All @@ -55,32 +55,6 @@
"lint-staged": {
"*.{js,jsx}": "eslint"
},
"jest": {
"coverageDirectory": "./coverage",
"coverageReporters": [
"cobertura",
"html"
],
"preset": "react-native",
"reporters": [
"default",
"jest-junit"
],
"setupFiles": [
"./testSetup.js"
],
"testPathIgnorePatterns": [
"node_modules",
"<rootDir>/e2e"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
"^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": "<rootDir>/node_modules/react-native/jest/assetFileTransformer.js"
},
"transformIgnorePatterns": [
"node_modules/mobx-react"
]
},
"resolutions": {
"axios": "0.19.0",
"babel-runtime": "6.26.0",
Expand Down Expand Up @@ -217,7 +191,7 @@
"flow-bin": "^0.84.0",
"husky": "^4.3.0",
"jest": "^26.6.3",
"jest-junit": "^9.0.0",
"jest-junit": "^12.1.0",
"jetifier": "^1.6.5",
"lint-staged": "^10.5.3",
"metro-react-native-babel-preset": "^0.64.0",
Expand Down Expand Up @@ -273,10 +247,6 @@
"json"
]
},
"jest-junit": {
"outputDirectory": "./coverage",
"outputName": "junit.xml"
},
"plugins": [
"edge-plugin-simplex",
"edge-plugin-wyre",
Expand Down
7 changes: 6 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ const production = true
const babelOptions = {
babelrc: false,
presets: ['@babel/preset-env'],
plugins: [['@babel/plugin-transform-for-of', { assumeArray: true }]],
plugins: [
['@babel/plugin-transform-for-of', { assumeArray: true }],
// Work around metro-react-native-babel-preset issue:
['@babel/plugin-proposal-class-properties', { loose: false }]
],

cacheDirectory: true
}

Expand Down
Loading

0 comments on commit 6de5ffa

Please sign in to comment.