mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05:00
Merge pull request #98 from Monogramm/build-refactor
Add CI for build refactor
This commit is contained in:
commit
712269aa35
10 changed files with 174 additions and 39 deletions
22
.travis.yml
22
.travis.yml
|
@ -13,6 +13,7 @@ branches:
|
||||||
- master
|
- master
|
||||||
- wip
|
- wip
|
||||||
- develop
|
- develop
|
||||||
|
- build-refactor
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ./manage.sh help
|
- ./manage.sh help
|
||||||
|
@ -28,18 +29,19 @@ script:
|
||||||
after_script:
|
after_script:
|
||||||
- docker images
|
- docker images
|
||||||
- docker ps
|
- 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=7.7.1 COMMAND=build
|
- NODE_VERSION=10.16.0 COMMAND=clean
|
||||||
- NODE_VERSION=7.7.1 COMMAND=test
|
- NODE_VERSION=10.16.0 COMMAND=build-devenv
|
||||||
- NODE_VERSION=7.7.1 COMMAND=release-local
|
#- NODE_VERSION=10.16.0 COMMAND=run-devenv
|
||||||
- NODE_VERSION=7.7.1 COMMAND=release-docker
|
- NODE_VERSION=10.16.0 COMMAND=test-devenv
|
||||||
- NODE_VERSION=7.7.1 COMMAND=run-release
|
- NODE_VERSION=10.16.0 COMMAND=build-release
|
||||||
- NODE_VERSION=8.15.0 COMMAND=build
|
- NODE_VERSION=10.16.0 COMMAND=build-release-frontend
|
||||||
- NODE_VERSION=8.15.0 COMMAND=test
|
- NODE_VERSION=10.16.0 COMMAND=build-release-backend
|
||||||
- NODE_VERSION=8.15.0 COMMAND=release-local
|
- NODE_VERSION=10.16.0 COMMAND=run-release
|
||||||
- NODE_VERSION=8.15.0 COMMAND=release-docker
|
|
||||||
- NODE_VERSION=8.15.0 COMMAND=run-release
|
|
||||||
|
|
6
backend/scripts/build-tests.sh
Executable file
6
backend/scripts/build-tests.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "Not yet implemented!"
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
#lein test
|
16
backend/scripts/prepare-release.sh
Executable file
16
backend/scripts/prepare-release.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ "$#" -e 0 ]; then
|
||||||
|
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;
|
0
backend/scripts/smtpd.sh
Normal file → Executable file
0
backend/scripts/smtpd.sh
Normal file → Executable file
|
@ -4,6 +4,7 @@ LABEL maintainer="Andrey Antukh <niwi@niwi.nz>"
|
||||||
ARG EXTERNAL_UID=1000
|
ARG EXTERNAL_UID=1000
|
||||||
|
|
||||||
ENV NODE_VERSION=v10.16.0 \
|
ENV NODE_VERSION=v10.16.0 \
|
||||||
|
CLOJURE_VERSION=1.10.0.442 \
|
||||||
LANG=en_US.UTF-8 \
|
LANG=en_US.UTF-8 \
|
||||||
LC_ALL=C.UTF-8
|
LC_ALL=C.UTF-8
|
||||||
|
|
||||||
|
@ -63,10 +64,10 @@ RUN set -ex; \
|
||||||
echo "uxbox ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
echo "uxbox ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
wget https://download.clojure.org/install/linux-install-1.10.0.442.sh; \
|
wget "https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh"; \
|
||||||
chmod +x linux-install-1.10.0.442.sh; \
|
chmod +x "linux-install-$CLOJURE_VERSION.sh"; \
|
||||||
./linux-install-1.10.0.442.sh; \
|
"./linux-install-$CLOJURE_VERSION.sh"; \
|
||||||
rm -rf linux-install-1.10.0.442.sh
|
rm -rf "linux-install-$CLOJURE_VERSION.sh"
|
||||||
|
|
||||||
USER uxbox
|
USER uxbox
|
||||||
WORKDIR /home/uxbox
|
WORKDIR /home/uxbox
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
set -e
|
set -e
|
||||||
echo "UXBOX Docker entrypoint initialization..."
|
echo "UXBOX Docker Dev entrypoint initialization..."
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -2,22 +2,24 @@ FROM openjdk:8-jre
|
||||||
|
|
||||||
LABEL maintainer="Monogramm Maintainers <opensource at monogramm dot io>"
|
LABEL maintainer="Monogramm Maintainers <opensource at monogramm dot io>"
|
||||||
|
|
||||||
ENV LANG=en_US.UTF-8 \
|
ENV CLOJURE_VERSION=1.10.0.442 \
|
||||||
|
LANG=en_US.UTF-8 \
|
||||||
LC_ALL=C.UTF-8
|
LC_ALL=C.UTF-8
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
wget https://download.clojure.org/install/linux-install-1.10.0.442.sh; \
|
|
||||||
chmod +x linux-install-1.10.0.442.sh; \
|
|
||||||
./linux-install-1.10.0.442.sh; \
|
|
||||||
rm -rf linux-install-1.10.0.442.sh
|
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apt-get update -yq && \
|
apt-get update -yq && \
|
||||||
apt-get install -yq \
|
apt-get install -yq \
|
||||||
|
curl \
|
||||||
git \
|
git \
|
||||||
imagemagick \
|
imagemagick \
|
||||||
webp
|
webp
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
wget "https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh"; \
|
||||||
|
chmod +x "linux-install-$CLOJURE_VERSION.sh"; \
|
||||||
|
"./linux-install-$CLOJURE_VERSION.sh"; \
|
||||||
|
rm -rf "linux-install-$CLOJURE_VERSION.sh"
|
||||||
|
|
||||||
COPY ./entrypoint.sh /entrypoint.sh
|
COPY ./entrypoint.sh /entrypoint.sh
|
||||||
COPY ./dist /srv/uxbox
|
COPY ./dist /srv/uxbox
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
"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:main": "clojure -Adev tools.clj build main",
|
||||||
|
"build:view": "clojure -Adev tools.clj build view",
|
||||||
"build:worker": "clojure -Adev tools.clj build worker",
|
"build:worker": "clojure -Adev tools.clj build worker",
|
||||||
"figwheel": "clojure -Adev tools.clj figwheel"
|
"figwheel": "clojure -Adev tools.clj figwheel"
|
||||||
},
|
},
|
||||||
|
|
10
frontend/scripts/build-tests.sh
Normal file
10
frontend/scripts/build-tests.sh
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/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
|
130
manage.sh
130
manage.sh
|
@ -34,6 +34,9 @@ function run-devenv {
|
||||||
|
|
||||||
mkdir -p $HOME/.m2
|
mkdir -p $HOME/.m2
|
||||||
rm -rf ./frontend/node_modules
|
rm -rf ./frontend/node_modules
|
||||||
|
mkdir -p \
|
||||||
|
./frontend/resources/public/css \
|
||||||
|
./frontend/resources/public/view/css
|
||||||
|
|
||||||
CONTAINER=$IMGNAME:latest
|
CONTAINER=$IMGNAME:latest
|
||||||
|
|
||||||
|
@ -46,14 +49,74 @@ function run-devenv {
|
||||||
$CONTAINER
|
$CONTAINER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test-devenv {
|
||||||
|
echo "Testing frontend..."
|
||||||
|
test-devenv-frontend || exit 1;
|
||||||
|
echo "Testing backend..."
|
||||||
|
test-devenv-backend || exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function test-devenv-frontend {
|
||||||
|
# TODO Add frontend unit tests call
|
||||||
|
echo "Not yet implemented!"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
function test-devenv-backend {
|
||||||
|
# TODO Add backend unit tests call
|
||||||
|
echo "Not yet implemented!"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
function build-release-frontend-local {
|
function build-release-frontend-local {
|
||||||
|
if ! $(docker images | grep $IMGNAME | grep -q $REV); then
|
||||||
|
build-devenv
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "Running development image $CONTAINER to build frontend release..."
|
||||||
docker run -ti --rm \
|
docker run -ti --rm \
|
||||||
-w /home/uxbox/uxbox/frontend \
|
-w /home/uxbox/uxbox/frontend \
|
||||||
-v `pwd`:/home/uxbox/uxbox \
|
-v `pwd`:/home/uxbox/uxbox \
|
||||||
-v $HOME/.m2:/home/uxbox/.m2 \
|
-v $HOME/.m2:/home/uxbox/.m2 \
|
||||||
-e UXBOX_API_URL="/api" \
|
-e UXBOX_API_URL="/api" \
|
||||||
-e UXBOX_VIEW_URL="/view" \
|
-e UXBOX_VIEW_URL="/view" \
|
||||||
$IMGNAME:latest ./scripts/build-release.sh
|
$CONTAINER ./scripts/build-release.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
function build-release-frontend {
|
function build-release-frontend {
|
||||||
|
@ -64,32 +127,59 @@ function build-release-frontend {
|
||||||
rm -rf docker/release.frontend/dist || exit 1;
|
rm -rf docker/release.frontend/dist || exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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/;
|
||||||
|
}
|
||||||
|
|
||||||
function build-release-backend {
|
function build-release-backend {
|
||||||
|
build-release-backend-local || exit 1;
|
||||||
rm -rf docker/release.backend/dist || exit 1;
|
rm -rf docker/release.backend/dist || exit 1;
|
||||||
rsync -avr \
|
cp -r backend/dist docker/release.backend/ || exit 1;
|
||||||
--exclude="/test" \
|
|
||||||
--exclude="/resources/public/media" \
|
|
||||||
--exclude="/target" \
|
|
||||||
--exclude="/scripts" \
|
|
||||||
--exclude="/.*" \
|
|
||||||
backend/ docker/release.backend/dist/;
|
|
||||||
docker build --rm=true -t ${IMGNAME}-backend:$REV -t ${IMGNAME}-backend:latest docker/release.backend/
|
docker build --rm=true -t ${IMGNAME}-backend:$REV -t ${IMGNAME}-backend:latest docker/release.backend/
|
||||||
rm -rf docker/release.backend/dist || exit 1;
|
rm -rf docker/release.backend/dist || exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function build-release {
|
function build-release {
|
||||||
|
echo "Building frontend release..."
|
||||||
build-release-frontend || exit 1;
|
build-release-frontend || exit 1;
|
||||||
|
echo "Building backend release..."
|
||||||
build-release-backend || exit 1;
|
build-release-backend || exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run-release {
|
||||||
|
kill-container
|
||||||
|
|
||||||
|
if ! $(docker images | grep $IMGNAME-backend | grep -q $REV); then
|
||||||
|
build-release
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running production images..."
|
||||||
|
sudo docker-compose -f ./docker/docker-compose.yml up -d
|
||||||
|
}
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
echo "UXBOX build & release manager v$REV"
|
echo "UXBOX build & release manager v$REV"
|
||||||
echo "USAGE: $0 [ clean | build | run | test | release-local | release-docker | run-release ]"
|
echo "USAGE: $0 OPTION"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
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 "- build-release Build a 'production ready' release docker images"
|
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 "- 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"
|
||||||
|
echo "- run-release Run 'production ready' docker images for both backend and frontend"
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -103,11 +193,14 @@ case $1 in
|
||||||
run-devenv)
|
run-devenv)
|
||||||
run-devenv
|
run-devenv
|
||||||
;;
|
;;
|
||||||
release-docker)
|
test-devenv)
|
||||||
release_image
|
test-devenv
|
||||||
;;
|
;;
|
||||||
run-release)
|
test-devenv-frontend)
|
||||||
run_release
|
test-devenv-frontend
|
||||||
|
;;
|
||||||
|
test-devenv-backend)
|
||||||
|
test-devenv-backend
|
||||||
;;
|
;;
|
||||||
build-release)
|
build-release)
|
||||||
build-release
|
build-release
|
||||||
|
@ -118,6 +211,9 @@ case $1 in
|
||||||
build-release-backend)
|
build-release-backend)
|
||||||
build-release-backend
|
build-release-backend
|
||||||
;;
|
;;
|
||||||
|
run-release)
|
||||||
|
run-release
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue