mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
145 lines
4.5 KiB
YAML
145 lines
4.5 KiB
YAML
stages:
|
|
- analyze
|
|
- test
|
|
|
|
# in gitlab you must define these variables:
|
|
# MYSQL_DATABASE - database name prefix
|
|
# MYSQL_PASSWORD - mysql user password
|
|
# MYSQL_USER - mysql username
|
|
# MYSQL_ROOT_PASSWORD - mysql root password
|
|
# PG_DATABASE - postgres database
|
|
# PG_USER - postgres R/W username
|
|
# PG_PASSWORD - postgres R/W password
|
|
# PG_RO_USER - postgres R/O user
|
|
# PG_RO_PASS - postgres R/O password
|
|
#
|
|
# optional variables that can be set:
|
|
# MYSQL_INIT_DB - create fresh DB with phinx, don't restore sql dump
|
|
# TEST_SSL_HOST - The name of hostname you control having a valid SSL certificate
|
|
# WAIT_ON_FINISH - sleep for 1h after successful execution, useful for debugging
|
|
|
|
variables:
|
|
COMPOSER_HOME: ${CI_PROJECT_DIR}/.composer
|
|
CYPRESS_CACHE_FOLDER: ${CI_PROJECT_DIR}/node_modules/.cypress-cache
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
MEMCACHED_NAMESPACE: $CI_COMMIT_SHORT_SHA
|
|
MYSQL_DATABASE: ${MYSQL_DATABASE}_${CI_COMMIT_SHORT_SHA}
|
|
MYSQL_PASSWORD: $MYSQL_PASSWORD
|
|
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
|
|
MYSQL_USER: $MYSQL_USER
|
|
POSTGRES_DATABASE: ${PG_DATABASE}_${CI_COMMIT_SHORT_SHA}
|
|
POSTGRES_USER: $PG_USER
|
|
POSTGRES_PASSWORD: $PG_PASSWORD
|
|
POSTGRES_USER_PASS: $PG_PASSWORD
|
|
PG_RO_USER: $PG_RO_USER
|
|
PG_RO_PASS: $PG_RO_PASS
|
|
|
|
phpstan:
|
|
stage: analyze
|
|
image:
|
|
name: gazelle-phpstan:latest
|
|
entrypoint: [""]
|
|
cache:
|
|
- key:
|
|
files:
|
|
- composer.json
|
|
- composer.lock
|
|
prefix: vendor
|
|
paths:
|
|
- vendor
|
|
- .composer
|
|
script:
|
|
- composer install --no-progress
|
|
- bin/local-patch
|
|
- phpstan --version
|
|
- phpstan analyse --no-progress --configuration misc/phpstan.neon
|
|
|
|
e2e-tests:
|
|
stage: test
|
|
image:
|
|
name: gazelle-e2e-testing
|
|
entrypoint: [""]
|
|
services:
|
|
- name: memcached:1.6.34-alpine
|
|
alias: memcached
|
|
- name: postgres-orpheus
|
|
alias: postgres
|
|
- name: percona:ps-8.0.40-31
|
|
alias: mysql
|
|
command:
|
|
- --datadir=/dev/shm/mysql
|
|
- --binlog-do-db=
|
|
- --group-concat-max-len=1048576
|
|
- --character-set-server=utf8mb4
|
|
- --collation-server=utf8mb4_0900_ai_ci
|
|
- --userstat=on
|
|
- --sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
|
|
- --authentication-policy=mysql_native_password
|
|
variables:
|
|
ENV: dev
|
|
MYSQL_HOST: mysql
|
|
PGHOST: postgres
|
|
POSTGRES_DB_USER: gazelle
|
|
PGUSER: $POSTGRES_DB_USER
|
|
PGDATABASE: $POSTGRES_DATABASE
|
|
PG_RO_USER: $PG_RO_USER
|
|
PG_RO_PASS: $PG_RO_PASS
|
|
PGDATA: /dev/shm/pg
|
|
TEST_SSL_HOST: $TEST_SSL_HOST
|
|
#ELECTRON_RUN_AS_NODE: 1
|
|
cache:
|
|
- key:
|
|
files:
|
|
- composer.json
|
|
- composer.lock
|
|
prefix: vendor
|
|
paths:
|
|
- vendor
|
|
- .composer
|
|
- key:
|
|
files:
|
|
- package.json
|
|
- package-lock.json
|
|
prefix: npm
|
|
paths:
|
|
- node_modules
|
|
- key:
|
|
files:
|
|
- misc/docker/sphinxsearch/sphinx.conf
|
|
prefix: sphinx
|
|
paths:
|
|
- .sphinxsearch
|
|
coverage: /^\s*Lines:\s*\d+.\d+\%/
|
|
script:
|
|
- /bin/bash "${CI_PROJECT_DIR}/misc/docker/web/bootstrap-base.sh"
|
|
- su gazelle -c "bin/twig-parse \$(find templates -type f)"
|
|
- /bin/bash "${CI_PROJECT_DIR}/misc/docker/web/start-services.sh"
|
|
- su gazelle -c "${CI_PROJECT_DIR}/vendor/bin/phpunit -c misc/phpunit.xml --coverage-php /tmp/coverage/phpunit.cov --exclude-group no-ci"
|
|
- /bin/bash "${CI_PROJECT_DIR}/misc/docker/web/bootstrap-npm.sh"
|
|
- su gazelle -c "make lint-js"
|
|
- npx cypress run || test "$WAIT_ON_FINISH"
|
|
# note: phpcov has problems if .cov files are somewhere in the src tree
|
|
- su gazelle -c 'vendor/bin/phpcov merge "/tmp/coverage" --text "/tmp/coverage/coverage.txt" && cat "/tmp/coverage/coverage.txt"'
|
|
- test "$WAIT_ON_FINISH" && sleep 3600 || exit 0
|
|
|
|
# Sonarqube main image: mc1arke/sonarqube-with-community-branch-plugin:9.5-community
|
|
# scanner requires SONAR_HOST_URL and SONAR_TOKEN
|
|
#sonarqube:
|
|
# stage: analysis
|
|
# image:
|
|
# name: sonarsource/sonar-scanner-cli:latest
|
|
# entrypoint: [""]
|
|
# variables:
|
|
# SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
|
# GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
|
# cache:
|
|
# key: "${CI_JOB_NAME}"
|
|
# paths:
|
|
# - .sonar/cache
|
|
# script:
|
|
# - sonar-scanner -Dsonar.qualitygate.wait=true
|
|
# allow_failure: true
|
|
# only:
|
|
# - merge_requests
|
|
# - master
|