Skip to content

Commit

Permalink
Merge pull request #1074 from Sing-Li/travis-001
Browse files Browse the repository at this point in the history
CI/CD pipeline initial implementation  -  #961 - READY FOR MERGE
  • Loading branch information
Sing-Li committed Oct 14, 2015
2 parents b179ad3 + 35a12d3 commit 756cacf
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 73 deletions.
40 changes: 33 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
sudo: required
language: node_js
branches:
only:
- master
node_js:
- "0.10"

- '0.10'
before_install:
- "curl https://install.meteor.com | /bin/sh"

- curl https://install.meteor.com | /bin/sh
- npm install -g npm@'>=2.13.5'
script:
- meteor add rocketchat:livechat
- meteor add rocketchat:hubot
- meteor build --server demo.rocket.chat ./
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then echo "Building PR $TRAVIS_PULL_REQUEST"; meteor build ../build; exit $?; fi
- cd .travis
- npm install
- npm start
- cd ..
- meteor build ../build
- cd .travis
- sh ./namefiles.sh
- cd ..
- meteor add rocketchat:livechat
- meteor add rocketchat:hubot
- meteor build --server demo.rocket.chat ../build
- cd .travis
- sh ./namedemo.sh
- cd ..
after_deploy:
- "curl -H \"Content-Type: application/json\" --data \"{'build': true}\" -X POST https://registry.hub.docker.com/u/singli/rocket.chat/trigger/$PUSHTOKEN/"
deploy:
provider: s3
access_key_id: "AKIAIKIA7H7D47KUHYCA"
bucket: "rocketchatbuild"
skip_cleanup: true
local_dir: ../build
on:
branch: master
secret_access_key:
secure: LYA2XNdpHBTN/zs/71VWLr81b3Gb290PRIqQER72SZ3eQjDk0UpUUFkzK6mc6GkelXyqHRBRckmhBzVCEAO6KNIU9JHc9aUxyUbSt7OMTAZUZ8X36E7HL6mXN73YHtUCbEczD41aXMK+HQ9ol0EXfvbprp5gFwqT908dSVleNJCN6wZgW5ZJVzWTiC2/aaGqCrWhAWybG1XwCgl8ND8N3qFsNBZ6MDN3rpp9kVdDJ3vzp5Azkf6QrTFQTo2ai3DFFnRf7J84/8tpRL3tVcPwjik449KEkJlCPotxt7XxUTg9HrN5LQY4wYTKyKhoYxzADwse8VaU/oFhVef3A8AiLpfg8rR63ahs5ZOqJc926eiZWGumLfvcGkHD2kb+z+l9bIE8b2X7mct6gK4ub0E6Ul/NOoh1ZgppVzP3PuYZXGb2CNvZTrrSjH9dGWPWlRjZaErg4bs4BC6y6eGjgu1CqFa1eqLFO/oYdmX5c4kDskyNf0VSVVXmqLqQBWrkOGSr3Z8nR8XQ1PDQfmj8ZMmDRtvt58DuOVzOBkC71Mc/Kr/cKS0cXedwzzNg2BG4EHMsc1eTn6JWs95NFCbPbI5HzxYODumZwOwSJyXKiDgUhPmRc6I1MvgJqIIBGWFqIIGEfR715E4zaJzAYvTPWvL+8aBMfZxdQouRYH7d9kREc6U=
5 changes: 5 additions & 0 deletions .travis/namedemo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd ../../build
FILENAME=demo.rocket.chat-`cat version.txt`.tgz
mv Rocket.Chat.tar.gz $FILENAME
ln -s $FILENAME demo.rocket.chat-v.latest.tgz

5 changes: 5 additions & 0 deletions .travis/namefiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd ../../build
FILENAME=rocket.chat-`cat version.txt`.tgz
mv Rocket.Chat.tar.gz $FILENAME
ln -s $FILENAME rocket.chat-v.latest.tgz

