mirror of
https://framagit.org/framasoft/framadate/framadate
synced 2026-01-23 10:15:16 +00:00
218 lines
6.1 KiB
YAML
218 lines
6.1 KiB
YAML
variables:
|
|
TESTING_IMAGE: framasoft/framadate-ci:7.3-pdo_sqlite
|
|
|
|
image: ${TESTING_IMAGE}
|
|
|
|
cache:
|
|
key: "${TESTING_IMAGE}:${CI_PROJECT_ID}"
|
|
paths:
|
|
- vendor/
|
|
|
|
# Always install composer deps
|
|
before_script:
|
|
- composer install -o --no-interaction --no-progress --prefer-dist
|
|
|
|
stages:
|
|
- test
|
|
- e2e
|
|
- deploy
|
|
- beta
|
|
- funky
|
|
|
|
# Run phpunit on all branches for all PHP supported versions
|
|
.test:
|
|
stage: test
|
|
script:
|
|
- vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests
|
|
|
|
test:php:7.1:
|
|
extends: .test
|
|
image: framasoft/framadate-ci:7.1-pdo_sqlite
|
|
|
|
test:php:7.2:
|
|
extends: .test
|
|
image: framasoft/framadate-ci:7.2-pdo_sqlite
|
|
|
|
test:php:7.3:
|
|
extends: .test
|
|
image: framasoft/framadate-ci:7.3-pdo_sqlite
|
|
|
|
test:php:7.4:
|
|
extends: .test
|
|
image: framasoft/framadate-ci:7.4-rc-pdo_sqlite
|
|
allow_failure: true
|
|
|
|
# Run cypress on all branches, for all PHP supported versions
|
|
.e2e-test:
|
|
stage: e2e
|
|
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}"
|
|
before_script:
|
|
- yarn install
|
|
- bin/doctrine migrations:migrate --no-interaction -vvv
|
|
script:
|
|
- php -S localhost:8080 &
|
|
- if [ -z "$CYPRESS_KEY" ]; then npx cypress run; else npx cypress run --record --key $CYPRESS_KEY; fi
|
|
services:
|
|
- 'postgres:11'
|
|
|
|
e2e-test:php:7.1:
|
|
extends: .e2e-test
|
|
image: framasoft/framadate-ci:7.1-pdo_pgsql-cypress
|
|
|
|
e2e-test:php:7.2:
|
|
extends: .e2e-test
|
|
image: framasoft/framadate-ci:7.2-pdo_pgsql-cypress
|
|
|
|
e2e-test:php:7.3:
|
|
extends: .e2e-test
|
|
image: framasoft/framadate-ci:7.3-pdo_pgsql-cypress
|
|
|
|
e2e-test:php:7.4:
|
|
extends: .e2e-test
|
|
image: framasoft/framadate-ci:7.4-rc-pdo_pgsql-cypress
|
|
allow_failure: true
|
|
|
|
# Run php-cs-fixer on all branches
|
|
lint:
|
|
stage: test
|
|
script:
|
|
- php vendor/bin/php-cs-fixer fix --verbose --dry-run --diff
|
|
|
|
# Run doctrine migrations with all MySQL supported versions
|
|
.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}"
|
|
image: framasoft/framadate-ci:7.3-pdo_mysql
|
|
script:
|
|
- bin/doctrine migrations:status -vvv
|
|
- bin/doctrine migrations:migrate --no-interaction -vvv
|
|
- bin/doctrine migrations:status -vvv
|
|
|
|
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}"
|
|
image: framasoft/framadate-ci:7.3-pdo_pgsql
|
|
script:
|
|
- 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'
|
|
|
|
db:migration:postgresql:10:
|
|
extends: .db:migration:postgresql
|
|
services:
|
|
- 'postgres:10'
|
|
|
|
db:migration:postgresql:11:
|
|
extends: .db:migration:postgresql
|
|
services:
|
|
- 'postgres:11'
|
|
|
|
db:migration:postgresql:12:
|
|
extends: .db:migration:postgresql
|
|
services:
|
|
- 'postgres:12'
|
|
|
|
# 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
|
|
- 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
|