2019-04-19 14:32:56 +02:00
variables :
TESTING_IMAGE : framasoft/framadate-ci:php-7.2
image : ${TESTING_IMAGE}
cache :
key : "${TESTING_IMAGE}:${CI_PROJECT_ID}"
paths :
- vendor/
before_script :
- composer install -o --no-interaction --no-progress --prefer-dist
2017-12-14 15:30:21 +01:00
stages :
2018-02-20 08:43:46 +01:00
- test
2017-12-14 15:30:21 +01:00
- deploy
2018-03-28 16:50:00 +02:00
- beta
2017-12-14 15:30:21 +01:00
- funky
2018-02-20 08:43:46 +01:00
2019-04-19 14:32:56 +02:00
# Run phpunit on all branches
2018-02-20 08:43:46 +01:00
test :
stage : test
script :
- vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests
2019-04-19 14:32:56 +02:00
# Run php-cs-fixer on all branches
lint :
stage : test
script :
- php vendor/bin/php-cs-fixer fix --verbose --dry-run
# Run doctrine migrations with MySQL
.db:migration:mysql :
stage : test
variables :
APP_ENV : "test"
MYSQL_DATABASE : "fd_test"
MYSQL_ROOT_PASSWORD : "coucou"
FRAMADATE_DB_DRIVER : 'pdo_mysql'
FRAMADATE_DB_HOST : "mysql"
FRAMADATE_DB_NAME : "${MYSQL_DATABASE}"
FRAMADATE_DB_USER : "root"
FRAMADATE_DB_PASSWORD : "${MYSQL_ROOT_PASSWORD}"
script :
- docker-php-ext-install "${FRAMADATE_DB_DRIVER}"
- bin/doctrine migrations:status -vvv
- bin/doctrine migrations:migrate --no-interaction -vvv
- bin/doctrine migrations:status -vvv
db:migration:mysql:5.6 :
extends : .db:migration:mysql
services :
- 'mysql:5.6'
db:migration:mysql:5.7 :
extends : .db:migration:mysql
services :
- 'mysql:5.7'
db:migration:mysql:8 :
extends : .db:migration:mysql
services :
- name : 'mysql:8'
command : [ '--default-authentication-plugin=mysql_native_password' ]
# Run doctrine migrations with PostgreSQL
.db:migration:postgresql :
stage : test
variables :
APP_ENV : "test"
POSTGRES_DB : "fd_test"
POSTGRES_USER : "marmotte"
POSTGRES_PASSWORD : "sleeping"
FRAMADATE_DB_DRIVER : 'pdo_pgsql'
FRAMADATE_DB_HOST : "postgres"
FRAMADATE_DB_NAME : "${POSTGRES_DB}"
FRAMADATE_DB_USER : "${POSTGRES_USER}"
FRAMADATE_DB_PASSWORD : "${POSTGRES_PASSWORD}"
script :
- docker-php-ext-install "${FRAMADATE_DB_DRIVER}"
- bin/doctrine migrations:status -vvv
- bin/doctrine migrations:migrate --no-interaction -vvv
- bin/doctrine migrations:status -vvv
db:migration:postgresql:9.6 :
extends : .db:migration:postgresql
services :
- 'postgres:9.6'
2018-02-20 08:43:46 +01:00
2019-04-16 14:46:59 +02:00
check:missing:trads :
stage : test
script :
- ./scripts/check-translations.py
2018-07-11 14:05:25 +02:00
# check-trad:
# stage: test
# allow_failure: true
# script:
# - if [ -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then echo "*** Unable to check if translations need to be pulled, exiting ***"; exit 1; fi
# - export ORIG=$(git diff-files --shortstat)
# - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
# - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make push-locales; fi
# - git status > /dev/null 2>&1
# - export CHANGES=$(git diff-files --shortstat)
# - if [[ $CHANGES != $ORIG ]]; then echo "*** There is changes in locales ***"; echo "*** You need to do `make pull-locales` in your repo ***"; exit 1; fi
# only:
# - develop
2018-04-05 10:46:55 +02:00
2018-02-20 08:43:46 +01:00
# Create artifacts on master
pages :
stage : deploy
2017-12-14 15:30:21 +01:00
script :
- latesttag=$(git describe --tags)
- git checkout ${latesttag}
2018-03-19 13:06:31 +01:00
- composer install -o --no-interaction --no-progress --prefer-dist --no-dev
- composer dump-autoload --optimize --no-dev --classmap-authoritative
2018-03-19 10:45:35 +01:00
- mkdir framadate
2018-03-19 11:09:12 +01:00
- mv `ls -A | grep -v framadate` ./framadate
2018-08-03 14:06:23 +02:00
- find framadate/ -type d -exec chmod 750 {} \;
- find framadate/ -type f -exec chmod 640 {} \;
2019-01-07 08:42:11 +01:00
- rm -rf framadate/.git
2018-03-19 10:45:35 +01:00
- zip -r latest.zip framadate
2017-12-14 15:30:21 +01:00
- mkdir .public
- cp latest.zip .public
- mv .public public
artifacts :
paths :
- public
only :
2018-04-10 21:56:01 +02:00
- tags
except :
- (beta|alpha)
2018-02-19 00:38:51 +01:00
2018-03-28 16:50:00 +02:00
# Deploy on develop
2018-03-28 16:55:04 +02:00
beta :
2018-03-28 16:50:00 +02:00
stage : beta
script :
- composer install -o --no-interaction --no-progress --prefer-dist --no-dev
- composer dump-autoload --optimize --no-dev --classmap-authoritative
2018-07-11 14:07:34 +02:00
# - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
# - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make pull-locales; fi
2018-03-28 16:50:00 +02:00
- mkdir .public
- cp -r * .public
2018-04-02 11:32:08 +02:00
- cp -r .git .public
2018-03-28 16:50:00 +02:00
- mv .public public
- mkdir "${HOME}/.ssh"
- chmod 700 "${HOME}/.ssh"
- if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
- eval `ssh-agent -s`
- if [ ! -z ${BETA_KEY+x} ]; then ssh-add <(echo "${BETA_KEY}" | base64 --decode -i); fi
- if [ ! -z ${BETA_KEY+x} ]; then rsync -a --delete --exclude admin/.stdout.log --exclude admin/.htpasswd --exclude app/inc/config.php --exclude stats/ --exclude error/ public/ ${BETA_USER}@${DEPLOYEMENT_HOST}:../../web/; fi
only :
- develop
2018-02-20 08:43:46 +01:00
# Deploy on funky
2017-12-14 15:30:21 +01:00
funky :
stage : funky
script :
2018-03-19 13:06:31 +01:00
- composer install
2017-12-14 15:30:21 +01:00
- mkdir tpl_c
- mkdir .public
- cp -r * .public
- mv .public public
- mkdir "${HOME}/.ssh"
- chmod 700 "${HOME}/.ssh"
- if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
- eval `ssh-agent -s`
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}" | base64 --decode -i); fi
2018-02-21 11:36:27 +01:00
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then rsync -a --delete --exclude admin/.stdout.log --exclude admin/.htpasswd --exclude app/inc/config.php --exclude stats/ --exclude error/ public/ ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/; fi
2017-12-14 15:30:21 +01:00
only :
- funky
2018-02-28 09:43:53 +01:00
# Push new translations strings to https://trad.framasoft.org
2018-07-11 14:05:25 +02:00
# trads:
# stage: deploy
# image: framasoft/push-trad:latest
# script:
# - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
# - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make push-locales; fi
# only:
# - develop
2018-08-17 13:58:08 +02:00
# - master