Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/RocketChat…
Browse files Browse the repository at this point in the history
…#280-thread-navigation
  • Loading branch information
mrsimpson committed Mar 21, 2018
2 parents 31a3729 + 9e80952 commit 33facdc
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 73 deletions.
78 changes: 69 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- run:
name: Install submodules
command: |
git submodule init && git submodule updated
git submodule init && git submodule update
- run:
name: Lint
Expand Down Expand Up @@ -176,8 +176,8 @@ jobs:
- run:
name: Run Tests
command: |
for i in $(seq 1 5); do npm test && s=0 && break || s=$? && sleep 1; done; (exit $s)
rm -rf ./tests/end-to-end/ui_smarti # Smarti tests run separately
npm test
- store_artifacts:
path: .screenshots/

Expand All @@ -189,7 +189,7 @@ jobs:

environment:
TEST_MODE: "true"
MONGO_URL: mongodb://localhost:27017/testwithoplog
MONGO_URL: mongodb://localhost:27017/testwithoutplog

steps:
- attach_workspace:
Expand All @@ -205,7 +205,53 @@ jobs:
- run:
name: Run Tests
command: |
for i in $(seq 1 5); do npm test && s=0 && break || s=$? && sleep 1; done; (exit $s)
rm -rf ./tests/end-to-end/ui_smarti # Smarti tests run separately
npm test
- store_artifacts:
path: .screenshots/

test-smarti:
<<: *defaults
docker:
- image: circleci/node:8-browsers
- image: circleci/mongo:3.4
- image: assisitfy/smarti:0.7.0-RC1

environment:
TEST_MODE: "true"
MONGO_URL: mongodb://localhost:27017/testsmarti
SPRING_DATA_MONGODB_URI: mongodb://localhost:27017/smarti
SECURITY_CONFIG_MONGO_ADMIN-PASSWORD: admin

steps:
- attach_workspace:
at: /tmp

- checkout

# Enable remote docker host for temporary images (see https://circleci.com/docs/2.0/building-docker-images/
# - setup_remote_docker:
# docker_layer_caching: true

# - run:
# name: Build and start Smarti
# command: |
# docker pull assisitfy/smarti:0.7.0-RC1
# docker build -t smarti-with-stanfordnlp - < .scripts/dockerfile-smarti-with-nlp
# docker run -d --name smarti --net=host smarti-with-stanfordnlp --security.config.mongo.admin-password=admin --spring.data.mongodb.uri=mongodb://localhost/smarti
#
# - run:
# name: NPM install
# command: |
# npm install

- run:
name: Run Tests
command: |
shopt -s extglob
rm -rf ./tests/end-to-end/!(ui_smarti) # remove all non-Smarti-tests
npm test
- store_artifacts:
path: .screenshots/
Expand Down Expand Up @@ -237,8 +283,7 @@ jobs:
name: Publish assets
command: |
if [[ $CIRCLE_PULL_REQUESTS ]]; then exit 0; fi;
bash .scripts/check-deploy.sh
bash .scripts/deploy-assistify-chat.sh
workflows:
version: 2
Expand All @@ -260,13 +305,28 @@ workflows:
filters:
tags:
only: /^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$/
branches:
only:
- circle-without-oplog
- test-smarti:
requires:
- build
filters:
tags:
only: /^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$/
branches:
only:
- circle-smarti
- deploy:
requires:
- test-with-oplog
- test-without-oplog
# - test-without-oplog
# - test-smarti
filters:
branches:
only: develop
only:
- develop
- master
tags:
only: /^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$/

25 changes: 0 additions & 25 deletions .scripts/check-deploy.sh

This file was deleted.

8 changes: 4 additions & 4 deletions .scripts/continueTesting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
tmpPath=tests/end-to-end/temporary_staged_test
stopfile=`find ${tmpPath} -type f | head -1`
echo 'Last stop at:' $stopfile
[ -z "$retry_test" ] && retry_test=1
[ -z "$RETRY_TESTS" ] && RETRY_TESTS=1
stopfile=`find ${tmpPath} -type f | head -1`
array=(`find tests/end-to-end/*/*.js -type f`)

