From dfd67a826c68a2efa5d4c2cea7b9897e12964adc Mon Sep 17 00:00:00 2001 From: Gargi Sharma Date: Thu, 3 Feb 2022 14:17:53 +0100 Subject: [PATCH 1/2] Allow running benchmarks on pull requests The custom dockerfile allows installing system dependencies like zlib, the Makefile has the "make bench" target that is run once all the dependencies are installed and the opam file allows installing necessary dependencies for the benchmarks. --- Makefile | 6 ++++++ bench.Dockerfile | 13 +++++++++++++ decompress-bench.opam | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 Makefile create mode 100644 bench.Dockerfile create mode 100644 decompress-bench.opam diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cd0d0e0 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +.PHONY: bench + + +bench: + dune build --profile benchmark bench/output.csv && \ + cat /dev/urandom | ./_build/default/bench/zpipe | ./_build/default/bench/bench.exe -j diff --git a/bench.Dockerfile b/bench.Dockerfile new file mode 100644 index 0000000..e6f2233 --- /dev/null +++ b/bench.Dockerfile @@ -0,0 +1,13 @@ +FROM ocaml/opam:debian-10-ocaml-4.13 + +RUN sudo apt-get install -qq -yy --no-install-recommends zlib1g-dev pkg-config + +RUN opam exec -- opam remote add origin https://opam.ocaml.org + +RUN opam exec -- opam update + +COPY --chown=opam:opam . bench-dir + +WORKDIR bench-dir + +RUN opam exec -- opam install -y --deps-only ./decompress-bench.opam diff --git a/decompress-bench.opam b/decompress-bench.opam new file mode 100644 index 0000000..f1f5db0 --- /dev/null +++ b/decompress-bench.opam @@ -0,0 +1,42 @@ +opam-version: "2.0" +name: "decompress" +maintainer: "Romain Calascibetta " +authors: "Romain Calascibetta " +homepage: "https://github.com/mirage/decompress" +bug-reports: "https://github.com/mirage/decompress/issues" +dev-repo: "git+https://github.com/mirage/decompress.git" +doc: "https://mirage.github.io/decompress/" +license: "MIT" +synopsis: "Implementation of Zlib and GZip in OCaml" +description: """Decompress is an implementation of Zlib and GZip in OCaml + +It provides a pure non-blocking interface to inflate and deflate data flow. +""" + +build: [ "dune" "build" "-p" name "-j" jobs ] +run-test: [ "dune" "runtest" "-p" name "-j" jobs ] + +depends: [ + "ocaml" {>= "4.07.0"} + "dune" {>= "2.8.0"} + "base-bytes" + "bigarray-compat" + "cmdliner" {>= "1.0.0"} + "optint" {>= "0.1.0"} + "checkseum" {>= "0.2.0"} + "bigstringaf" {with-test} + "alcotest" {with-test} + "ctypes" {with-test & >= "0.18.0"} + "fmt" {with-test & >= "0.8.7"} + "camlzip" {>= "1.10" & with-test} + "base64" {>= "3.0.0" & with-test} + "crowbar" {with-test & >= "0.2"} + "rresult" {with-test} + "yojson" + "ppx_deriving_yojson" + "optint" + "landmarks" + "fpath" + "rresult" + "bos" +] From c7e35b42f8c1a52daa5f4fdab456622360e02498 Mon Sep 17 00:00:00 2001 From: Gargi Sharma Date: Wed, 9 Feb 2022 08:43:14 +0100 Subject: [PATCH 2/2] Add bench dockerfile --- bench.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bench.Dockerfile b/bench.Dockerfile index e6f2233..54649ab 100644 --- a/bench.Dockerfile +++ b/bench.Dockerfile @@ -11,3 +11,4 @@ COPY --chown=opam:opam . bench-dir WORKDIR bench-dir RUN opam exec -- opam install -y --deps-only ./decompress-bench.opam +