diff options
Diffstat (limited to '.gitlab-ci.yml')
| -rw-r--r-- | .gitlab-ci.yml | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0fd3f17..baec987 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,154 @@ image: studip/studip:tests variables: + MYSQL_RANDOM_ROOT_PASSWORD: "true" + MYSQL_DATABASE: studip_db + MYSQL_USER: studip_user + MYSQL_PASSWORD: studip_password + MYSQL_HOST: mariadb + DEMO_DATA: "true" + MAIL_TRANSPORT: debug + # Optimize caching + FF_USE_FASTZIP: "true" + CACHE_COMPRESSION_LEVEL: "fast" # User faster docker driver DOCKER_DRIVER: overlay2 stages: + - checks + - tests - packaging - release +.scripts: + install-composer: + - make composer-dev + configure-studip: + - !reference [.scripts, install-composer] + - cp docker/studip/config_local.php config/config_local.inc.php + - cp config/config.inc.php.dist config/config.inc.php + initialize-studip-database: + - !reference [.scripts, configure-studip] + - chmod +x .gitlab/scripts/install_db.sh + - .gitlab/scripts/install_db.sh + - cli/studip migrate + remove-absolute-path-in-report: + - sed -i "s%$PWD/%%" tests/_output/report.xml + +.artifacts: + common: &common-artifacts + when: always + expire_in: 1 week + tests: &test-artifacts + <<: *common-artifacts + paths: + - tests/_output + reports: + junit: tests/_output/report.xml + +.caches: + php: &composer-cache + key: "php-$CI_COMMIT_REF_SLUG" + paths: + - composer/ + - .caches/phplint-cache + - .caches/resultCache.php + - .caches/cache/* + - .caches/resultCaches/* + js: &npm-cache + key: "js-$CI_COMMIT_REF_SLUG" + paths: + - node_modules/ + - .caches/eslint-cache + - .caches/stylelint-cache + +lint-php: + stage: checks + needs: [] + cache: *composer-cache + allow_failure: false + interruptible: true + before_script: + - !reference [.scripts, install-composer] + - mkdir -p .reports + script: + - php -d memory_limit=-1 composer/bin/phplint --xml .reports/phplint-report.xml --cache=.caches/phplint-cache + artifacts: + <<: *common-artifacts + paths: + - .reports/phplint-report.xml + reports: + junit: .reports/phplint-report.xml + +test-assets: + stage: checks + needs: [] + cache: *npm-cache + allow_failure: false + interruptible: true + before_script: + - make npm + script: + - make webpack-dev + +test-unit: + stage: tests + needs: [lint-php] + cache: + <<: *composer-cache + policy: pull + allow_failure: false + interruptible: true + before_script: + - !reference [.scripts, configure-studip] + script: + - composer/bin/codecept run unit --xml + - !reference [.scripts, remove-absolute-path-in-report] + artifacts: + <<: *test-artifacts + +test-functional: + stage: tests + needs: [lint-php] + cache: + <<: *composer-cache + policy: pull + services: + - mariadb + allow_failure: false + interruptible: true + before_script: + - !reference [.scripts, initialize-studip-database] + script: + - composer/bin/codecept run functional --xml + - !reference [.scripts, remove-absolute-path-in-report] + artifacts: + <<: *test-artifacts + +test-jsonapi: + stage: tests + needs: [lint-php] + cache: + <<: *composer-cache + policy: pull + services: + - mariadb + allow_failure: false + interruptible: true + before_script: + - !reference [.scripts, initialize-studip-database] + script: + - composer/bin/codecept run jsonapi --xml + - !reference [.scripts, remove-absolute-path-in-report] + artifacts: + <<: *test-artifacts + when: always + expire_in: 1 week + paths: + - tests/_output + reports: + junit: tests/_output/report.xml + packaging: stage: packaging cache: [] |
