fixing travis builds

Summary:
- making website deployment and desktop app builds two different travis jobs, so if one fails, the other is still working
- running website builds on linux, because, we don't need macOS for this
- making dependency installs serial instead of parallel to avoid problems of multiple yarn instances running at the same time
- removing duplicate postinstall script which breaks for electron 3 builds

Reviewed By: passy

Differential Revision: D9148342

fbshipit-source-id: 22f3a0fe59aff066c04fb964621604efc46aab8a
This commit is contained in:
Daniel Büchele
2018-08-03 05:49:41 -07:00
committed by Facebook Github Bot
parent 092484e255
commit 696c73ebc1
3 changed files with 26 additions and 56 deletions

View File

@@ -4,19 +4,13 @@ osx_image: xcode9.4
matrix: matrix:
include: include:
- language: node_js - language: node_js
os: linux
node_js: node_js:
- "8" - "10"
install:
- yarn
- cd website
- yarn
- cd ..
script: script:
- yarn lint
- yarn build --mac --version=$TRAVIS_BUILD_NUMBER
- cd website - cd website
- yarn
- yarn build - yarn build
- cd .. - cd ..
@@ -35,16 +29,10 @@ matrix:
install: install:
- yarn - yarn
- cd website
- yarn
- cd ..
script: script:
- yarn lint - yarn lint
- yarn build --mac --version=$TRAVIS_BUILD_NUMBER - yarn build --mac --version=$TRAVIS_BUILD_NUMBER
- cd website
- yarn build
- cd ..
- language: objective-c - language: objective-c

View File

@@ -78,7 +78,7 @@
"yargs": "^11.0.0" "yargs": "^11.0.0"
}, },
"scripts": { "scripts": {
"postinstall": "node node_modules/electron/install.js && node scripts/yarn-install.js", "postinstall": "node scripts/yarn-install.js",
"rm-dist": "rm -rf dist", "rm-dist": "rm -rf dist",
"rm-modules": "rm -rf node_modules static/node_modules", "rm-modules": "rm -rf node_modules static/node_modules",
"rm-temp": "rm -rf $TMPDIR/jest* $TMPDIR/react-native-packager*", "rm-temp": "rm -rf $TMPDIR/jest* $TMPDIR/react-native-packager*",

View File

@@ -5,9 +5,10 @@
* @format * @format
*/ */
const glob = require('glob');
const path = require('path'); const path = require('path');
const {exec} = require('child_process'); const util = require('util');
const glob = util.promisify(require('glob'));
const exec = util.promisify(require('child_process').exec);
const PACKAGES = ['static', 'src/plugins/*', 'src/fb/plugins/*']; const PACKAGES = ['static', 'src/plugins/*', 'src/fb/plugins/*'];
const WINDOWS = /^win/.test(process.platform); const WINDOWS = /^win/.test(process.platform);
const YARN_PATH = const YARN_PATH =
@@ -16,44 +17,25 @@ const YARN_PATH =
: 'yarn' + (WINDOWS ? '.cmd' : ''); : 'yarn' + (WINDOWS ? '.cmd' : '');
Promise.all( Promise.all(
PACKAGES.map( PACKAGES.map(pattern =>
pattern => glob(path.join(__dirname, '..', pattern, 'package.json')),
new Promise((resolve, reject) => {
glob(
path.join(__dirname, '..', pattern, 'package.json'),
(err, matches) => {
if (err) {
reject(err);
} else {
resolve(matches);
}
},
);
}),
), ),
) )
.then(packages => .then(async packages => {
Promise.all( for (const pkg of packages.reduce((acc, cv) => acc.concat(cv), [])) {
packages.reduce((acc, cv) => acc.concat(cv), []).map( const {stderr} = await exec(YARN_PATH, {
pkg => cwd: pkg.replace('/package.json', ''),
new Promise((resolve, reject) => { });
const cwd = pkg.replace('/package.json', ''); if (stderr) {
exec( console.warn(stderr);
YARN_PATH, } else {
{ console.log(`Installed dependencies for ${pkg}`);
cwd, }
}, }
(err, stderr, stdout) => { })
if (err) {
reject(err);
} else {
resolve(0);
}
},
);
}),
),
),
)
// eslint-disable-next-line // eslint-disable-next-line
.then(() => console.log('📦 Installed all dependencies!')); .then(() => console.log('📦 Installed all plugin dependencies!'))
.catch(err => {
console.error('❌ Installing plugin dependencies failed.');
console.error(err);
});