diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 5e5ef38..0000000 --- a/.drone.yml +++ /dev/null @@ -1,18 +0,0 @@ -kind: pipeline -name: amd - -platform: - os: linux - arch: amd64 - -steps: - - name: build - image: ocaml/opam:debian-ocaml-4.12-afl - commands: - - sudo chown -R opam . - - git -C /home/opam/opam-repository pull origin 1ce065bc0cbef7bc06effcd3865af0d430c6273b && opam update - - opam pin add -n . - - opam depext -u cstruct-async cstruct-lwt cstruct-unix cstruct ppx_cstruct - - opam install -y . - - opam install -y dune crowbar fmt 'bun>=0.3.4' - - opam exec -- dune build @fuzz --no-buffer diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b7d0667..535647f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,57 +1,42 @@ name: Cstruct on: [push, pull_request] jobs: - latest: - name: Latest - runs-on: ${{ matrix.operating-system }} + # cstruct and its runtime siblings build on modern OCaml, including 5.x. + build: + name: ${{ matrix.ocaml-compiler }} / ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - ocaml-version: [ '4.13.1', '4.10.0', '4.08.1' ] - operating-system: [macos-latest, ubuntu-latest, windows-latest] + os: [ubuntu-latest, macos-latest] + ocaml-compiler: + - "5.3" + - "5.1" + - "4.14" steps: - - uses: actions/checkout@v2 - - uses: avsm/setup-ocaml@v1 - with: - ocaml-version: ${{ matrix.ocaml-version }} - - run: opam pin add -n . - - name: Packages - run: opam depext -yt cstruct cstruct-sexp cstruct-unix cstruct-lwt - - name: Build - run: opam install -t cstruct cstruct-sexp cstruct-unix cstruct-lwt - ppx: - name: PPX - runs-on: ${{ matrix.operating-system }} + - uses: actions/checkout@v4 + - uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + - run: >- + opam install ./cstruct.opam ./cstruct-sexp.opam ./cstruct-unix.opam + ./cstruct-lwt.opam --deps-only + - run: opam exec -- dune build -p cstruct,cstruct-sexp,cstruct-unix,cstruct-lwt + + # ppx_cstruct (ocaml-migrate-parsetree) and cstruct-async (async) do not build + # on OCaml 5.x, so run the full build and test on 4.14. + test: + name: full build + test (4.14) / ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - ocaml-version: [ '4.13.1', '4.10.0', '4.08.1' ] - operating-system: [macos-latest, ubuntu-latest, windows-latest] + os: [ubuntu-latest, macos-latest] steps: - - uses: actions/checkout@v2 - - uses: avsm/setup-ocaml@v1 - with: - ocaml-version: ${{ matrix.ocaml-version }} - - run: opam pin add -n . - - name: Packages - run: opam depext -yt ppx_cstruct - - name: Build - run: opam install -t ppx_cstruct - async: - name: Async - runs-on: ${{ matrix.operating-system }} - strategy: - fail-fast: false - matrix: - ocaml-version: [ '4.13.1', '4.10.0', '4.08.1' ] - operating-system: [macos-latest, ubuntu-latest] - steps: - - uses: actions/checkout@v2 - - uses: avsm/setup-ocaml@v1 - with: - ocaml-version: ${{ matrix.ocaml-version }} - - run: opam pin add -n . - - name: Packages - run: opam depext -yt cstruct-async - - name: Dependencies - run: opam install -t cstruct-async + - uses: actions/checkout@v4 + - uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: "4.14" + - run: opam install . --deps-only --with-test + - run: opam exec -- dune build + - run: opam exec -- dune runtest diff --git a/cstruct-async.opam b/cstruct-async.opam index 9504af7..340b953 100644 --- a/cstruct-async.opam +++ b/cstruct-async.opam @@ -16,9 +16,9 @@ build: [ depends: [ "ocaml" {>= "4.08.0"} "dune" {>= "2.0.0"} - "async" {>= "v0.9.0"} - "async_unix" {>= "v0.9.0"} - "core" {>= "v0.9.0"} + "async" {>= "v0.9.0" & < "v0.17.0"} + "async_unix" {>= "v0.9.0" & < "v0.17.0"} + "core" {>= "v0.9.0" & < "v0.17.0"} "cstruct" {=version} ] synopsis: "Access C-like structures directly from OCaml" diff --git a/cstruct.opam b/cstruct.opam index 19ba9c5..6830762 100644 --- a/cstruct.opam +++ b/cstruct.opam @@ -20,7 +20,7 @@ depends: [ "dune" {>= "2.0.0"} "alcotest" {with-test} "fmt" {>= "0.8.9"} - "crowbar" {with-test} + "crowbar" {with-test & >= "0.2"} ] conflicts: [ "js_of_ocaml" {<"3.5.0"} ] synopsis: "Access C-like structures directly from OCaml" diff --git a/fuzz/dune b/fuzz/dune index 171f5f2..6228f94 100644 --- a/fuzz/dune +++ b/fuzz/dune @@ -2,11 +2,11 @@ (name fuzz) (libraries cstruct bigarray cstruct-sexp crowbar fmt)) +; The fuzzer is afl-only (see fuzz.ml): its generators are unbounded, so +; quickcheck mode hangs. Build it under runtest as a compile check; run the +; campaign with an afl-instrumented switch and afl-fuzz on fuzz.exe. + (rule - (alias fuzz) - (deps - fuzz.exe - (source_tree input)) - (action - (run timeout --preserve-status 30m bun -v --input=input --output=output -- - ./fuzz.exe))) + (alias runtest) + (deps fuzz.exe) + (action (progn)))