Skip to content

Commit

Permalink
add opam ci (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Mar 20, 2023
1 parent 05336d3 commit 98b294b
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 18 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/opam-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Opam Pipeline

on:
pull_request:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and test

strategy:
fail-fast: false
matrix:
os:
# - macos-latest
- ubuntu-latest
ocaml-compiler:
- 5.x

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Install locally
run: |
# https://github.com/ocaml/opam-repository/pull/23539
opam pin add eio-ssl git+https://github.com/anmonteiro/eio-ssl.git
opam install . --with-test
11 changes: 6 additions & 5 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
ssl
uri
ipaddr
httpaf-eio
(httpaf-eio :dev)
gluten-eio
h2-eio
websocketaf
multipart_form
(dune-site :wit-test)
(h2-eio :dev)
(websocketaf :dev)
(multipart_form :dev)
(eio_main :with-test)
(dune-site :with-test)
(alcotest :with-test)))
4 changes: 2 additions & 2 deletions lib_test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
(test
(name test_client)
(package piaf)
(libraries alcotest piaf logs.fmt dune-site)
(libraries alcotest piaf logs.fmt dune-site eio_main)
(modules helper_server test_client cert_sites)
(deps
(source_tree "./certificates")))

(test
(name test_response)
(package piaf)
(libraries alcotest piaf logs.fmt)
(libraries alcotest piaf logs.fmt eio_main)
(modules test_response))
14 changes: 8 additions & 6 deletions lib_test/test_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ let test_https ~sw env () =
with
| exn -> Error (`Exn exn)
in
Alcotest.(check (result response_testable error_testable))
"response error"
(Error
(`Connect_error
"SSL Error: error:16000069:STORE routines::unregistered scheme"))
response;
(match response with
| Ok _r -> Alcotest.fail "Expected SSL error response"
| Error (`Connect_error s) ->
Alcotest.(check bool)
"response error"
true
(String.starts_with ~prefix:"SSL Error: error:" s)
| Error _ -> assert false);
Helper_server.teardown server

let test_https_server_certs ~sw env () =
Expand Down
20 changes: 15 additions & 5 deletions piaf.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ depends: [
"ssl"
"uri"
"ipaddr"
"httpaf-eio"
"httpaf-eio" {dev}
"gluten-eio"
"h2-eio"
"websocketaf"
"multipart_form"
"dune-site" {wit-test}
"h2-eio" {dev}
"websocketaf" {dev}
"multipart_form" {dev}
"eio_main" {with-test}
"dune-site" {with-test}
"alcotest" {with-test}
"odoc" {with-doc}
]
Expand All @@ -41,3 +42,12 @@ build: [
]
]
dev-repo: "git+https://github.com/anmonteiro/piaf.git"
pin-depends: [
[ "httpaf.dev" "git+https://github.com/anmonteiro/httpaf.git" ]
[ "httpaf-eio.dev" "git+https://github.com/anmonteiro/httpaf.git" ]
# https://github.com/ocaml/opam-repository/pull/23533
[ "h2.dev" "git+https://github.com/anmonteiro/ocaml-h2.git" ]
[ "h2-eio.dev" "git+https://github.com/anmonteiro/ocaml-h2.git" ]
[ "websocketaf.dev" "git+https://github.com/anmonteiro/websocketaf.git" ]
[ "multipart_form.dev" "git+https://github.com/anmonteiro/multipart_form.git" ]
]
9 changes: 9 additions & 0 deletions piaf.opam.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pin-depends: [
[ "httpaf.dev" "git+https://github.com/anmonteiro/httpaf.git" ]
[ "httpaf-eio.dev" "git+https://github.com/anmonteiro/httpaf.git" ]
# https://github.com/ocaml/opam-repository/pull/23533
[ "h2.dev" "git+https://github.com/anmonteiro/ocaml-h2.git" ]
[ "h2-eio.dev" "git+https://github.com/anmonteiro/ocaml-h2.git" ]
[ "websocketaf.dev" "git+https://github.com/anmonteiro/websocketaf.git" ]
[ "multipart_form.dev" "git+https://github.com/anmonteiro/multipart_form.git" ]
]

0 comments on commit 98b294b

Please sign in to comment.