Skip to content

Commit

Permalink
wip: Make Travis pipeline more reliable (kalisio/kdk#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Nouguier committed Dec 18, 2019
1 parent df6312e commit 1799f74
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 50 deletions.
13 changes: 5 additions & 8 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
.git
dist
electron/dist
.quasar
node_modules
electron/node_modules
cordova/node_modules
cordova/platforms
cordova/plugins
cordova/www
dist
src-cordova
api/node_modules
api/dist
api/logs
api/logs
benchmark
16 changes: 8 additions & 8 deletions .travis.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ then
./cc-test-reporter before-build

# Run the tests
docker-compose -f deploy/mongodb.yml -f deploy/app.yml -f deploy/app.test.server.yml up --exit-code-from app app
docker-compose -f deploy/mongodb.yml -f deploy/app.yml -f deploy/app.test.api.yml up --exit-code-from app app
ERROR_CODE=$?
if [ $ERROR_CODE -ne 0 ]; then
echo "Testing ${APP} API failed [error: $ERROR_CODE]"
echo "Testing API failed [error: $ERROR_CODE]"
exit 1
fi

Expand All @@ -30,21 +30,21 @@ then

# Report to code climate
./cc-test-reporter after-build -t lcov --exit-code $ERROR_CODE
fi
else
# Run Testcafe with the given fixture
export FIXTURE=$1

if [ $1 == "client" ]
then
Output directory for client screenshots
# Create the screenshots dir
mkdir screenshots
chmod -R 777 screenshots

# Run the app
docker-compose -f deploy/mongodb.yml -f deploy/app.yml -f deploy/app.test.client.yml up --exit-code-from testcafe testcafe
ERROR_CODE=$?
#Copy the screenshots whatever the result
aws s3 sync screenshots s3://$BUILDS_BUCKET/$BUILD_NUMBER/client-screenshots > /dev/null
aws s3 sync screenshots s3://$BUILDS_BUCKET/$BUILD_NUMBER/$FIXTURE-screenshots > /dev/null
if [ $ERROR_CODE -eq 1 ]; then
echo "Testing ${APP} client failed [error: $ERROR_CODE]"
echo "Testing $FIXTURE failed [error: $ERROR_CODE]"
exit 1
fi
fi
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ node_js:
- '8'
env:
matrix:
- SCOPE=api
- SCOPE=client
- TEST_SCOPE=api
- TEST_SCOPE=basic
before_install:
- pip install --user awscli
script:
- bash .travis.test.sh $SCOPE
- bash .travis.test.sh $TEST_SCOPE

stages:
- name: BUILD
Expand All @@ -42,6 +42,8 @@ jobs:
- '8'
services:
- docker
env:
- TEST_SCOPE=none
script:
- bash .travis.build.sh

Expand All @@ -52,6 +54,8 @@ jobs:
- '8'
services:
- docker
env:
- TEST_SCOPE=none
install: true
script:
- bash .travis.deploy.sh
Expand All @@ -69,6 +73,8 @@ jobs:
- android-28
licenses:
- '.+'
env:
- TEST_SCOPE=none
before_install:
# NVM
- nvm install 8
Expand All @@ -93,6 +99,8 @@ jobs:
os: osx
language: objective-c
osx_image: xcode10.1
env:
- TEST_SCOPE=none
before_install:
# NVM
- nvm install 8
Expand Down
File renamed without changes.
19 changes: 8 additions & 11 deletions deploy/app.test.client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ version: '3.3'

services:
testcafe:
build:
context: ../.
dockerfile: dockerfile.testcafe
image: kalisio/testcafe
image: kalisio/testcafe:1.3.3
depends_on:
- app
- mongodb
- app
environment:
- GOOGLE_USER
- GOOGLE_PASSWORD
Expand All @@ -17,12 +14,12 @@ services:
- NODE_ENV=production
- DB_URL=mongodb://mongodb:27017/${APP}
- APP_URL=app:${PORT}
volumes:
- ../test:/usr/lib/node_modules/testcafe/${APP}
- ./client-screenshots:/opt/testcafe/screenshots
command: firefox ./${APP}/*.test.js -S -s screenshots /opt/testcafe/screenshots --speed 0.9
networks:
- app-network
volumes:
- ../test:/tests
- ../screenshots:/screenshots
command: firefox:headless /tests/*.test.js -S -s /screenshots -f $FIXTURE
networks:
- app-network

networks:
app-network:
Expand Down
20 changes: 0 additions & 20 deletions dockerfile.testcafe

This file was deleted.

0 comments on commit 1799f74

Please sign in to comment.