Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
chore/CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterlester committed Dec 5, 2017
1 parent ab1b367 commit c583c27
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@
/demo_app/.idea
/email_app_java/target/
/web_hosting_manager/docs
node_modules
53 changes: 53 additions & 0 deletions .travis.yml
@@ -0,0 +1,53 @@
sudo: required
dist: trusty

os:
- osx
- linux


env:
- NODE_ENV=prod


node_js:
- '7'
cache:
yarn: true
directories:
- node_modules
- app/node_modules
- $HOME/.electron
- $HOME/.cache
language: node_js
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
script:
- yarn install-all
- yarn package-all
before_deploy:
- export EMAIL_APP="$(ls email_app/out/*.zip)";
- export WEB_HOSTING_MANAGER="$(ls web_hosting_manager/release/*.zip)";
- export SHA_256_SUM_EMAIL_APP="$(ls email_app/out/*.txt)";
- export SHA_256_SUM_WHM="$(ls web_hosting_manager/release/*.txt)";
- ls email_app/out
- ls web_hosting_manager/release
- echo "${EMAIL_APP}, ${WEB_HOSTING_MANAGER}, ${SHA_256_SUM_EMAIL_APP}, ${SHA_256_SUM_WHM} being deployed."
deploy:
provider: releases
skip_cleanup: true
api_key: $GITHUB_AUTH_TOKEN
file:
- "${EMAIL_APP}"
- "${WEB_HOSTING_MANAGER}"
- "${SHA_256_SUM_EMAIL_APP}"
- "${SHA_256_SUM_WHM}"
draft: true
prerelease: true
tag_name: $TRAVIS_TAG
on:
tags: true
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -19,5 +19,8 @@ For more details and build-instructions, please check the corresponding folder's
To run a complete package of the email/webhosting apps, (assuming each project has their own dependencies installed) you can run:

* Run `yarn` in the root examples directory
* Run `yarn install-all` to install and build `email_app` and `web_hosting_manager`.
* Use either of the commands below to separately package each app:
* Run `yarn pack:webhosting` to package and zip the app with all required files (to: web_hosting_manager/release).
* Run `yarn pack:email` to package and zip the app with all required files (to: email_app/out).
* Alternatively, run `yarn package-all` to both `email_app` and ``web_hosting_manager`
47 changes: 47 additions & 0 deletions appveyor.yml
@@ -0,0 +1,47 @@
platform:
- x64

image: Visual Studio 2015

environment:
nodejs_version: "7"
matrix:
- NODE_ENV: "prod"
win_runtime: win-x64
arch: x64
plat: win32

install:
- ps: Install-Product node $env:nodejs_version x64
- node --version
- npm --version
- yarn --version
- yarn add windows-build-tools --global
- yarn --ignore-optional


build_script:
- node --version
- yarn --version
- yarn install-all
- yarn package-all


after_build:
- echo %APPVEYOR_REPO_TAG%
- echo %APPVEYOR_REPO_TAG_NAME%
- ps: Get-ChildItem .\email_app\out\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- ps: Get-ChildItem .\web_hosting_manager\release\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- ps: Get-ChildItem .\email_app\out\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- ps: Get-ChildItem .\web_hosting_manager\release\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }


deploy:
release: $(appveyor_repo_tag_name)
tag: $(appveyor_repo_tag_name)
provider: GitHub
auth_token: $(github_auth_token)
draft: true
prerelease: true
on:
appveyor_repo_tag: true # deploy on tag push only
2 changes: 1 addition & 1 deletion email_app/package.json
Expand Up @@ -19,7 +19,7 @@
"start": "electron-forge start",
"start-hot": "cross-env HOT=1 NODE_ENV=development electron -r babel-register -r babel-polyfill ./main.development",
"package": "electron-forge package",
"post-package": "node ../post-packaging.js",
"post-package": "node ../post-packaging.js -e email_app",
"package-all": "npm run package -- --all",
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
"dev": "concurrently --kill-others \"npm run hot-server\" \"npm run start-hot\"",
Expand Down
10 changes: 6 additions & 4 deletions package.json
Expand Up @@ -5,13 +5,15 @@
"main": "index.js",
"repository": "git@github.com:maidsafe/safe_examples.git",
"scripts": {
"install-all": "cd email_app && yarn && cd .. && cd web_hosting_manager && yarn",
"package-all": "yarn pack:email && yarn pack:webhosting",
"update-email-safe-deps": "cd email_app && npm install @maidsafe/safe-node-app@latest --save",
"update-webhosting-safe-deps": "cd web_hosting_manager/app && npm install @maidsafe/safe-node-app@latest --save",
"update-safe-deps": "yarn update-webhosting-safe-deps && yarn update-email-safe-deps",
"pack:webhosting": "cd web_hosting_manager && yarn package && yarn post-package -e web_hosting_manager",
"post-pack:webhosting": "cd web_hosting_manager && yarn post-package -e web_hosting_manager",
"pack:email": "cd email_app && yarn package && yarn post-package -e email_app",
"post-pack:email": "cd email_app && yarn post-package -e email_app"
"pack:webhosting": "cd web_hosting_manager && yarn package && yarn post-package",
"post-pack:webhosting": "cd web_hosting_manager && yarn post-package",
"pack:email": "cd email_app && yarn package && yarn post-package",
"post-pack:email": "cd email_app && yarn post-package"
},
"dependencies": {
"archiver": "^2.0.3",
Expand Down
14 changes: 14 additions & 0 deletions post-packaging.js
Expand Up @@ -4,6 +4,8 @@ const path = require('path');
const fs = require('fs-extra');
const archiver = require('archiver');
const commandLineArgs = require('command-line-args')
const crypto = require('crypto');
const nodeFs = require('fs');

const optionDefinitions = [
{ name: 'example', alias: 'e', type: String,defaultOption: true, defaultValue: 'web_hosting_manager' },
Expand Down Expand Up @@ -137,3 +139,15 @@ archive.on('warning', function(err) {
archive.pipe(output);
archive.directory(`${targetDir}/${RELEASE_FOLDER_NAME}`, RELEASE_FOLDER_NAME);
archive.finalize();


const algorithm = 'sha256';
const shasum = crypto.createHash(algorithm);
const filePath = `${targetDir}/${RELEASE_FOLDER_NAME}.zip`;
const s = nodeFs.createReadStream(filePath);
s.on('data', (d) => { shasum.update(d); });
s.on('end', () => {
const d = shasum.digest('hex');
console.log(d);
fs.writeFileSync(`${targetDir}/${RELEASE_FOLDER_NAME}.txt`, d);
});
1 change: 1 addition & 0 deletions web_hosting_manager/package.json
Expand Up @@ -16,6 +16,7 @@
"lint-styles": "stylelint app/*.css app/components/*.css --syntax scss",
"lint-styles-fix": "stylefmt -r app/*.css app/components/*.css",
"package": "npm run build && build --publish never",
"post-package": "node ../post-packaging.js -e web_hosting_manager",
"package-all": "npm run build && build -mwl",
"package-linux": "npm run build && build --linux",
"package-win": "npm run build && build --win --x64",
Expand Down

0 comments on commit c583c27

Please sign in to comment.