Skip to content
Snippets Groups Projects
Commit 573bbd21 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

optimizations for the gitlab ci pipeline

Closes #606

Merge request studip/studip!712
parent 61003a1e
No related branches found
No related tags found
No related merge requests found
image: studip/studip:tests
variables: variables:
MYSQL_RANDOM_ROOT_PASSWORD: 1 MYSQL_RANDOM_ROOT_PASSWORD: "true"
MYSQL_DATABASE: studip_db MYSQL_DATABASE: studip_db
MYSQL_USER: studip_user MYSQL_USER: studip_user
MYSQL_PASSWORD: studip_password MYSQL_PASSWORD: studip_password
MYSQL_HOST: mariadb MYSQL_HOST: mariadb
DEMO_DATA: 1 DEMO_DATA: "true"
MAIL_TRANSPORT: debug MAIL_TRANSPORT: debug
# Optimize caching
FF_USE_FASTZIP: "true"
CACHE_COMPRESSION_LEVEL: "fast"
# User faster docker driver
DOCKER_DRIVER: overlay2
stages: stages:
- Checks - checks
- Tests - tests
- Packaging - packaging
- Release - release
- Build - build
image: studip/studip:tests
services:
- mariadb
Linting: .scripts:
stage: Checks install-composer:
allow_failure: false
before_script:
- make composer-dev - make composer-dev
script: configure-studip:
- php -d memory_limit=-1 composer/bin/phplint --xml report.xml - !reference [.scripts, install-composer]
artifacts: - 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
when: always when: always
expire_in: 1 week expire_in: 1 week
tests: &test-artifacts
<<: *common
paths: paths:
- tests/_output - tests/_output
reports: reports:
junit: tests/_output/report.xml junit: tests/_output/report.xml
Unit Test: .caches:
stage: Tests php: &php-cache
key: "php-$CI_COMMIT_REF_SLUG"
paths:
- composer/
- .phplint-cache
js: &js-cache
key: "js-$CI_COMMIT_REF_SLUG"
paths:
- node_modules/
- .eslintcache
lint-php:
stage: checks
needs: []
cache: *php-cache
allow_failure: false allow_failure: false
interruptible: true
before_script: before_script:
- cp docker/studip/config_local.php config/config_local.inc.php - !reference [.scripts, install-composer]
- cp config/config.inc.php.dist config/config.inc.php
- make composer-dev
script: script:
- composer/bin/codecept run unit --xml - php -d memory_limit=-1 composer/bin/phplint --xml report.xml
# Remove absolute path in report
- sed -i "s%$PWD/%%" tests/_output/report.xml
artifacts: artifacts:
when: always <<: *common
expire_in: 1 week
paths: paths:
- tests/_output - report.xml
reports: reports:
junit: tests/_output/report.xml junit: report.xml
Functional Test: lint-js:
stage: Tests stage: checks
needs: []
cache: *js-cache
allow_failure: false allow_failure: false
interruptible: true
before_script: before_script:
- chmod +x .gitlab/scripts/install_db.sh - make npm
- .gitlab/scripts/install_db.sh script:
- cp docker/studip/config_local.php config/config_local.inc.php - npm run lint -- --cache
- cp config/config.inc.php.dist config/config.inc.php
- make composer-dev test-unit:
- cli/studip migrate stage: tests
needs: [lint-php]
cache:
<<: *php-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:
<<: *php-cache
policy: pull
services:
- mariadb
allow_failure: false
interruptible: true
before_script:
- !reference [.scripts, initialize-studip-database]
script: script:
- composer/bin/codecept run functional --xml - composer/bin/codecept run functional --xml
- sed -i "s%$PWD/%%" tests/_output/report.xml - !reference [.scripts, remove-absolute-path-in-report]
artifacts: artifacts:
when: always <<: *test-artifacts
expire_in: 1 week
paths:
- tests/_output
reports:
junit: tests/_output/report.xml
JSONAPI Test: test-jsonapi:
stage: Tests stage: tests
needs: [lint-php]
cache:
<<: *php-cache
policy: pull
services:
- mariadb
allow_failure: false allow_failure: false
interruptible: true
before_script: before_script:
- chmod +x .gitlab/scripts/install_db.sh - !reference [.scripts, initialize-studip-database]
- .gitlab/scripts/install_db.sh
- cp docker/studip/config_local.php config/config_local.inc.php
- cp config/config.inc.php.dist config/config.inc.php
- make composer-dev
- cli/studip migrate
script: script:
- composer/bin/codecept run jsonapi --xml - composer/bin/codecept run jsonapi --xml
- sed -i "s%$PWD/%%" tests/_output/report.xml - !reference [.scripts, remove-absolute-path-in-report]
artifacts: artifacts:
<<: *test-artifacts
when: always when: always
expire_in: 1 week expire_in: 1 week
paths: paths:
...@@ -94,9 +145,9 @@ JSONAPI Test: ...@@ -94,9 +145,9 @@ JSONAPI Test:
reports: reports:
junit: tests/_output/report.xml junit: tests/_output/report.xml
Packaging: packaging:
stage: Packaging stage: packaging
image: studip/studip:tests cache: []
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
before_script: before_script:
...@@ -116,15 +167,16 @@ Packaging: ...@@ -116,15 +167,16 @@ Packaging:
reports: reports:
dotenv: .packaging.env dotenv: .packaging.env
Release: release:
stage: Release stage: release
image: studip/release-cli image: studip/release-cli
cache: []
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
script: script:
- echo 'Running release job' - echo 'Running release job'
needs: needs:
- job: Packaging - job: packaging
artifacts: true artifacts: true
release: release:
name: "Stud.IP-Release-$CI_COMMIT_TAG" name: "Stud.IP-Release-$CI_COMMIT_TAG"
......
...@@ -30,7 +30,7 @@ clean-composer: ...@@ -30,7 +30,7 @@ clean-composer:
npm: node_modules/.package-lock.json npm: node_modules/.package-lock.json
node_modules/.package-lock.json: package.json package-lock.json node_modules/.package-lock.json: package.json package-lock.json
npm install --no-save npm install --no-save --no-audit --no-fund
clean-npm: clean-npm:
rm -rf node_modules rm -rf node_modules
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment