Skip to content

Commit

Permalink
Enabling linux .deb builds (ethereum#3914)
Browse files Browse the repository at this point in the history
* Temporarily disabling tests, so we skip to the build process

* Enabling .deb builds

* Adding gulp verify-artifacts

* Add gulp task to pipeline

* Re-enabling tests on Travis

* unzip package naming

* Removing node-unzip-2 from package.json (already included in subdependency)

* Using ethereum-client-binaries from npm instead of github
  • Loading branch information
evertonfraga authored May 31, 2018
1 parent 69fdcbb commit b254a92
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 12 deletions.
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ script:
# build mist
- if [[ $GULP_PLATFORM == "mac" ]]; then travis_wait 60 gulp --$GULP_PLATFORM; fi # increase timeout for slower mac builds
- if [[ $GULP_PLATFORM != "mac" ]]; then gulp --$GULP_PLATFORM; fi

# assert creation of Mist artifacts
- gulp verify-artifacts --mist --$GULP_PLATFORM

# build wallet if on master branch
# build wallet if on master branch
- if [[ $TRAVIS_BRANCH == "master" ]]; then travis_wait 60 gulp --wallet --$GULP_PLATFORM; fi

# debug purposes - see what builds were successfully created
- ls -la ~/build/ethereum/mist/dist_mist/dist
# assert creation of Wallet artifacts
- if [[ $TRAVIS_BRANCH == "master" ]]; then gulp verify-artifacts --wallet --$GULP_PLATFORM; fi

# prepare integration tests
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; sleep 3; fi

# currently, tests should run in linux and mac
- if [[ $GULP_PLATFORM != "win" ]]; then gulp test; fi

Expand Down
2 changes: 1 addition & 1 deletion gulpTasks/building.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ gulp.task('build-dist', cb => {
linux: {
category: 'WebBrowser',
icon: `./app/${type}/icons`,
target: ['zip']
target: ['zip', 'deb']
},
win: {
target: ['zip']
Expand Down
83 changes: 83 additions & 0 deletions gulpTasks/testing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const gulp = require('gulp');
const mocha = require('gulp-spawn-mocha');
const options = require('../gulpfile.js').options;
const { version } = require('../package.json');
const fs = require('fs');
const colors = require('colors/safe');

gulp.task('test', () => {
return gulp.src([`./tests/${options.type}/${options.test}.test.js`]).pipe(
Expand All @@ -12,3 +15,83 @@ gulp.task('test', () => {
})
);
});

gulp.task('verify-artifacts', done => {
// I don't like having a non-pure function here
const fileExists = path => {
const fileExist = fs.existsSync(path);
if (fileExist) console.log(colors.green('\t✔︎', path));
else console.error(colors.red('\t✕', path));

return fileExist;
};

const makePath = productName => `./dist_${productName}/release/`;

const dashedVersion = versionString => versionString.replace(/\./g, '-');

const makeFilename = productName => version => kind => extension =>
`${makePath(productName)}${[
productNamePrefix(productName),
kind,
dashedVersion(version)
].join('-')}.${extension}`;

// need to run .map().every() to display all files status, regardless of optimizations
const allFilesExists = files => files.map(fileExists).every(f => f);

// should be 'mist' or 'wallet'
const productNamePrefix = productName =>
productName == 'mist' ? 'Mist' : 'Ethereum-Wallet';

const checkArtifactsLinux = filenameFragment =>
allFilesExists([
filenameFragment('linux32')('zip'),
filenameFragment('linux64')('zip'),
filenameFragment('linux32')('deb'),
filenameFragment('linux64')('deb')
]);

const checkArtifactsWindows = filenameFragment =>
allFilesExists([
filenameFragment('win32')('zip'),
filenameFragment('win64')('zip'),
filenameFragment('installer')('exe')
]);

const checkArtifactsMac = filenameFragment =>
allFilesExists([filenameFragment('macosx')('dmg')]);

const checkArtifacts = platform => productName => version => {
const filenameFragment = makeFilename(productName)(version);
switch (platform) {
case 'linux':
return checkArtifactsLinux(filenameFragment);
case 'win':
return checkArtifactsWindows(filenameFragment);
case 'mac':
return checkArtifactsMac(filenameFragment);
default:
return false;
}
};

// mist, wallet
const product = options.type;

// win, mac, linux
const platforms = options.activePlatforms;

console.log(colors.yellow('Checking for generated artifacts...'));
const artifactsAssertion = platforms.map(platform =>
checkArtifacts(platform)(product)(version)
);

if (artifactsAssertion.every(a => a)) {
done();
} else {
done(
'One or all artifacts does not exist or does not have a proper file name.'
);
}
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"chai-string": "^1.3.0",
"electron-redux": "^1.3.1",
"electron-window-state": "^4.0.1",
"ethereum-client-binaries": "ethereum/ethereum-client-binaries",
"ethereum-client-binaries": "^1.6.4",
"ethereum-keyfile-recognizer": "^1.0.2",
"ethereumjs-abi": "^0.6.3",
"ethereumjs-tx": "^1.3.3",
Expand Down Expand Up @@ -64,6 +64,7 @@
"devDependencies": {
"chai": "^4.1.1",
"co-mocha": "^1.2.0",
"colors": "^1.3.0",
"del": "^3.0.0",
"ecstatic": "^2.1.0",
"electron": "1.8.4",
Expand All @@ -85,7 +86,6 @@
"json-structure-diff": "^0.0.2",
"minimist": "^1.2.0",
"mocha": "^3.2.0",
"node-unzip-2": "^0.2.7",
"prettier": "1.13.2",
"pretty-quick": "^1.4.1",
"redux-mock-store": "^1.3.0",
Expand Down
14 changes: 9 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,10 @@ colors@^1.1.2:
version "1.2.1"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.1.tgz#f4a3d302976aaf042356ba1ade3b1a2c62d9d794"

colors@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.0.tgz#5f20c9fef6945cb1134260aab33bfbdc8295e04e"

[email protected], combined-stream@^1.0.5, combined-stream@~1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818"
Expand Down Expand Up @@ -2610,17 +2614,17 @@ [email protected]:
elliptic "^6.4.0"
xhr-request-promise "^0.1.2"

ethereum-client-binaries@ethereum/ethereum-client-binaries:
ethereum-client-binaries@^1.6.4:
version "1.6.4"
resolved "https://codeload.github.com/ethereum/ethereum-client-binaries/tar.gz/cf435cab290d7b737ca368db7eb9b89d63c41e82"
resolved "https://registry.yarnpkg.com/ethereum-client-binaries/-/ethereum-client-binaries-1.6.4.tgz#c4fcf97e873d6c66f7f33cb501b4059868baaee5"
dependencies:
buffered-spawn "^3.3.2"
got "^6.5.0"
lodash.get "^4.4.2"
lodash.isempty "^4.4.0"
lodash.values "^4.3.0"
mkdirp "^0.5.1"
node-unzip-2 "github:glebdmitriew/node-unzip-2"
node-unzip-2 "^0.2.7"
tmp "0.0.29"

ethereum-common@^0.0.18:
Expand Down Expand Up @@ -5050,9 +5054,9 @@ node-pre-gyp@^0.6.39:
tar "^2.2.1"
tar-pack "^3.4.0"

node-unzip-2@^0.2.7, "node-unzip-2@github:glebdmitriew/node-unzip-2":
node-unzip-2@^0.2.7:
version "0.2.7"
resolved "https://codeload.github.com/glebdmitriew/node-unzip-2/tar.gz/3702bce9596496bf45442e156541c68eb965b9f9"
resolved "https://registry.yarnpkg.com/node-unzip-2/-/node-unzip-2-0.2.7.tgz#33433d018ded3ca9219e757990cc0b990e4fa51b"
dependencies:
binary "~0.3.0"
fstream "~1.0.10"
Expand Down

0 comments on commit b254a92

Please sign in to comment.