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 stages: - test - deploy - beta - funky # Run phpunit on all branches test: stage: test script: - vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests # 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' check:missing:trads: stage: test script: - ./scripts/check-translations.py # 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 # Create artifacts on master pages: stage: deploy script: - latesttag=$(git describe --tags) - git checkout ${latesttag} - composer install -o --no-interaction --no-progress --prefer-dist --no-dev - composer dump-autoload --optimize --no-dev --classmap-authoritative - mkdir framadate - mv `ls -A | grep -v framadate` ./framadate - find framadate/ -type d -exec chmod 750 {} \; - find framadate/ -type f -exec chmod 640 {} \; - rm -rf framadate/.git - zip -r latest.zip framadate - mkdir .public - cp latest.zip .public - mv .public public artifacts: paths: - public only: - tags except: - (beta|alpha) # Deploy on develop beta: stage: beta script: - composer install -o --no-interaction --no-progress --prefer-dist --no-dev - composer dump-autoload --optimize --no-dev --classmap-authoritative # - 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 - mkdir .public - cp -r * .public - cp -r .git .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 ${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 # Deploy on funky funky: stage: funky script: - composer install - 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 - 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 only: - funky # Push new translations strings to https://trad.framasoft.org # 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 # - master