Skip to content

Commit 8298231

Browse files
committed
update packages and devcontainer, upgrade tls and fix breaking changes, run formatter, add ocaml versions for CI
1 parent c38446b commit 8298231

File tree

9 files changed

+79
-65
lines changed

9 files changed

+79
-65
lines changed

.devcontainer/Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
FROM hadolint/hadolint:latest-alpine AS hadolint
2-
FROM ocaml/opam:debian-ocaml-4.14
1+
FROM ocaml/opam:debian-12-ocaml-4.14
32

43
USER root
54

65
# copy hadolint
7-
COPY --from=hadolint /bin/hadolint /bin/hadolint
6+
COPY --from=hadolint/hadolint:latest-alpine /bin/hadolint /bin/hadolint
87

98
# Avoid warnings by switching to noninteractive
109
ENV DEBIAN_FRONTEND noninteractive
@@ -20,14 +19,16 @@ RUN apt-get update -q && apt-get install -yqq --no-install-recommends \
2019
#
2120
# build dependencies (would also be installed by opam depext)
2221
gcc \
22+
jq \
2323
libev-dev \
2424
libgmp-dev \
2525
libssl-dev \
2626
pkg-config \
2727
#
2828
# cleanup installations
2929
&& apt-get autoremove -y \
30-
&& apt-get clean all
30+
&& apt-get clean all \
31+
&& rm -rf /var/lib/apt/lists/*
3132

3233
# add timezone
3334
RUN ln -fs /usr/share/zoneinfo/Europe/Zurich /etc/localtime
@@ -39,7 +40,8 @@ RUN bash -c 'echo "http 80/tcp www # WorldWideWeb HTTP" >> /etc/services' \
3940
USER opam
4041

4142
# install oh-my-zsh
42-
RUN zsh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
43+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
44+
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -q -O - | zsh \
4345
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
4446
&& sed -i "/^plugins=/c\plugins=(git dotenv)" ~/.zshrc \
4547
#

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
# - macos-latest
1515
- ubuntu-latest
1616
ocaml-version:
17+
- 4.14.0
18+
- 4.13.1
19+
- 4.12.1
1720
- 4.11.1
1821
- 4.10.1
1922
- 4.09.1

dune-project

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
(sendmail
4848
(>= 0.7.0))
4949
(tls-lwt
50-
(>= 0.16.0))
50+
(>= 1.0.4))
5151
(tls
52-
(>= 0.16.0))
52+
(>= 1.0.4))
5353
(x509
5454
(>= 0.9.0))
5555
;; Test dependencies

letters.opam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ depends: [
2121
"ocaml" {>= "4.08.1"}
2222
"ptime" {>= "0.8.5"}
2323
"sendmail" {>= "0.7.0"}
24-
"tls-lwt" {>= "0.16.0"}
25-
"tls" {>= "0.16.0"}
24+
"tls-lwt" {>= "1.0.4"}
25+
"tls" {>= "1.0.4"}
2626
"x509" {>= "0.9.0"}
2727
"alcotest" {>= "1.1.0" & with-test}
2828
"alcotest-lwt" {>= "1.1.0" & with-test}

letters.opam.locked

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,74 +9,75 @@ homepage: "https://github.com/oxidizing/letters/"
99
doc: "https://oxidizing.github.io/letters/"
1010
bug-reports: "https://github.com/oxidizing/letters/issues"
1111
depends: [
12-
"angstrom" {= "0.16.0"}
13-
"asn1-combinators" {= "0.2.6"}
12+
"angstrom" {= "0.16.1"}
13+
"asn1-combinators" {= "0.3.2"}
1414
"astring" {= "0.8.5"}
1515
"base-bytes" {= "base"}
1616
"base-threads" {= "base"}
1717
"base-unix" {= "base"}
1818
"base64" {= "3.5.1"}
1919
"bigarray-overlap" {= "0.2.1"}
20-
"bigstringaf" {= "0.9.1"}
20+
"bigstringaf" {= "0.10.0"}
2121
"bos" {= "0.2.1"}
22-
"ca-certs" {= "0.2.3"}
23-
"cmdliner" {= "1.2.0"}
22+
"ca-certs" {= "1.0.0"}
23+
"cmdliner" {= "1.3.0"}
2424
"coin" {= "0.1.4"}
25-
"colombe" {= "0.8.0"}
25+
"colombe" {= "0.11.0"}
2626
"conf-gmp" {= "4"}
2727
"conf-gmp-powm-sec" {= "3"}
2828
"conf-pkg-config" {= "3"}
29-
"containers" {= "3.13.1"}
30-
"cppo" {= "1.6.9"}
29+
"containers" {= "3.15"}
30+
"cppo" {= "1.8.0"}
3131
"csexp" {= "1.5.2"}
3232
"cstruct" {= "6.2.0"}
33+
"digestif" {= "1.2.0"}
3334
"domain-name" {= "0.4.0"}
34-
"dune" {= "3.14.0"}
35-
"dune-configurator" {= "3.14.0"}
35+
"dune" {= "3.17.0"}
36+
"dune-configurator" {= "3.17.0"}
3637
"duration" {= "0.2.1"}
3738
"either" {= "1.0.0"}
3839
"emile" {= "1.1"}
39-
"eqaf" {= "0.9"}
40+
"eqaf" {= "0.10"}
4041
"fmt" {= "0.9.0"}
4142
"fpath" {= "0.7.3"}
4243
"gmap" {= "0.3.0"}
43-
"hkdf" {= "1.0.4"}
44-
"ipaddr" {= "5.5.0"}
44+
"hxd" {= "0.3.3"}
45+
"ipaddr" {= "5.6.0"}
46+
"kdf" {= "1.0.0"}
4547
"ke" {= "0.6"}
4648
"logs" {= "0.7.0"}
47-
"lwt" {= "5.7.0"}
48-
"macaddr" {= "5.5.0"}
49-
"mirage-crypto" {= "0.11.3"}
50-
"mirage-crypto-ec" {= "0.11.3"}
51-
"mirage-crypto-pk" {= "0.11.3"}
52-
"mirage-crypto-rng" {= "0.11.3"}
53-
"mirage-crypto-rng-lwt" {= "0.11.3"}
54-
"mrmime" {= "0.6.0"}
55-
"mtime" {= "2.0.0"}
56-
"ocaml" {= "4.14.1"}
49+
"lwt" {= "5.9.0"}
50+
"macaddr" {= "5.6.0"}
51+
"mirage-crypto" {= "1.1.0"}
52+
"mirage-crypto-ec" {= "1.1.0"}
53+
"mirage-crypto-pk" {= "1.1.0"}
54+
"mirage-crypto-rng" {= "1.1.0"}
55+
"mirage-crypto-rng-lwt" {= "1.1.0"}
56+
"mrmime" {= "0.6.1"}
57+
"mtime" {= "2.1.0"}
58+
"ocaml" {= "4.14.2"}
5759
"ocaml-syntax-shims" {= "1.0.0"}
58-
"ocamlbuild" {= "0.14.3"}
60+
"ocamlbuild" {= "0.15.0"}
5961
"ocamlfind" {= "1.9.6"}
6062
"ocplib-endian" {= "1.2"}
61-
"pbkdf" {= "1.2.0"}
62-
"pecu" {= "0.6"}
63+
"ohex" {= "0.2.0"}
64+
"pecu" {= "0.7"}
6365
"prettym" {= "0.0.3"}
64-
"ptime" {= "1.1.0"}
65-
"re" {= "1.11.0"}
66+
"ptime" {= "1.2.0"}
67+
"re" {= "1.12.0"}
6668
"rosetta" {= "0.3.0"}
6769
"rresult" {= "0.7.0"}
68-
"sendmail" {= "0.8.0"}
70+
"sendmail" {= "0.11.0"}
6971
"seq" {= "base"}
70-
"sexplib0" {= "v0.16.0"}
71-
"tls" {= "0.17.3"}
72-
"tls-lwt" {= "0.17.3"}
72+
"tls" {= "1.0.4"}
73+
"tls-lwt" {= "1.0.4"}
7374
"topkg" {= "1.0.7"}
74-
"unstrctrd" {= "0.3"}
75+
"unstrctrd" {= "0.4"}
7576
"uutf" {= "1.0.3"}
7677
"uuuu" {= "0.3.0"}
77-
"x509" {= "0.16.5"}
78+
"x509" {= "1.0.5"}
7879
"yuscii" {= "0.3.0"}
79-
"zarith" {= "1.13"}
80+
"zarith" {= "1.14"}
8081
]
8182
build: [
8283
["dune" "subst"] {dev}

lib/letters.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ let send =
243243
let recipients =
244244
List.map
245245
(fun recipient ->
246-
(match recipient with
247-
| To a -> a
248-
| Cc a -> a
249-
| Bcc a -> a)
250-
|> str_to_colombe_address)
246+
(match recipient with
247+
| To a -> a
248+
| Cc a -> a
249+
| Bcc a -> a)
250+
|> str_to_colombe_address)
251251
recipients
252252
in
253253
let domain =

lib/letters.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module Config : sig
3333
-> hostname:string
3434
-> with_starttls:bool
3535
-> t
36-
[@@deprecated "Replace with [create] function"]
36+
[@@deprecated "Replace with [create] function"]
3737

3838
(** Add a port to configuration record
3939
@@ -105,7 +105,7 @@ val build_email
105105
-> subject:string
106106
-> body:body
107107
-> (Mrmime.Mt.t, string) result
108-
[@@deprecated "Replace with [create_email] function"]
108+
[@@deprecated "Replace with [create_email] function"]
109109

110110
(** Send the previously created email
111111

lib/sendmail_handler.ml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,29 @@ let rdwr =
3535
}
3636
;;
3737

38+
let convert_tls_error = fun (`Msg msg) -> `Protocol (`Invalid_login_challenge msg)
39+
3840
let run_with_starttls
39-
~hostname
40-
?port
41-
~domain
42-
?authentication
43-
~tls_authenticator
44-
~from
45-
~recipients
46-
~mail
41+
~hostname
42+
?port
43+
~domain
44+
?authentication
45+
~tls_authenticator
46+
~from
47+
~recipients
48+
~mail
4749
=
50+
let ( let* ) = Lwt_result.bind in
4851
let port =
4952
match port with
5053
| Some port -> port
5154
| None -> 465
5255
in
53-
let tls = Tls.Config.client ~authenticator:tls_authenticator () in
56+
let* tls =
57+
Tls.Config.client ~authenticator:tls_authenticator ()
58+
|> Lwt_result.lift
59+
|> Lwt_result.map_error convert_tls_error
60+
in
5461
let ctx = Sendmail_with_starttls.Context_with_tls.make () in
5562
let open Lwt.Infix in
5663
Lwt_unix.gethostbyname (Domain_name.to_string hostname)
@@ -94,7 +101,7 @@ let run_with_starttls
94101

95102
let run ~hostname ?port ~domain ?authentication ~tls_authenticator ~from ~recipients ~mail
96103
=
97-
let ( let* ) = Lwt.bind in
104+
let ( let* ) = Lwt_result.bind in
98105
let port =
99106
match port with
100107
| Some port -> port
@@ -103,6 +110,7 @@ let run ~hostname ?port ~domain ?authentication ~tls_authenticator ~from ~recipi
103110
let ctx = Colombe.State.Context.make () in
104111
let* ic, oc =
105112
Tls_lwt.connect tls_authenticator (Domain_name.to_string hostname, port)
113+
|> Lwt_result.map_error convert_tls_error
106114
in
107115
let mail_stream () =
108116
match mail () with

service-test/test.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ let ( let* ) = Lwt.bind
55
let get_ethereal_account_details () =
66
let open Yojson.Basic.Util in
77
(* see the README.md how to generate the account file and the path
8-
* below is relative to the location of the executable under _build
9-
*)
8+
* below is relative to the location of the executable under _build
9+
*)
1010
let json = Yojson.Basic.from_file "../../../ethereal_account.json" in
1111
let username = json |> member "username" |> to_string in
1212
let password = json |> member "password" |> to_string in
@@ -21,8 +21,8 @@ let get_ethereal_account_details () =
2121
let get_mailtrap_account_details () =
2222
let open Yojson.Basic.Util in
2323
(* see the README.md how to generate the account file and the path
24-
* below is relative to the location of the executable under _build
25-
*)
24+
* below is relative to the location of the executable under _build
25+
*)
2626
let json = Yojson.Basic.from_file "../../../mailtrap_account.json" in
2727
let username = json |> member "username" |> to_string in
2828
let password = json |> member "password" |> to_string in

0 commit comments

Comments
 (0)