137 lines
3.0 KiB
YAML
137 lines
3.0 KiB
YAML
image: hatsoftwares/lufi-test-ci:latest
|
|
stages:
|
|
- publish_changelog
|
|
- carton
|
|
- carton_bdd
|
|
- tests
|
|
variables:
|
|
POSTGRES_DB: lufi_db
|
|
POSTGRES_USER: lufi
|
|
POSTGRES_PASSWORD: lufi_pwd
|
|
MYSQL_DATABASE: lufi_db
|
|
MYSQL_USER: lufi
|
|
MYSQL_PASSWORD: lufi_pwd
|
|
MYSQL_ROOT_PASSWORD: root
|
|
|
|
### Jobs templates
|
|
##
|
|
#
|
|
.retry: &retry
|
|
retry: 2
|
|
except:
|
|
- tags
|
|
.carton_bdd_template: &carton_bdd_definition
|
|
<<: *retry
|
|
stage: carton_bdd
|
|
cache:
|
|
key: "$CI_COMMIT_REF_NAME"
|
|
paths:
|
|
- local/
|
|
policy: pull
|
|
artifacts:
|
|
paths:
|
|
- local.tar
|
|
expire_in: 3 hours
|
|
after_script:
|
|
- tar cf local.tar local/
|
|
|
|
.tests_template: &tests_template
|
|
<<: *retry
|
|
stage: tests
|
|
coverage: '/Total.* (\d+\.\d+)$/'
|
|
before_script:
|
|
- tar xf local.tar && rm local.tar
|
|
script:
|
|
- MOJO_CONFIG="t/${CI_JOB_NAME}.conf" make test
|
|
- MOJO_CONFIG="t/${CI_JOB_NAME}.conf" make cover
|
|
|
|
.sqlite_template: &sqlite_definition
|
|
<<: *tests_template
|
|
dependencies:
|
|
- carton_sqlite
|
|
services:
|
|
- name: rroemhild/test-openldap
|
|
alias: rroemhild-test-openldap
|
|
.pg_template: &pg_definition
|
|
<<: *tests_template
|
|
dependencies:
|
|
- carton_postgresql
|
|
services:
|
|
- name: postgres:9.6
|
|
alias: postgres
|
|
- name: rroemhild/test-openldap
|
|
alias: rroemhild-test-openldap
|
|
.mysql_template: &mysql_definition
|
|
<<: *tests_template
|
|
dependencies:
|
|
- carton_mysql
|
|
services:
|
|
- name: mariadb:10.1
|
|
alias: mariadb
|
|
- name: rroemhild/test-openldap
|
|
alias: rroemhild-test-openldap
|
|
|
|
### Publish tag changelog
|
|
##
|
|
#
|
|
publish_changelog:
|
|
image: hatsoftwares/curl-jq:latest
|
|
stage: publish_changelog
|
|
script:
|
|
- export PROJECT_API_URL="https://framagit.org/api/v4/projects/${CI_PROJECT_ID}"
|
|
- export DESCRIPTION_URL="${PROJECT_API_URL}/repository/tags/${CI_COMMIT_TAG}/release"
|
|
- 'export HEADER="Private-Token: ${GITLAB_API_TOKEN}"'
|
|
- sed -n '/^'$CI_COMMIT_TAG'[[:space:]]/,/^[^\t]/p' CHANGELOG | sed -e 's/^[^\t].*//' -e 's/\t//g' | sed '/^[[:space:]]*$/d' > /tmp/text
|
|
- if [[ ! -z $GITLAB_API_TOKEN ]]; then curl -s --request POST --data-urlencode "description@/tmp/text" --header "${HEADER}" "${DESCRIPTION_URL}"; fi
|
|
only:
|
|
- tags
|
|
|
|
### Podcheck
|
|
##
|
|
#
|
|
podcheck:
|
|
stage: carton
|
|
script:
|
|
- make podcheck
|
|
except:
|
|
- tags
|
|
|
|
### Install common dependencies
|
|
##
|
|
#
|
|
carton:
|
|
<<: *retry
|
|
stage: carton
|
|
cache:
|
|
key: "$CI_COMMIT_REF_NAME"
|
|
paths:
|
|
- local/
|
|
script:
|
|
- carton install --deployment --without=sqlite --without=postgresql --without=mysql
|
|
|
|
### Install DB related dependencies
|
|
##
|
|
#
|
|
carton_sqlite:
|
|
<<: *carton_bdd_definition
|
|
script:
|
|
- carton install --deployment --without=postgresql --without=mysql
|
|
carton_postgresql:
|
|
<<: *carton_bdd_definition
|
|
script:
|
|
- carton install --deployment --without=sqlite --without=mysql
|
|
carton_mysql:
|
|
<<: *carton_bdd_definition
|
|
script:
|
|
- carton install --deployment --without=sqlite --without=postgresql
|
|
|
|
### Tests
|
|
##
|
|
#
|
|
sqlite:
|
|
<<: *sqlite_definition
|
|
postgresql:
|
|
<<: *pg_definition
|
|
mysql:
|
|
<<: *mysql_definition
|