Skip to content

Commit

Permalink
Merge pull request #54 from MisterDA/opam-repo-ci-fixes
Browse files Browse the repository at this point in the history
Opam repo ci fixes
  • Loading branch information
djs55 authored Sep 30, 2021
2 parents 223483b + 712c60f commit 788afcb
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 11 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Main workflow

on:
pull_request:
push:
schedule:
# Prime the caches every Monday
- cron: 0 1 * * MON

jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
ocaml-compiler:
- 4.02.x
- 4.13.x

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

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

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

- run: opam install . --deps-only --with-test

- run: opam exec -- dune build

- run: opam exec -- dune runtest
Empty file modified c_flags.ml
100755 → 100644
Empty file.
10 changes: 7 additions & 3 deletions dune
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
(rule (with-stdout-to c_flags.sexp (run %{ocaml} %{dep:c_flags.ml})))
(rule
(with-stdout-to
c_flags.sexp
(run %{ocaml} %{dep:c_flags.ml})))

(library
(name sha)
(public_name sha)
(synopsis "SHA-1 and SHA-2 family implementations")
(wrapped false)
(modules sha1 sha256 sha512)
(flags -warn-error -3)
(libraries stdlib-shims)
(foreign_stubs
(language c)
(flags (:include c_flags.sexp))
(flags
:standard
(:include c_flags.sexp))
(names sha1_stubs sha256_stubs sha512_stubs)))
9 changes: 7 additions & 2 deletions dune-project
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 2.0)
(lang dune 2.9)

(name sha)

Expand Down Expand Up @@ -30,6 +30,11 @@
(description "This is the binding for SHA interface code in OCaml. Offering the same
interface than the MD5 digest included in the OCaml standard library.
It's currently providing SHA1, SHA256 and SHA512 hash functions.")
(depends (dune (>= 2.0)) (stdlib-shims (>= 0.3.0)) (ounit2 :with-test)))
(depends
(ocaml (>= 4.02))
(stdlib-shims (>= 0.3.0))
(ounit2 :with-test)))

(generate_opam_files true)
(formatting disabled)
(use_standard_c_and_cxx_flags true)
3 changes: 0 additions & 3 deletions pkg/pkg.ml

This file was deleted.

8 changes: 6 additions & 2 deletions sha.opam
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@ license: "ISC"
homepage: "https://github.com/djs55/ocaml-sha"
bug-reports: "https://github.com/djs55/ocaml-sha/issues"
depends: [
"dune" {>= "2.0"}
"dune" {>= "2.9"}
"ocaml" {>= "4.02"}
"stdlib-shims" {>= "0.3.0"}
"ounit2" {with-test}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {pinned}
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"--promote-install-files=false"
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
["dune" "install" "-p" name "--create-install-files" name]
]
dev-repo: "git+https://github.com/djs55/ocaml-sha.git"
5 changes: 5 additions & 0 deletions sha1_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ static inline int sha1_file(char *filename, sha1_digest *digest)
#include <caml/bigarray.h>
#include <caml/threads.h>

#include <caml/version.h>
#if OCAML_VERSION < 40600
#define Bytes_val(x) ((unsigned char *) Bp_val(x))
#endif

#define GET_CTX_STRUCT(a) ((struct sha1_ctx *) a)

CAMLexport value stub_sha1_init(value unit)
Expand Down
5 changes: 5 additions & 0 deletions sha256_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ static inline int sha256_file(char *filename, sha256_digest *digest)
#include <caml/bigarray.h>
#include <caml/threads.h>

#include <caml/version.h>
#if OCAML_VERSION < 40600
#define Bytes_val(x) ((unsigned char *) Bp_val(x))
#endif

#define GET_CTX_STRUCT(a) ((struct sha256_ctx *) a)

CAMLexport value stub_sha256_init(value unit)
Expand Down
5 changes: 5 additions & 0 deletions sha512_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ static inline int sha512_file(char *filename, sha512_digest *digest)
#include <caml/bigarray.h>
#include <caml/threads.h>

#include <caml/version.h>
#if OCAML_VERSION < 40600
#define Bytes_val(x) ((unsigned char *) Bp_val(x))
#endif

#define GET_CTX_STRUCT(a) ((struct sha512_ctx *) a)

CAMLexport value stub_sha512_init(value unit)
Expand Down
3 changes: 2 additions & 1 deletion test/dune
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
(rule
(alias runtest)
(deps sample.txt)
(action (run ./shatest.exe)))
(action
(run ./shatest.exe)))

0 comments on commit 788afcb

Please sign in to comment.