mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 17:06:38 +02: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
|
dist: xenial
|
||||||
|
|
||||||
language: clojure
|
language: generic
|
||||||
sudo: required
|
sudo: required
|
||||||
lein: lein
|
|
||||||
jdk:
|
cache:
|
||||||
- openjdk8
|
directories:
|
||||||
|
- $HOME/.m2
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
- wip
|
|
||||||
- develop
|
- develop
|
||||||
- build-refactor
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ./manage.sh help
|
- curl -O https://download.clojure.org/install/linux-install-1.10.1.447.sh
|
||||||
- nvm install $NODE_VERSION
|
- chmod +x linux-install-1.10.1.447.sh
|
||||||
- node --version
|
- sudo ./linux-install-1.10.1.447.sh
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- env | sort
|
- env | sort
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./manage.sh $COMMAND
|
- ./manage.sh build-devenv
|
||||||
|
- ./manage.sh run-frontend-tests
|
||||||
|
- ./manage.sh run-backend-tests
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- docker images
|
- 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:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- NODE_VERSION=10.16.0 COMMAND=clean
|
- NODE_VERSION=10.16.0
|
||||||
- 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
|
|
||||||
|
|
|
@ -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
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ "$#" -e 0 ]; then
|
if [ "$#" -e 0 ]; then
|
||||||
echo "Expecting parameters: 1=path to backend; 2=destination directory"
|
echo "Expecting parameters: 1=path to backend; 2=destination directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf $2 || exit 1;
|
rm -rf $2 || exit 1;
|
||||||
|
|
||||||
rsync -avr \
|
rsync -avr \
|
||||||
--exclude="/test" \
|
--exclude="/test" \
|
||||||
--exclude="/resources/public/media" \
|
--exclude="/resources/public/media" \
|
||||||
--exclude="/target" \
|
--exclude="/target" \
|
||||||
--exclude="/scripts" \
|
--exclude="/scripts" \
|
||||||
--exclude="/.*" \
|
--exclude="/.*" \
|
||||||
$1 $2;
|
$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",
|
"dist:assets": "gulp dist",
|
||||||
"prod": "gulp dist --production",
|
"prod": "gulp dist --production",
|
||||||
"start": "npm run figwheel",
|
"start": "npm run figwheel",
|
||||||
|
"build:test": "clojure -Adev tools.clj build-tests",
|
||||||
"build:main": "clojure -Adev tools.clj build main",
|
"build:main": "clojure -Adev tools.clj build main",
|
||||||
"build:view": "clojure -Adev tools.clj build view",
|
"build:view": "clojure -Adev tools.clj build view",
|
||||||
"build:worker": "clojure -Adev tools.clj build worker",
|
"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 {
|
function build-devenv {
|
||||||
kill-container
|
kill-container
|
||||||
echo "Building development image $IMGNAME:$REV..."
|
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 {
|
function run-devenv {
|
||||||
|
@ -49,51 +49,40 @@ function run-devenv {
|
||||||
$CONTAINER
|
$CONTAINER
|
||||||
}
|
}
|
||||||
|
|
||||||
function test-devenv {
|
function run-all-tests {
|
||||||
echo "Testing frontend..."
|
echo "Testing frontend..."
|
||||||
test-devenv-frontend || exit 1;
|
run-frontend-tests || exit 1;
|
||||||
echo "Testing backend..."
|
echo "Testing backend..."
|
||||||
test-devenv-backend || exit 1;
|
run-backend-tests || exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function test-devenv-frontend {
|
function run-frontend-tests {
|
||||||
# TODO Add frontend unit tests call
|
if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
||||||
echo "Not yet implemented!"
|
build-devenv
|
||||||
|
fi
|
||||||
|
|
||||||
# if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
CONTAINER=$IMGNAME:latest
|
||||||
# build-devenv
|
|
||||||
# fi
|
echo "Running development image $CONTAINER to test backend..."
|
||||||
#
|
docker run -ti --rm \
|
||||||
# CONTAINER=$IMGNAME:latest
|
-w /home/uxbox/uxbox/frontend \
|
||||||
#
|
-v `pwd`:/home/uxbox/uxbox \
|
||||||
# echo "Running development image $CONTAINER to test backend..."
|
-v $HOME/.m2:/home/uxbox/.m2 \
|
||||||
# docker run -ti --rm \
|
$CONTAINER ./scripts/build-and-run-tests.sh
|
||||||
# -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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test-devenv-backend {
|
function run-backend-tests {
|
||||||
# TODO Add backend unit tests call
|
if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
||||||
echo "Not yet implemented!"
|
build-devenv
|
||||||
|
fi
|
||||||
|
|
||||||
# if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
CONTAINER=$IMGNAME:latest
|
||||||
# build-devenv
|
|
||||||
# fi
|
docker run -ti --rm \
|
||||||
#
|
-w /home/uxbox/uxbox/backend \
|
||||||
# CONTAINER=$IMGNAME:latest
|
-v `pwd`:/home/uxbox/uxbox \
|
||||||
#
|
-v $HOME/.m2:/home/uxbox/.m2 \
|
||||||
# echo "Running development image $CONTAINER to test frontend..."
|
$CONTAINER ./scripts/run-tests-in-docker.sh
|
||||||
# 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function build-release-frontend-local {
|
function build-release-frontend-local {
|
||||||
|
@ -103,9 +92,6 @@ function build-release-frontend-local {
|
||||||
|
|
||||||
mkdir -p $HOME/.m2
|
mkdir -p $HOME/.m2
|
||||||
rm -rf ./frontend/node_modules
|
rm -rf ./frontend/node_modules
|
||||||
# FIXME Ugly... should be a better way
|
|
||||||
chmod 777 ./frontend
|
|
||||||
chmod -R 777 $HOME/.m2
|
|
||||||
|
|
||||||
CONTAINER=$IMGNAME:latest
|
CONTAINER=$IMGNAME:latest
|
||||||
|
|
||||||
|
@ -129,15 +115,14 @@ function build-release-frontend {
|
||||||
|
|
||||||
function build-release-backend-local {
|
function build-release-backend-local {
|
||||||
echo "Prepare backend release..."
|
echo "Prepare backend release..."
|
||||||
./backend/scripts/prepare-release.sh ./backend/ ./backend/dist/
|
|
||||||
#rm -rf backend/dist || exit 1;
|
rsync -avr \
|
||||||
#rsync -avr \
|
--exclude="/test" \
|
||||||
# --exclude="/test" \
|
--exclude="/resources/public/media" \
|
||||||
# --exclude="/resources/public/media" \
|
--exclude="/target" \
|
||||||
# --exclude="/target" \
|
--exclude="/scripts" \
|
||||||
# --exclude="/scripts" \
|
--exclude="/.*" \
|
||||||
# --exclude="/.*" \
|
./backend/ ./backend/dist/
|
||||||
# backend/ backend/dist/;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function build-release-backend {
|
function build-release-backend {
|
||||||
|
@ -173,9 +158,9 @@ function usage {
|
||||||
echo "- clean Stop and clean up docker containers"
|
echo "- clean Stop and clean up docker containers"
|
||||||
echo "- build-devenv Build docker container for development with tmux"
|
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 "- 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 "- run-all-tests Execute unit tests for both backend and frontend"
|
||||||
echo "- test-devenv-frontend Execute unit tests for frontend only"
|
echo "- run-frontend-tests Execute unit tests for frontend only"
|
||||||
echo "- test-devenv-backend Execute unit tests for backend 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 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-frontend Build a 'production ready' docker images for frontend only"
|
||||||
echo "- build-release-backend Build a 'production ready' docker images for backend 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)
|
||||||
run-devenv
|
run-devenv
|
||||||
;;
|
;;
|
||||||
test-devenv)
|
run-all-tests)
|
||||||
test-devenv
|
run-all-tests
|
||||||
;;
|
;;
|
||||||
test-devenv-frontend)
|
run-frontend-tests)
|
||||||
test-devenv-frontend
|
run-frontend-tests
|
||||||
;;
|
;;
|
||||||
test-devenv-backend)
|
run-backend-tests)
|
||||||
test-devenv-backend
|
run-backend-tests
|
||||||
;;
|
;;
|
||||||
build-release)
|
build-release)
|
||||||
build-release
|
build-release
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue