lufi/.gitlab-ci.yml

154 lines
3.2 KiB
YAML

image: hatsoftwares/lufi-test-ci:latest
stages:
- publish_changelog
- podcheck
- carton
- carton_bdd
- tests
before_script:
- rm -f *db
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
##
#
.carton_bdd_template: &carton_bdd_definition
stage: carton_bdd
retry: 2
artifacts:
paths:
- local/
expire_in: 1 week
dependencies:
- carton
except:
- tags
.sqlite_template: &sqlite_definition
stage: tests
retry: 2
dependencies:
- carton_sqlite
services:
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
coverage: '/Total.* (\d+\.\d+)$/'
except:
- tags
.pg_template: &pg_definition
stage: tests
retry: 2
dependencies:
- carton_postgresql
services:
- name: postgres:9.6
alias: postgres
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
coverage: '/Total .*(\d+\.\d+)$/'
except:
- tags
.mysql_template: &mysql_definition
stage: tests
retry: 2
dependencies:
- carton_mysql
services:
- name: mariadb:10.1
alias: mariadb
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
coverage: '/Total .*(\d+\.\d+)$/'
except:
- tags
### Publish tag changelog
##
#
publish_changelog:
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: podcheck
script:
- make podcheck
except:
- tags
### Install common dependencies
##
#
carton:
stage: carton
artifacts:
paths:
- local/
expire_in: 1 week
dependencies: []
script:
- carton install --deployment --without=sqlite --without=postgresql --without=mysql
when: always
retry: 2
except:
- tags
### 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
### SQLite tests
##
#
sqlite:
<<: *sqlite_definition
script:
- MOJO_CONFIG=t/sqlite.conf make test
- MOJO_CONFIG=t/sqlite.conf make cover
### PostgreSQL tests
##
#
postgresql:
<<: *pg_definition
script:
- MOJO_CONFIG=t/postgresql.conf make test
- MOJO_CONFIG=t/postgresql.conf make cover
### MySQL tests
##
#
mysql:
<<: *mysql_definition
script:
- MOJO_CONFIG=t/mysql.conf make test
- MOJO_CONFIG=t/mysql.conf make cover