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

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
killix committed Apr 13, 2017
1 parent 90c7172 commit 29cc6b8
Show file tree
Hide file tree
Showing 38 changed files with 220 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .bithoundrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"critics": {
"lint": {
"engine": "tslint",
"configLocation": ".ci/ci_tslint.json"
"configLocation": "_tools/ci_tslint.json"
},
"wc": {
"limit": 3000
Expand Down
24 changes: 0 additions & 24 deletions .ci/scripts/get-modified.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .ci/scripts/run-install.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .ci/scripts/run-tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ engines:
tslint:
enabled: true
channel: beta
config: .ci/ci_tslint.json
config: _tools/ci_tslint.json
ratings:
paths:
- "**/src/**.d.ts"
Expand Down
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
**/node_modules/
*.log
LICENSE
*.md
spec
55 changes: 19 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
language: node_js
dist: trusty
os:
- linux
sudo: true
env:
- CXX=g++-4.8
language: cpp
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- g++-4.8
cache:
directories:
- integrations/broid-alexa/node_modules
- integrations/broid-callr/node_modules
- integrations/broid-discord/node_modules
- integrations/broid-flowdock/node_modules
- integrations/broid-kik/node_modules
- integrations/broid-line/node_modules
- integrations/broid-messenger/node_modules
- integrations/broid-ms-teams/node_modules
- integrations/broid-schemas/node_modules
- integrations/broid-skype/node_modules
- integrations/broid-slack/node_modules
- integrations/broid-telegram/node_modules
- integrations/broid-twilio/node_modules
- integrations/broid-twitter/node_modules
- integrations/broid-utils/node_modules
- integrations/broid-viber/node_modules
- integrations/broid-irc/node_modules
- integrations/broid-wechat/node_modules
- integrations/broid-ms-team/node_modules
node_js:
- "6"
before_install:
- g++-4.8
- build-essential
notifications:
email: false
env:
matrix:
- TRAVIS_NODE_VERSION="6"
install:
- "rm -rf ~/.nvm && mkdir -p ~/.nvm && curl -sL `curl -sI https://github.com/creationix/nvm/releases/latest|sed -En 's/^Location: (.+)\\/releases\\/tag\\/(.+)/\\1\\/tarball\\/\\2/p'|tr -d '\r\n'`|tar zx --strip=1 -C ~/.nvm && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION"
- npm --version
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CXX=g++-4.8; export CC=gcc-4.8; fi
- $CXX --version
# Repo for Yarn
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update -qq
- sudo apt-get install -y -qq yarn
- npm install -g nsp
- yarn --version
- export CXX=g++-4.8
- export BUILDTYPE="production";
before_script:
- $CXX --version
- chmod +x ./.ci/scripts/*
- ./.ci/scripts/run-install.sh
script: ./.ci/scripts/run-tests.sh
- chmod +x ./_tools/test
- ./_tools/test install
script: ./_tools/test
67 changes: 67 additions & 0 deletions Dockerfile.test.2017_04_12__21_11_06
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM node:6.9.4-alpine

RUN apk --no-cache add ca-certificates curl make gcc g++ python linux-headers paxctl libgcc libstdc++ gnupg git wget && update-ca-certificates
RUN mkdir -p /opt/yarn && cd /opt/yarn && wget https://yarnpkg.com/latest.tar.gz && tar zxf latest.tar.gz
ENV PATH "/Users/killix/.nvm/versions/node/v6.9.1/bin:/Users/killix/.local/google-cloud-sdk/bin:/usr/local/bin:/Users/killix/.gvm/pkgsets/go1.7.1/global/bin:/Users/killix/.gvm/gos/go1.7.1/bin:/Users/killix/.gvm/pkgsets/go1.7.1/global/overlay/bin:/Users/killix/.gvm/bin:/Users/killix/.gvm/bin:/Users/killix/.cargo/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Users/killix/bin:/usr/local/Cellar/node/7.3.0/bin:/opt/yarn/dist/bin"

ARG CI_BRANCH
ENV CI_BRANCH $CI_BRANCH

RUN mkdir -p /integrations
WORKDIR /integrations/

COPY ./_tools /integrations/_tools/
RUN chmod +x _tools/scripts/run-install.sh
RUN chmod +x _tools/scripts/run-tests.sh

COPY ./broid-alexa/package.json ./broid-alexa/yarn.lock /integrations/broid-alexa/
COPY ./broid-callr/package.json ./broid-callr/yarn.lock /integrations/broid-callr/
COPY ./broid-discord/package.json ./broid-discord/yarn.lock /integrations/broid-discord/
COPY ./broid-flowdock/package.json ./broid-flowdock/yarn.lock /integrations/broid-flowdock/
COPY ./broid-gitter/package.json ./broid-gitter/yarn.lock /integrations/broid-gitter/
COPY ./broid-google-assistant/package.json ./broid-google-assistant/yarn.lock /integrations/broid-google-assistant/
COPY ./broid-groupme/package.json ./broid-groupme/yarn.lock /integrations/broid-groupme/
COPY ./broid-irc/package.json ./broid-irc/yarn.lock /integrations/broid-irc/
COPY ./broid-kik/package.json ./broid-kik/yarn.lock /integrations/broid-kik/
COPY ./broid-line/package.json ./broid-line/yarn.lock /integrations/broid-line/
COPY ./broid-messenger/package.json ./broid-messenger/yarn.lock /integrations/broid-messenger/
COPY ./broid-ms-teams/package.json ./broid-ms-teams/yarn.lock /integrations/broid-ms-teams/
COPY ./broid-nexmo/package.json ./broid-nexmo/yarn.lock /integrations/broid-nexmo/
COPY ./broid-schemas/package.json ./broid-schemas/yarn.lock /integrations/broid-schemas/
COPY ./broid-skype/package.json ./broid-skype/yarn.lock /integrations/broid-skype/
COPY ./broid-slack/package.json ./broid-slack/yarn.lock /integrations/broid-slack/
COPY ./broid-telegram/package.json ./broid-telegram/yarn.lock /integrations/broid-telegram/
COPY ./broid-twilio/package.json ./broid-twilio/yarn.lock /integrations/broid-twilio/
COPY ./broid-twitter/package.json ./broid-twitter/yarn.lock /integrations/broid-twitter/
COPY ./broid-utils/package.json ./broid-utils/yarn.lock /integrations/broid-utils/
COPY ./broid-viber/package.json ./broid-viber/yarn.lock /integrations/broid-viber/
COPY ./broid-wechat/package.json ./broid-wechat/yarn.lock /integrations/broid-wechat/

COPY ./.git /integrations/.git/

RUN /bin/sh _tools/scripts/run-install.sh

COPY ./broid-alexa/src/* /integrations/broid-alexa/src/
COPY ./broid-callr/src/* /integrations/broid-callr/src/
COPY ./broid-discord/src/* /integrations/broid-discord/src/
COPY ./broid-flowdock/src/* /integrations/broid-flowdock/src/
COPY ./broid-gitter/src/* /integrations/broid-gitter/src/
COPY ./broid-google-assistant/src/* /integrations/broid-google-assistant/src/
COPY ./broid-groupme/src/* /integrations/broid-groupme/src/
COPY ./broid-irc/src/* /integrations/broid-irc/src/
COPY ./broid-kik/src/* /integrations/broid-kik/src/
COPY ./broid-line/src/* /integrations/broid-line/src/
COPY ./broid-messenger/src/* /integrations/broid-messenger/src/
COPY ./broid-ms-teams/src/* /integrations/broid-ms-teams/src/
COPY ./broid-nexmo/src/* /integrations/broid-nexmo/src/
COPY ./broid-schemas/src/* /integrations/broid-schemas/src/
COPY ./broid-skype/src/* /integrations/broid-skype/src/
COPY ./broid-slack/src/* /integrations/broid-slack/src/
COPY ./broid-telegram/src/* /integrations/broid-telegram/src/
COPY ./broid-twilio/src/* /integrations/broid-twilio/src/
COPY ./broid-twitter/src/* /integrations/broid-twitter/src/
COPY ./broid-utils/src/* /integrations/broid-utils/src/
COPY ./broid-viber/src/* /integrations/broid-viber/src/
COPY ./broid-wechat/src/* /integrations/broid-wechat/src/

RUN /bin/sh _tools/scripts/run-tests.sh
File renamed without changes.
43 changes: 43 additions & 0 deletions _tools/scripts/generate_dockerfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -e

SUFFIX=${1:-test}
today=`date '+%Y_%m_%d__%H_%M_%S'`;
filename="./Dockerfile.$SUFFIX.$today"

echo $SUFFIX
echo $filename

echo "FROM node:6.9.4-alpine"
echo ""
echo "RUN apk --no-cache add ca-certificates curl make gcc g++ python linux-headers paxctl libgcc libstdc++ gnupg git wget && update-ca-certificates"
echo "RUN mkdir -p /opt/yarn && cd /opt/yarn && wget https://yarnpkg.com/latest.tar.gz && tar zxf latest.tar.gz"
echo "ENV PATH \"$PATH:/opt/yarn/dist/bin\""
echo ""
echo "ARG CI_BRANCH"
echo "ENV CI_BRANCH \$CI_BRANCH"
echo ""
echo "RUN mkdir -p /integrations"
echo "WORKDIR /integrations/"
echo ""
echo "COPY ./_tools /integrations/_tools/"
echo "RUN chmod +x _tools/scripts/run-install.sh"
echo "RUN chmod +x _tools/scripts/run-tests.sh"
echo ""
for dir in ../../broid-* ; do
dircleaned=${dir//[..\/]/}
echo "COPY ./$dircleaned/package.json ./$dircleaned/yarn.lock /integrations/$dircleaned/"
done
echo ""
echo "COPY ./.git /integrations/.git/"
echo ""
echo "RUN /bin/sh _tools/scripts/run-install.sh"
echo ""
for dir in ../../broid-* ; do
dircleaned=${dir//[..\/]/}
echo "COPY ./$dircleaned/src/* /integrations/$dircleaned/src/"
done
echo ""
echo "RUN /bin/sh _tools/scripts/run-tests.sh"
echo ""
23 changes: 23 additions & 0 deletions _tools/scripts/get-modified.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
set -e

rootDir() {
xargs -n1 | cut -d/ -f1
}

integrations() {
echo broid-*/package.json | rootDir | sort | sed '/^_/d'
}

revelant_directories() {
git diff --name-only "origin/master...$CI_BRANCH" | rootDir | sort | uniq |
grep -E -i -w '(broid-)\w+' # Get only broid integrations paths
}

integrations_changed() {
integrations > .integrations
revelant_directories > .revelant_directories
comm -12 .integrations .revelant_directories
}

echo $(integrations_changed)
18 changes: 18 additions & 0 deletions _tools/scripts/run-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -e

source "$(dirname "$0")/get-modified.sh"

echo "CI_BRANCH: $CI_BRANCH"

INTS_UPDATED=$(integrations_changed)
echo $INTS_UPDATED

for integration in $INTS_UPDATED; do
echo "> Install dependencies for $integration"
(cd "$integration" && yarn install --ignore-scripts)
done

echo "> Install dependencies finished"
exit 0
18 changes: 18 additions & 0 deletions _tools/scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e

source "$(dirname "$0")/get-modified.sh"

echo "CI_BRANCH: $CI_BRANCH"

INTS_UPDATED=$(integrations_changed)
echo $INTS_UPDATED

for integration in $INTS_UPDATED; do
echo "> Run Tests for $integration"
(cd "$integration" && yarn run travis)
done

echo "> Tests finished"
exit 0
4 changes: 2 additions & 2 deletions .ci/test → _tools/test
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fi

command_install() {
for integration in $INTS_UPDATED; do
(cd "$integration" && yarn install --ignore-scripts)
(cd "$integration" && npm install --ignore-scripts)
done
}

Expand All @@ -44,7 +44,7 @@ command_test() {
echo "> Testing $integration"
(
cd "$integration"
yarn run travis
npm run travis
)
done
}
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion broid-alexa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
"copy": "copyfiles -u 1 src/**/*.json lib/",
"copy:config": "cp ../.ci/tsconfig.json . && cp ../.ci/tslint.json .",
"copy:config": "cp ../_tools/tsconfig.json . && cp ../_tools/tslint.json .",
"lint": "yarn run copy:config && tslint -c tslint.json src/**/*.ts",
"lint:watch": "watch 'yarn run lint' src",
"nsp-check": "nsp check --warn-only -o summary",
Expand Down
2 changes: 1 addition & 1 deletion broid-callr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
"copy": "copyfiles -u 1 src/**/*.json lib/",
"copy:config": "cp ../.ci/tsconfig.json . && cp ../.ci/tslint.json .",
"copy:config": "cp ../_tools/tsconfig.json . && cp ../_tools/tslint.json .",
"lint": "yarn run copy:config && tslint -c tslint.json src/**/*.ts",
"lint:watch": "watch 'yarn run lint' src",
"nsp-check": "nsp check --warn-only -o summary",
Expand Down
2 changes: 1 addition & 1 deletion broid-discord/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
"copy": "copyfiles -u 1 src/**/*.json lib/",
"copy:config": "cp ../.ci/tsconfig.json . && cp ../.ci/tslint.json .",
"copy:config": "cp ../_tools/tsconfig.json . && cp ../_tools/tslint.json .",
"lint": "yarn run copy:config && tslint -c tslint.json src/**/*.ts",
"lint:watch": "watch 'yarn run lint' src",
"nsp-check": "nsp check --warn-only -o summary",
Expand Down
2 changes: 1 addition & 1 deletion broid-flowdock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
"copy": "copyfiles -u 1 src/**/*.json lib/",
"copy:config": "cp ../.ci/tsconfig.json . && cp ../.ci/tslint.json .",
"copy:config": "cp ../_tools/tsconfig.json . && cp ../_tools/tslint.json .",
"lint": "yarn run copy:config && tslint -c tslint.json src/**/*.ts",
"lint:watch": "watch 'yarn run lint' src",
"nsp-check": "nsp check --warn-only -o summary",
Expand Down
2 changes: 1 addition & 1 deletion broid-gitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
"copy": "copyfiles -u 1 src/**/*.json lib/",
"copy:config": "cp ../.ci/tsconfig.json . && cp ../.ci/tslint.json .",
"copy:config": "cp ../_tools/tsconfig.json . && cp ../_tools/tslint.json .",
"lint": "yarn run copy:config && tslint -c tslint.json src/**/*.ts",
"lint:watch": "watch 'yarn run lint' src",
"nsp-check": "nsp check --warn-only -o summary",
Expand Down
2 changes: 1 addition & 1 deletion broid-google-assistant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
"copy": "copyfiles -u 1 src/**/*.json lib/",
"copy:config": "cp ../.ci/tsconfig.json . && cp ../.ci/tslint.json .",
"copy:config": "cp ../_tools/tsconfig.json . && cp ../_tools/tslint.json .",
"lint": "yarn run copy:config && tslint -c tslint.json src/**/*.ts",
"lint:watch": "watch 'yarn run lint' src",
"nsp-check": "nsp check --warn-only -o summary",
Expand Down
2 changes: 1 addition & 1 deletion broid-groupme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
"copy": "copyfiles -u 1 src/**/*.json lib/",
"copy:config": "cp ../.ci/tsconfig.json . && cp ../.ci/tslint.json .",
"copy:config": "cp ../_tools/tsconfig.json . && cp ../_tools/tslint.json .",
"lint": "yarn run copy:config && tslint -c tslint.json src/**/*.ts",
"lint:watch": "watch 'yarn run lint' src",
"nsp-check": "nsp check --warn-only -o summary",
Expand Down
Loading

0 comments on commit 29cc6b8

Please sign in to comment.