Skip to content

Commit

Permalink
Upgrade Travis image to Ubuntu 20.04 LTS (#956)
Browse files Browse the repository at this point in the history
Upgrade CI to run postgresql 12 and mysql8. The new package links-mysql8 provides an adapter for connecting to mysql8 databases, whilst the package links-mysql remains compatible with mysql5.7. Note, however, that the package links-mysql is no longer tested by the CI due to difficulties with configuring mysql5.7 on the CI image, instead we test links-mysql8.

Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: James Cheney <james.cheney@gmail.com>
  • Loading branch information
3 people authored Jun 1, 2021
1 parent 7bf1c08 commit 0f20bb6
Show file tree
Hide file tree
Showing 25 changed files with 443 additions and 66 deletions.
57 changes: 39 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
sudo: required
dist: xenial
dist: focal
language: c
services:
- postgresql
- mysql
addons:
apt:
# This has the same effect as running apt-get update, but avoid problems
# with signature verification
update: true
postgresql: '12'
mysql: '8'
apt:
packages:
- postgresql-12
- mysql-client-8.0
- mysql-server-8.0
env:
global:
- PGPORT=5433
- PGUSER=travis
- DBUSER=links
- DBNAME=links
before_install:
- git diff-index --quiet HEAD --
- sudo add-apt-repository -y ppa:avsm/ppa
- sudo apt-get -qq update
- sudo apt-get install -y ocaml-nox ocaml-native-compilers python3-setuptools python3-pip libev-dev
# BEGIN postgresql trust based authentication
- sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
- sudo systemctl restart postgresql
# END
- sudo apt-get install -y ocaml-nox ocaml-native-compilers opam python3-setuptools python3-pip libev-dev
- pip3 install -U Sphinx
- ./install_local_opam2.sh
- ./opam2_local switch create ocaml-base-compiler.4.08.0
- eval `./opam2_local config env`
- ./opam2_local install conf-libev
- ./opam2_local install -y postgresql mysql ounit2
- ./tools/install_ocamlformat
- opam init --disable-sandboxing -n
- opam switch create ocaml-base-compiler.4.08.0
- eval `opam config env`
- opam install -y conf-libev conf-mysql
- opam install -y ocamlformat.0.14.2 ounit2
- make rule-check
- psql -c 'create database links;' -U postgres
- mysql -e 'CREATE DATABASE links;'
- mysql -e "CREATE USER links IDENTIFIED BY '12345';"
- mysql -e 'GRANT ALL ON links.* TO links;'
- psql -c "create database $DBNAME;" -U postgres
- psql -c "CREATE ROLE $DBUSER SUPERUSER LOGIN CREATEDB;" -U postgres
- mysql -e "CREATE DATABASE $DBNAME;"
- mysql -e "CREATE USER $DBUSER IDENTIFIED BY 'links';"
- mysql -e "GRANT ALL ON $DBNAME.* TO $DBUSER;"
- mysql -e "FLUSH PRIVILEGES;"
script:
- ./opam2_local pin add links . -y
- ./opam2_local pin add links-postgresql . -y
- ./opam2_local pin add links-sqlite3 . -y
- ./opam2_local pin add links-mysql . -y
- opam pin add links . -y
- opam pin add links-postgresql . -y
- opam pin add links-sqlite3 . -y
- opam pin add links-mysql8 . -y
- make doc
- make all-ci
- make tests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ BUILD_DIR:=$(ROOT)/_build
# The build command and some standard build system flags
BUILD=dune build
SOURCES=links
DB_SOURCES=links-postgresql,links-sqlite3,links-mysql
DB_SOURCES=links-postgresql,links-sqlite3,links-mysql,links-mysql8
# Note: this relies on lazy expansion of `SOURCES'.
COMMON_FLAGS=--only-packages $(SOURCES) --build-dir=$(BUILD_DIR)
DEV_FLAGS=$(COMMON_FLAGS) --profile=dev
Expand Down
13 changes: 13 additions & 0 deletions database/mysql8-driver/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(library
(name links_mysql8)
(public_name links-mysql8)
(synopsis "MySQL8 database backend for Links")
(optional)
(flags (:standard -safe-string -dtypes -w Ae-42-44-45-60 -g -cclib -lunix -thread))
(libraries mysql8 links.core))


(install
(section share)
(files links_mysql8_dependencies.json)
(package links-mysql8))
6 changes: 6 additions & 0 deletions database/mysql8-driver/links_mysql8_dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
opam_package: "mysql8",
files : ["mysql8"]
}
]
Loading

0 comments on commit 0f20bb6

Please sign in to comment.