-
Notifications
You must be signed in to change notification settings - Fork 13
74 lines (65 loc) · 2.25 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CI
on: [push, pull_request]
jobs:
build:
name: Build and test
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:12.2
env:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
POSTGRES_DB: dev
ports:
- 5432:5432
mariadb:
image: mariadb:10.3
env:
MYSQL_USER: admin
MYSQL_PASSWORD: password
MYSQL_DATABASE: dev
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- 3306:3306
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ocaml-compiler:
- 4.12.x
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use OCaml ${{ matrix.ocaml-version }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
- name: Install system dependencies
run: sudo apt-get update -y && sudo apt-get install -y libmariadb-dev
- name: Install dependencies
run: make deps
- name: Build
run: make build
- name: Check formatting
run: make format
- name: Run tests
run: make test-all
- name: Pin current Sihl
run: opam pin add sihl .
- name: Generate PostgreSQL model
run: |
cd template
ROOT_PATH=. LOGS_DIR=. make sihl gen.model postgresql employee title:string is_premium:bool age:int shipped_at:datetime
DATABASE_URL=postgres://admin:[email protected]:5432/dev ENV_FILES_PATH=. ROOT_PATH=. LOGS_DIR=. make test
- name: Generate MariaDB model
run: |
cd template
rm -r app/domain/employee database/employee.ml test/employee
ROOT_PATH=. LOGS_DIR=. make sihl gen.model mariadb employee title:string is_premium:bool age:int shipped_at:datetime
echo "module Migration = Sihl.Database.Migration.MariaDb" > service/service.ml
echo "(executable (name run) (libraries sihl service routes database schedule command caqti-driver-mariadb))" > run/dune
opam install caqti-driver-mariadb
DATABASE_URL=mariadb://admin:[email protected]:3306/dev ENV_FILES_PATH=. ROOT_PATH=. LOGS_DIR=. make test