Skip to content

Commit

Permalink
Add prototype Gitlab-CI configuration
Browse files Browse the repository at this point in the history
What I have done here is take .gitlab-ci.yml and
MultiTestDB.conf.gitlabci.mysql from ensembl master, modify the
before_script section of the former to account for differences in
dependencies between the two projects, create a dependent-build
trigger attempting to launch one on ensembl-gh-mirror/ensembl (i.e.
already on EBI Gitlab), and fix the declaration of same because it
has turned out variable expansion in trigger declarations works
only in the branch field, not in "project".

Note that all of this results in a somewhat different build
matrix than on Travis but unlike there, on GitLab we have got
consistency between ensembl and ensembl-test.
  • Loading branch information
Marek Szuba committed Nov 8, 2019
1 parent a9f245b commit 8f05ae1
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
stages:
- test
- posttest

services:
- mysql:5.6

variables:
# FIXME: set some password for both users
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_USER: "travis"
MYSQL_PASSWORD: ""
USER: "gitlabci"

# Run before each job not defining its own before_script
before_script:
- apt-get update
- apt-get install -y build-essential cpanminus git
- apt-get install -y libmysqlclient-dev mysql-client || apt-get install -y default-libmysqlclient-dev default-mysql-client
- apt-get install -y libssl-dev sqlite3
- git clone --branch=master --depth=1 https://github.com/Ensembl/ensembl.git
- git clone --branch=release-1-6-924 --depth=1 https://github.com/bioperl/bioperl-live.git
# Install IO::Scalar before processing the cpanfile because one of the dependencies
# of Test::FTP::Server requires it yet does not declare it as a dependency, and
# cpanm - or to be precise the module CPAN::Meta::Prereqs - scrambles the order
# of entries in cpanfiles (see https://github.com/miyagawa/cpanfile/issues/42).
# Cpanfile upstream categorically refuses to implement the forcing of dependencies
# (see https://github.com/miyagawa/cpanfile/issues/3) so we will have to keep this
# here until either Net::FTPServer has been fixed or we stop using Test::FTP::Server
- cpanm -n IO::Scalar
- cpanm -v --installdeps --notest .
- ( cd ensembl && cpanm -v --installdeps --notest . )
- cpanm -n Devel::Cover::Report::Coveralls
- cpanm -n DBD::SQLite
- cp travisci/MultiTestDB.conf.gitlabci.mysql modules/t/MultiTestDB.conf.mysql
- cp travisci/MultiTestDB.conf.travisci.SQLite modules/t/MultiTestDB.conf.SQLite
- mysql -u root -h mysql -e 'GRANT ALL PRIVILEGES ON *.* TO "travis"@"%"'

#
# Test jobs
#

test:perl5.14-sqlite:
stage: test
image: perl:5.14-threaded
variables:
COVERALLS: "false"
DB: "sqlite"
script:
- ./travisci/harness.sh

test:perl5.30-mysql:
stage: test
image: perl:5.30-threaded
variables:
# Note: relies on the secret variable COVERALLS_REPO_TOKEN for report uploads to work
COVERALLS: "true"
DB: "mysql"
script:
- ./travisci/harness.sh

#
# Triggers for dependent builds
#

# The template. It doesn't presently support PRs before they are
# merged (would need extended run condition and better selection of
# downstream branches) - but then again, we do not trigger dependent
# builds for PRs on Travis either.
.dependent_template:
stage: posttest
# We want this to run even if any test jobs fail
when: always
only:
- master
- /^release/\d+$/
trigger:
# Use the same branch as in this project
branch: ${CI_COMMIT_REF_NAME}

# Actual trigger jobs
post:trigger_main:
extends: .dependent_template
trigger:
project: ensembl-gh-mirror/ensembl
6 changes: 6 additions & 0 deletions travisci/MultiTestDB.conf.gitlabci.mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
'driver' => 'mysql',
'host' => 'mysql',
'port' => '3306',
'user' => 'travis',
}

0 comments on commit 8f05ae1

Please sign in to comment.