mirror of
https://github.com/penpot/penpot.git
synced 2025-03-28 15:41:25 -05:00
feat: enable runnint test on travis
This commit is contained in:
parent
4da6ae0a74
commit
31766fde32
8 changed files with 79 additions and 105 deletions
35
.travis.yml
35
.travis.yml
|
@ -1,47 +1,38 @@
|
|||
dist: xenial
|
||||
|
||||
language: clojure
|
||||
language: generic
|
||||
sudo: required
|
||||
lein: lein
|
||||
jdk:
|
||||
- openjdk8
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- wip
|
||||
- develop
|
||||
- build-refactor
|
||||
|
||||
install:
|
||||
- ./manage.sh help
|
||||
- nvm install $NODE_VERSION
|
||||
- node --version
|
||||
- curl -O https://download.clojure.org/install/linux-install-1.10.1.447.sh
|
||||
- chmod +x linux-install-1.10.1.447.sh
|
||||
- sudo ./linux-install-1.10.1.447.sh
|
||||
|
||||
before_script:
|
||||
- env | sort
|
||||
|
||||
script:
|
||||
- ./manage.sh $COMMAND
|
||||
- ./manage.sh build-devenv
|
||||
- ./manage.sh run-frontend-tests
|
||||
- ./manage.sh run-backend-tests
|
||||
|
||||
after_script:
|
||||
- docker images
|
||||
- docker ps
|
||||
- if [ "$COMMAND" = "run-release" ]; then sleep 180; fi
|
||||
- docker ps
|
||||
- for c in $(docker ps -q); do echo "> docker logs $c"; docker logs $c; done
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
env:
|
||||
- NODE_VERSION=10.16.0 COMMAND=clean
|
||||
- NODE_VERSION=10.16.0 COMMAND=build-devenv
|
||||
#- NODE_VERSION=10.16.0 COMMAND=run-devenv
|
||||
- NODE_VERSION=10.16.0 COMMAND=test-devenv
|
||||
- NODE_VERSION=10.16.0 COMMAND=build-release
|
||||
- NODE_VERSION=10.16.0 COMMAND=build-release-frontend
|
||||
- NODE_VERSION=10.16.0 COMMAND=build-release-backend
|
||||
- NODE_VERSION=10.16.0 COMMAND=run-release
|
||||
- NODE_VERSION=10.16.0
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "Not yet implemented!"
|
||||
|
||||
# TODO
|
||||
#lein test
|
16
backend/scripts/prepare-release.sh
Executable file → Normal file
16
backend/scripts/prepare-release.sh
Executable file → Normal file
|
@ -1,16 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$#" -e 0 ]; then
|
||||
echo "Expecting parameters: 1=path to backend; 2=destination directory"
|
||||
exit 1
|
||||
echo "Expecting parameters: 1=path to backend; 2=destination directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf $2 || exit 1;
|
||||
|
||||
rsync -avr \
|
||||
--exclude="/test" \
|
||||
--exclude="/resources/public/media" \
|
||||
--exclude="/target" \
|
||||
--exclude="/scripts" \
|
||||
--exclude="/.*" \
|
||||
$1 $2;
|
||||
--exclude="/test" \
|
||||
--exclude="/resources/public/media" \
|
||||
--exclude="/target" \
|
||||
--exclude="/scripts" \
|
||||
--exclude="/.*" \
|
||||
$1 $2;
|
||||
|
|
6
backend/scripts/run-tests-in-docker.sh
Executable file
6
backend/scripts/run-tests-in-docker.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
sudo pg_ctlcluster 9.6 main start
|
||||
clj -Adev -m uxbox.tests.main
|
|
@ -17,6 +17,7 @@
|
|||
"dist:assets": "gulp dist",
|
||||
"prod": "gulp dist --production",
|
||||
"start": "npm run figwheel",
|
||||
"build:test": "clojure -Adev tools.clj build-tests",
|
||||
"build:main": "clojure -Adev tools.clj build main",
|
||||
"build:view": "clojure -Adev tools.clj build view",
|
||||
"build:worker": "clojure -Adev tools.clj build worker",
|
||||
|
|
7
frontend/scripts/build-and-run-tests.sh
Executable file
7
frontend/scripts/build-and-run-tests.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
source ~/.bashrc
|
||||
|
||||
npm install
|
||||
npm run build:test || exit 1;
|
||||
|
||||
node ./target/tests/main
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
source ~/.bashrc
|
||||
|
||||
npm install
|
||||
npm run build:main || exit 1;
|
||||
npm run build:view || exit 1;
|
||||
npm run build:worker || exit 1;
|
||||
|
||||
# TODO
|
||||
#node ./out/tests.js
|
103
manage.sh
103
manage.sh
|
@ -22,7 +22,7 @@ function remove-image {
|
|||
function build-devenv {
|
||||
kill-container
|
||||
echo "Building development image $IMGNAME:$REV..."
|
||||
docker build --rm=true -t $IMGNAME:$REV -t $IMGNAME:latest docker/devenv
|
||||
docker build --rm=true -t $IMGNAME:$REV --build-arg EXTERNAL_UID=$(id -u) -t $IMGNAME:latest docker/devenv
|
||||
}
|
||||
|
||||
function run-devenv {
|
||||
|
@ -49,51 +49,40 @@ function run-devenv {
|
|||
$CONTAINER
|
||||
}
|
||||
|
||||
function test-devenv {
|
||||
function run-all-tests {
|
||||
echo "Testing frontend..."
|
||||
test-devenv-frontend || exit 1;
|
||||
run-frontend-tests || exit 1;
|
||||
echo "Testing backend..."
|
||||
test-devenv-backend || exit 1;
|
||||
run-backend-tests || exit 1;
|
||||
}
|
||||
|
||||
function test-devenv-frontend {
|
||||
# TODO Add frontend unit tests call
|
||||
echo "Not yet implemented!"
|
||||
function run-frontend-tests {
|
||||
if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
||||
build-devenv
|
||||
fi
|
||||
|
||||
# if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
||||
# build-devenv
|
||||
# fi
|
||||
#
|
||||
# CONTAINER=$IMGNAME:latest
|
||||
#
|
||||
# echo "Running development image $CONTAINER to test backend..."
|
||||
# docker run -ti --rm \
|
||||
# -w /home/uxbox/uxbox/backend \
|
||||
# -v `pwd`:/home/uxbox/uxbox \
|
||||
# -v $HOME/.m2:/home/uxbox/.m2 \
|
||||
# -e UXBOX_API_URL="/api" \
|
||||
# -e UXBOX_VIEW_URL="/view" \
|
||||
# $CONTAINER ./scripts/build-tests.sh
|
||||
CONTAINER=$IMGNAME:latest
|
||||
|
||||
echo "Running development image $CONTAINER to test backend..."
|
||||
docker run -ti --rm \
|
||||
-w /home/uxbox/uxbox/frontend \
|
||||
-v `pwd`:/home/uxbox/uxbox \
|
||||
-v $HOME/.m2:/home/uxbox/.m2 \
|
||||
$CONTAINER ./scripts/build-and-run-tests.sh
|
||||
}
|
||||
|
||||
function test-devenv-backend {
|
||||
# TODO Add backend unit tests call
|
||||
echo "Not yet implemented!"
|
||||
function run-backend-tests {
|
||||
if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
||||
build-devenv
|
||||
fi
|
||||
|
||||
# if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
||||
# build-devenv
|
||||
# fi
|
||||
#
|
||||
# CONTAINER=$IMGNAME:latest
|
||||
#
|
||||
# echo "Running development image $CONTAINER to test frontend..."
|
||||
# docker run -ti --rm \
|
||||
# -w /home/uxbox/uxbox/frontend \
|
||||
# -v `pwd`:/home/uxbox/uxbox \
|
||||
# -v $HOME/.m2:/home/uxbox/.m2 \
|
||||
# -e UXBOX_API_URL="/api" \
|
||||
# -e UXBOX_VIEW_URL="/view" \
|
||||
# $CONTAINER ./scripts/build-tests.sh
|
||||
CONTAINER=$IMGNAME:latest
|
||||
|
||||
docker run -ti --rm \
|
||||
-w /home/uxbox/uxbox/backend \
|
||||
-v `pwd`:/home/uxbox/uxbox \
|
||||
-v $HOME/.m2:/home/uxbox/.m2 \
|
||||
$CONTAINER ./scripts/run-tests-in-docker.sh
|
||||
}
|
||||
|
||||
function build-release-frontend-local {
|
||||
|
@ -103,9 +92,6 @@ function build-release-frontend-local {
|
|||
|
||||
mkdir -p $HOME/.m2
|
||||
rm -rf ./frontend/node_modules
|
||||
# FIXME Ugly... should be a better way
|
||||
chmod 777 ./frontend
|
||||
chmod -R 777 $HOME/.m2
|
||||
|
||||
CONTAINER=$IMGNAME:latest
|
||||
|
||||
|
@ -129,15 +115,14 @@ function build-release-frontend {
|
|||
|
||||
function build-release-backend-local {
|
||||
echo "Prepare backend release..."
|
||||
./backend/scripts/prepare-release.sh ./backend/ ./backend/dist/
|
||||
#rm -rf backend/dist || exit 1;
|
||||
#rsync -avr \
|
||||
# --exclude="/test" \
|
||||
# --exclude="/resources/public/media" \
|
||||
# --exclude="/target" \
|
||||
# --exclude="/scripts" \
|
||||
# --exclude="/.*" \
|
||||
# backend/ backend/dist/;
|
||||
|
||||
rsync -avr \
|
||||
--exclude="/test" \
|
||||
--exclude="/resources/public/media" \
|
||||
--exclude="/target" \
|
||||
--exclude="/scripts" \
|
||||
--exclude="/.*" \
|
||||
./backend/ ./backend/dist/
|
||||
}
|
||||
|
||||
function build-release-backend {
|
||||
|
@ -173,9 +158,9 @@ function usage {
|
|||
echo "- clean Stop and clean up docker containers"
|
||||
echo "- build-devenv Build docker container for development with tmux"
|
||||
echo "- run-devenv Run (and build if necessary) development container (frontend at localhost:3449, backend at localhost:6060)"
|
||||
echo "- test-devenv Execute unit tests for both backend and frontend"
|
||||
echo "- test-devenv-frontend Execute unit tests for frontend only"
|
||||
echo "- test-devenv-backend Execute unit tests for backend only"
|
||||
echo "- run-all-tests Execute unit tests for both backend and frontend"
|
||||
echo "- run-frontend-tests Execute unit tests for frontend only"
|
||||
echo "- run-backend-tests Execute unit tests for backend only"
|
||||
echo "- build-release Build 'production ready' docker images for both backend and frontend"
|
||||
echo "- build-release-frontend Build a 'production ready' docker images for frontend only"
|
||||
echo "- build-release-backend Build a 'production ready' docker images for backend only"
|
||||
|
@ -193,14 +178,14 @@ case $1 in
|
|||
run-devenv)
|
||||
run-devenv
|
||||
;;
|
||||
test-devenv)
|
||||
test-devenv
|
||||
run-all-tests)
|
||||
run-all-tests
|
||||
;;
|
||||
test-devenv-frontend)
|
||||
test-devenv-frontend
|
||||
run-frontend-tests)
|
||||
run-frontend-tests
|
||||
;;
|
||||
test-devenv-backend)
|
||||
test-devenv-backend
|
||||
run-backend-tests)
|
||||
run-backend-tests
|
||||
;;
|
||||
build-release)
|
||||
build-release
|
||||
|
|
Loading…
Add table
Reference in a new issue