Expand All @@ -15,11 +15,11 @@ rm -rf $tmpPath
mkdir -p $tmpPath
for file in ${array[@]:$j}; do
failed=1
for i in `seq 1 $retry_test`; do
for i in `seq 1 $RETRY_TESTS`; do
echo '-------------- '$i' try ---------------'
set -x
cp $file $tmpPath
CHIMP_PATH=$tmpPath meteor npm run chimp-path
CHIMP_PATH=$tmpPath npm run chimp-path
failed=$?
set +x
if [ $failed -eq 0 ]; then
Expand All @@ -30,4 +30,4 @@ for file in ${array[@]:$j}; do
exit 1
fi
rm $tmpPath/${file##*/}
done
done
51 changes: 51 additions & 0 deletions .scripts/deploy-assistify-chat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

function parse_git_hash(){
git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/"
}

# Install AWS-CLI - if it's there, this will be done quickly
pip install --user --upgrade awscli
export PATH=$PATH:$HOME/.local/bin # add user-installed aws-cli to path

# we want this script to work with Travis and CircleCi, so abstract the Environment variables
export BRANCH=${TRAVIS_BRANCH}${CIRCLE_BRANCH}
export COMMIT= $(parse_git_hash) # ${TRAVIS_COMMIT}${CIRCLE_SHA1} will return the long sha which is too long to be readable
export BUILD_FILE=Assistify_Chat_${BRANCH/\//_}_${COMMIT:1}.tar.gz

export NODEJS_VERSION="8.9.4"
export NODEJS_CHECKSUM="21fb4690e349f82d708ae766def01d7fec1b085ce1f5ab30d9bda8ee126ca8fc"

# in Circle-Ci, the containers already got a aws-config, so if it exsists, assume it's ok
if [ ! -f ~/.aws/credentials ]
then
mkdir -p ~/.aws

cat > ~/.aws/credentials << EOL
[default]
aws_access_key_id = ${AWS_ACCESS_KEY}
aws_secret_access_key = ${AWS_SECRET_KEY}
EOL
fi
# store the build artifact
mv /tmp/build/Rocket.Chat.tar.gz /tmp/build/${BUILD_FILE}
aws s3 cp ${BUILD_FILE} s3://${AWS_BUCKET}/rocketchat/ --region ${AWS_REGION} --acl bucket-owner-full-control
# For dedicated branches, we tag the artifacts - this should actually be based on git tags
TARGET_ENVIRONMENT=undefined
if [ ${BRANCH} = master ]
then
TARGET_ENVIRONMENT=production
# publish a new "latest"-file in order to make new clients be created with it
aws s3 cp ${BUILD_FILE} s3://${AWS_BUCKET}/rocketchat/rocket-chat-latest.tar.tgz --region ${AWS_REGION} --acl bucket-owner-full-control
else
if [[ ${BRANCH} == develop ]] || [[ $BRANCH == "release/"* ]]
then
TARGET_ENVIRONMENT=test
fi
fi
aws s3api put-object-tagging --region ${AWS_REGION} --bucket ${AWS_BUCKET} --key rocketchat/${BUILD_FILE} --tagging "{ \"TagSet\": [ { \"Key\": \"environment\", \"Value\": \"${TARGET_ENVIRONMENT}\" }, { \"Key\": \"nodejs_version\", \"Value\": \"${NODEJS_VERSION}\" }, { \"Key\": \"nodejs_checksum\", \"Value\": \"${NODEJS_CHECKSUM}\" }, { \"Key\": \"assets\", \"Value\": \"${ASSETS_URL}\" } ] }"
File renamed without changes.
8 changes: 4 additions & 4 deletions .scripts/seperateTesting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
tmpPath=tests/end-to-end/temporary_staged_test
rm -rf $tmpPath
mkdir -p $tmpPath
[ -z "$retry_test" ] && retry_test=1
[ -z "$RETRY_TESTS" ] && RETRY_TESTS=1
for file in tests/end-to-end/*/*.js; do
failed=1
for i in `seq 1 $retry_test`; do
for i in `seq 1 $RETRY_TESTS`; do
echo '-------------- '$i' try ---------------'
set -x
cp $file $tmpPath
CHIMP_PATH=$tmpPath meteor npm run chimp-path
CHIMP_PATH=$tmpPath npm run chimp-path
failed=$?
set +x
if [ $failed -eq 0 ]; then
Expand All @@ -20,4 +20,4 @@ for file in tests/end-to-end/*/*.js; do
exit 1
fi
rm $tmpPath/${file##*/}
done
done
4 changes: 1 addition & 3 deletions .scripts/smarti.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

docker pull assisitfy/smarti:0.7.0-RC1

#docker run -d --net=host assisitfy/smarti:0.6.1

docker build -t smarti-with-stanfordnlp - < .scripts/dockerfile
docker build -t smarti-with-stanfordnlp - < .scripts/dockerfile-smarti-with-nlp

docker run -d --name smarti --net=host smarti-with-stanfordnlp --security.config.mongo.admin-password=admin --spring.data.mongodb.uri=mongodb://localhost/smarti

Expand Down
2 changes: 1 addition & 1 deletion .scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function startApp(callback) {
function startChimp() {
startProcess({
name: 'Chimp',
command: 'retry_test=3 .scripts/seperateTesting.sh',
command: '.scripts/seperateTesting.sh',
options: {
env: Object.assign({}, process.env, {
NODE_PATH: process.env.NODE_PATH +
Expand Down
57 changes: 30 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,40 +68,43 @@ before_script:
- mongo --eval 'rs.status()'
- mongo meteor --eval 'db.getCollectionNames()'
script:
- shopt -s extglob
- rm -rf ./tests/end-to-end/!(ui_smarti) # remove all non-Smarti-tests
- if [[ ! $SKIP_TESTS ]]; then npm test; fi

# - mongo meteor --eval 'db.dropDatabase()'
# - unset MONGO_OPLOG_URL
# - npm test

before_deploy:
- mkdir -p /tmp/build/rocketchat
- export BUILD_FILE=Assistify_Chat_${TRAVIS_BRANCH/\//_}_${TRAVIS_COMMIT:1}.tar.gz
- mv /tmp/build/Rocket.Chat.tar.gz /tmp/build/rocketchat/${BUILD_FILE}
# before_deploy:
# - mkdir -p /tmp/build/rocketchat
# - export BUILD_FILE=Assistify_Chat_${TRAVIS_BRANCH/\//_}_${TRAVIS_COMMIT:1}.tar.gz
# - mv /tmp/build/Rocket.Chat.tar.gz /tmp/build/rocketchat/${BUILD_FILE}

deploy:
- provider: s3
access_key_id: $AWS_ACCESS_KEY
secret_access_key: $AWS_SECRET_KEY
local_dir: /tmp/build/
skip_cleanup: true
on: &1
repo: assistify/Rocket.Chat
branch: develop
bucket: $AWS_BUCKET
region: $AWS_REGION
- provider: s3
access_key_id: $AWS_ACCESS_KEY
secret_access_key: $AWS_SECRET_KEY
local_dir: /tmp/build/
skip_cleanup: true
on: &2
repo: assistify/Rocket.Chat
branch: master
bucket: $AWS_BUCKET
region: $AWS_REGION
# deploy:
# - provider: s3
# access_key_id: $AWS_ACCESS_KEY
# secret_access_key: $AWS_SECRET_KEY
# local_dir: /tmp/build/
# skip_cleanup: true
# on: &1
# repo: assistify/Rocket.Chat
# branch: develop
# bucket: $AWS_BUCKET
# region: $AWS_REGION
# - provider: s3
# access_key_id: $AWS_ACCESS_KEY
# secret_access_key: $AWS_SECRET_KEY
# local_dir: /tmp/build/
# skip_cleanup: true
# on: &2
# repo: assistify/Rocket.Chat
# branch: master
# bucket: $AWS_BUCKET
# region: $AWS_REGION

after_deploy:
- $TRAVIS_BUILD_DIR/.scripts/check-deploy.sh
# after_deploy:
# - $TRAVIS_BUILD_DIR/.scripts/deploy-assistify-chat.sh

env:
global:
Expand Down

0 comments on commit 33facdc

Please sign in to comment.