12
12
services :
13
13
mariadb :
14
14
image : mariadb:latest
15
- ports : ["3306:3306"]
16
15
env :
17
16
MARIADB_USER : testuser
18
17
MARIADB_PASSWORD : testpw
@@ -23,56 +22,70 @@ jobs:
23
22
fail-fast : false
24
23
matrix :
25
24
os :
26
- - ubuntu-latest
27
- # ubuntu-20.04 has the same MariaDB client library options as latest
28
- # macos-latest does not work since we're using a service container
25
+ # The main aim is to target different kinds of MariaDB client
26
+ # libraries; see the OPAM specification of conf-mariadb.
27
+ - " alpine" # MariaDB C connector
28
+ - " ubuntu" # libmariadb
29
+ # "ubuntu-18.04" has libmariadbclient but has too old libc for node.js
29
30
ocaml-compiler :
30
- - 5
31
- - 4.07
31
+ - " 5.0 "
32
+ # - " 4.07"
32
33
33
- runs-on : ${{ matrix.os }}
34
+ runs-on : ubuntu-latest
35
+ container :
36
+ image : " ocaml/opam:${{ matrix.os }}-ocaml-${{ matrix.ocaml-compiler }}"
37
+ # Currently needed for the GitHub Actions, use sudo for other steps.
38
+ options : " --user root"
34
39
35
40
steps :
36
41
- name : Check out source code
37
42
uses : actions/checkout@v4
38
43
39
- - name : Set up OCaml
40
- uses : ocaml/setup-ocaml@v3
41
- with :
42
- ocaml-compiler : ${{ matrix.ocaml-compiler }}
44
+ - name : Install system dependencies (alpine)
45
+ if : " ${{ matrix.os == 'alpine' }}"
46
+ run : " apk add --no-cache linux-headers mariadb-connector-c-dev"
47
+
48
+ - name : Install system dependencies (ubuntu)
49
+ if : " ${{ matrix.os == 'ubuntu' }}"
50
+ run : " apt-get update && apt-get install -y pkg-config libmariadb-dev"
43
51
44
52
- name : Restore cached dependencies
45
53
uses : actions/cache@v3
46
54
with :
47
- key : ${{ runner.os }}-ocaml-${{ matrix.ocaml-compiler }}-deps-${{ hashFiles('*.opam') }}
48
- path : ~/.opam
55
+ # Since we use docker tag aliases we compute a digest of relevant
56
+ # files on the system instead of using the matrix here.
57
+ key : " ${{ hashFiles('/etc/*-release', '.opam/config', '*.opam') }}"
58
+ path : /home/opam/.opam
59
+
60
+ - name : Give opem access to the workspace
61
+ run : " chown -Rh opam: ."
49
62
50
63
- name : Install dependencies
51
- run : opam install . --deps-only -t
64
+ run : " sudo -u opam opam install -y --deps-only -t . "
52
65
53
66
- name : Build
54
- run : opam exec -- dune build
67
+ run : " sudo -u opam opam exec -- dune build"
55
68
56
69
- name : Run tests
57
- run : opam exec -- dune runtest
70
+ run : " sudo -u opam -E opam exec -- dune runtest"
58
71
env :
59
- OCAML_MARIADB_HOST : 127.0.0.1
72
+ OCAML_MARIADB_HOST : mariadb
60
73
OCAML_MARIADB_PORT : 3306
61
74
OCAML_MARIADB_USER : testuser
62
75
OCAML_MARIADB_PASS : testpw
63
76
OCAML_MARIADB_DB : testdb
64
77
OCAML_MARIADB_QUERY : " SELECT 'hello ' || ?"
65
78
66
- lint-opam :
67
- runs-on : ubuntu-latest
68
- steps :
69
- - name : Check out source code
70
- uses : actions/checkout@v4
71
-
72
- - name : Set up OCaml
73
- uses : ocaml/setup-ocaml@v3
74
- with :
75
- ocaml-compiler : 5
76
-
77
- - name : Lint OPAM package descriptions
78
- uses : ocaml/setup-ocaml/lint-opam@v3
79
+ # lint-opam:
80
+ # runs-on: ubuntu-latest
81
+ # steps:
82
+ # - name: Check out source code
83
+ # uses: actions/checkout@v4
84
+ #
85
+ # - name: Set up OCaml
86
+ # uses: ocaml/setup-ocaml@v3
87
+ # with:
88
+ # ocaml-compiler: 5
89
+ #
90
+ # - name: Lint OPAM package descriptions
91
+ # uses: ocaml/setup-ocaml/lint-opam@v3
0 commit comments