-
-
Notifications
You must be signed in to change notification settings - Fork 140
154 lines (144 loc) · 5.21 KB
/
test.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: test
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
# - windows-latest
ocaml-compiler:
- 5.0.x
- 4.14.x
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ocaml/setup-ocaml@v3
name: Use OCaml ${{matrix.ocaml-compiler}}
with:
ocaml-compiler: ${{matrix.ocaml-compiler}}
# - uses: ocaml/setup-ocaml@v3
# if: runner.os == 'Windows'
# with:
# ocaml-compiler: ${{matrix.ocaml}}
# opam-repositories: |
# opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
# default: https://github.com/ocaml/opam-repository.git
# - run: opam depext --yes conf-sqlite3
# - run: opam depext --yes conf-postgresql
# - run: opam depext --yes conf-libev
# if: runner.os != 'Windows'
- name: Prepare MacOS
run: brew install postgresql@15 && brew link --overwrite postgresql@15
if: runner.os == 'macos'
- name: Install deps
run: make deps
- name: Test
run: eval $(opam env) && make test
# run: |
# opam exec -- dune build --no-print-directory --instrument-with bisect_ppx --force @test/runtest
# opam exec -- bisect-ppx-report html
# opam exec -- bisect-ppx-report summary
# echo See _coverage/index.html
# # The tests require ppx_expect. The latest versions of it introduced changes
# # in the formatting of the output, and also require OCaml >= 4.10, which
# # makes testing on < 4.10 awkward. So, we skip tests on < 4.10.
# - shell: bash
# run: |
# set -e
# set -x
#
# WITH_TEST=--with-test
# case ${{matrix.ocaml}} in
# 4.09.x) WITH_TEST=;;
# 4.08.x) WITH_TEST=;;
# esac
#
# # Tests on Windows are disabled because of a difference in ppx_expect
# # output. See https://github.com/aantron/dream/pull/282.
# case ${{runner.os}} in
# Windows) WITH_TEST=;;
# esac
#
# OPAM=$(which opam || true)
# if [ -z "$OPAM" ]
# then
# OPAM=D:\\cygwin\\wrapperbin\\opam.cmd
# fi
#
# $OPAM install --yes --deps-only $WITH_TEST ./dream-pure.opam ./dream-httpaf.opam ./dream.opam
#
# if [ ! -z "$WITH_TEST" ]
# then
# $OPAM exec -- dune runtest
#
# EXAMPLES=$(find example -maxdepth 1 -type d -not -name "w-mirage*" -not -name "r-tyxml" | grep -v "^example/0" | grep -v "^example$" | sort)
# shopt -s nullglob
#
# for EXAMPLE in $EXAMPLES
# do
# FILE=$(ls $EXAMPLE/*.ml $EXAMPLE/*.re $EXAMPLE/server/*.ml $EXAMPLE/server/*.re)
# EXE=$(echo $FILE | sed 's/\..*$/.exe/g')
# echo dune build $EXE
# $OPAM exec -- dune build $EXE
# done
# fi
# quickstart:
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-latest
# - macos-latest
#
# runs-on: ${{matrix.os}}
# steps:
# - uses: ocaml/setup-ocaml@v3
# name: Use OCaml
# if: runner.os != 'Windows'
# with:
# ocaml-compiler: ${{matrix.ocaml}}
# - name: Quick start
# run: |
# set -x
# touch output
# tail -f output | grep --line-buffered 'Ctrl' | xargs -L1 -I FOO bash -c "echo Success && touch success && killall middleware.exe" &
# tail -f output &
# ((curl -fsSL https://raw.githubusercontent.com/aantron/dream/$GITHUB_SHA/example/quickstart.sh | bash -s $GITHUB_SHA) || true) > output 2>&1
# sleep 1
# if [ -f success ]
# then
# exit 0
# else
# exit 1
# fi
#
# mirage:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: recursive
# - run: mkdir ../repo-copy
# - run: cp -r * ../repo-copy/
# - uses: ocaml/setup-ocaml@v3
# with:
# ocaml-compiler: 4.14.x
# - run: opam install --yes --deps-only ./dream-pure.opam ./dream-httpaf.opam ./dream.opam ./dream-mirage.opam
# - run: opam install --yes mirage mirage-clock-unix
# - run: cd example/w-mirage && mv config.ml config.ml.backup
# - run: cd example/w-mirage && sed -e 's/package "dream-mirage"//' < config.ml.backup > config.ml
# - run: cd example/w-mirage && opam exec -- mirage configure -t unix
# - run: cd example/w-mirage && opam exec -- make depends
# - run: cd example/w-mirage && ls duniverse
# - run: cp -r ../repo-copy example/w-mirage/duniverse/dream
# - run: cd example/w-mirage/duniverse && rm -rf ocaml-cstruct logs ke fmt lwt bytes seq mirage-flow sexplib0 ptime tls domain-name ocaml-ipaddr mirage-clock ocplib-endian
# - run: cd example/w-mirage && mv config.ml.backup config.ml
# - run: cd example/w-mirage && sed -e 's/(libraries/(libraries dream-mirage/' < dune.build > dune.build.2
# - run: cd example/w-mirage && mv dune.build.2 dune.build
# - run: cd example/w-mirage && opam exec -- dune build
# - run: file example/w-mirage/_build/default/main.exe