15 changes: 15 additions & 0 deletions .travis/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "setbuildinfo",
"version": "1.0.0",
"description": "Set the buildinfo.txt resource",
"main": "setbuildinfo.js",
"scripts": {
"start": "node setbuildinfo.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"line-by-line": "^0.1.4",
"mkdirp": "^0.5.1"
}
}
44 changes: 44 additions & 0 deletions .travis/setbuildinfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
var BUILD_INFO_PATH = '../public/buildinfo/buildinfo.txt';
var PACKAGES_PATH = '../.meteor/packages';
var BUILD_PATH = '../../build';
var LineByLineReader = require('line-by-line'),
mkdirp = require('mkdirp'),
fs = require('fs'),
lr = new LineByLineReader(BUILD_INFO_PATH);

var firstline = "";


if (process.env.TRAVIS_BUILD_NUMBER) {

var transformVersion = function (firstline) {
var versions = firstline.split(".");

return versions[0] + '.' + versions[1] + '.' + process.env.TRAVIS_BUILD_NUMBER + '\n';
};



lr.on('error', function (err) {
// 'err' contains error object
});

lr.on('line', function (line) {
if (firstline == "")
firstline = line;

});

lr.on('end', function () {

var packages = fs.readFileSync(PACKAGES_PATH);
var verinfo = transformVersion(firstline);
var content = verinfo + packages;
mkdirp.sync(BUILD_PATH);
fs.writeFileSync(BUILD_PATH + "/version.txt", verinfo);
fs.writeFileSync(BUILD_INFO_PATH, content);
console.log('Version is ' + verinfo);

});

}
30 changes: 29 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
FROM meteorhacks/meteord:onbuild
FROM node:0.10

MAINTAINER buildmaster@rocket.chat

RUN groupadd -r rocketchat \
&& useradd -r -g rocketchat rocketchat \
&& mkdir /app

# gpg: key 4FD08014: public key "Rocket.Chat Buildmaster <buildmaster@rocket.chat>" imported
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0E163286C20D07B9787EBE9FD7F9D0414FD08104

WORKDIR /app

RUN curl -fSL "https://s3.amazonaws.com/rocketchatbuild/rocket.chat-v.latest.tgz" -o rocket.chat.tgz \
&& tar zxvf ./rocket.chat.tgz \
&& rm ./rocket.chat.tgz \
&& cd /app/bundle/programs/server \
&& npm install

WORKDIR /app/bundle
USER rocketchat

# needs a mongoinstance - defaults to container linking with alias 'db'
ENV MONGO_URL=mongodb://db:27017/meteor \
PORT=3000 \
ROOT_URL=http://localhost:3000

EXPOSE 3000
CMD ["node", "main.js"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Available from the AppStore:

[![Rocket.Chat on Apple AppStore](http://linkmaker.itunes.apple.com/images/badges/en-us/badge_appstore-lrg.svg)](https://geo.itunes.apple.com/us/app/rocket.chat/id1028869439?mt=8)

Get the app for your Android phone:
Get the app for your Android phone:


[![Rocket.Chat on Google Play](https://developer.android.com/images/brand/en_app_rgb_wo_45.png)](https://play.google.com/store/apps/details?id=com.konecty.rocket.chat)

Expand Down
8 changes: 3 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash
source ./build-info.sh
export METEOR_SETTINGS=$(cat settings.json)
meteor add rocketchat:livechat
meteor add rocketchat:hubot
meteor build --server https://demo.rocket.chat --directory /var/www/rocket.chat
cd /var/www/rocket.chat
https://s3.amazonaws.com/rocketchatbuild/demo.rocket.chat-v.latest.tgz" -o rocket.chat.tgz
tar zxvf rocket.chat.tgz && rm rocket.chat.tgz
cd /var/www/rocket.chat/bundle/programs/server
npm install
cd /var/www/rocket.chat/current
Expand Down
21 changes: 12 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
db:
image: mongo
# volumes:
# - ./data/runtime/db:/data/db
# - ./data/dump:/dump
command: mongod --smallfiles

rocketchat:
image: rocketchat/rocket.chat
image: singli/rocket.chat
environment:
- MONGO_URL=mongodb://mongodb/rocketchat
- ROOT_URL=http://localhost:80
- MONGO_URL=mongodb://db:27017/rocketchat
- ROOT_URL=http://yourhost:8818
links:
- mongodb
- db:db
ports:
- 80:80
- 8818:3000

mongodb:
image: mongo
ports:
- 27017
54 changes: 27 additions & 27 deletions packages/meteor-accounts-saml/.npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions packages/rocketchat-file/.npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 756cacf

Please sign in to comment.