From d2448c75eba1006147ac9744a68091a5681bf7dd Mon Sep 17 00:00:00 2001 From: Tim McGilchrist Date: Mon, 24 Mar 2025 14:39:38 +1100 Subject: [PATCH] Various updates to dune and CI setup --- .github/dependabot.yml | 6 +++++ .github/workflows/build.yml | 53 +++++++++++++++++++++++++++++++++++++ .ocamlinit | 7 ----- .travis.yml | 29 -------------------- doc/api.odocl | 1 - dune-project | 22 ++++++++++++++- punycode.opam | 49 +++++++++++++++++++--------------- src/dune | 3 +-- src/punycode.mli | 2 +- src/punycode.mllib | 1 - tests/dune | 18 ++++--------- 11 files changed, 114 insertions(+), 77 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .ocamlinit delete mode 100644 .travis.yml delete mode 100644 doc/api.odocl delete mode 100644 src/punycode.mllib diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d7007f4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7a3d46a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + schedule: + # Prime the caches every Monday + - cron: 0 1 * * MON + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + packages: + - "punycode.opam" + ocaml-compiler: + - "ocaml-variants.5.3.0+options,ocaml-option-afl" + - "5.3" + - "4.14" + - "4.08" + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set-up OCaml ${{ matrix.ocaml-compiler }} + uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + + - name: Install dependencies + run: | + opam install . --with-test --deps-only + + - name: Build + run: | + opam exec -- dune build @all + + - name: Tests + run: | + opam exec -- dune build @runtest + + - name: Opam Lint + run: | + opam lint . diff --git a/.ocamlinit b/.ocamlinit deleted file mode 100644 index 722b6c5..0000000 --- a/.ocamlinit +++ /dev/null @@ -1,7 +0,0 @@ -#require "astring" -#require "domain-name" -#require "uutf" -#require "rresult" -#mod_use "src/punycode.ml" -open Rresult;; -open Punycode;; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4a94e75..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -env: - global: - - PACKAGE="punycode" - - OPAM_VERSION=2.0.5 - matrix: - - OCAML_VERSION=4.02 - - OCAML_VERSION=4.03 - - OCAML_VERSION=4.04 - - OCAML_VERSION=4.05 - - OCAML_VERSION=4.06 - - OCAML_VERSION=4.07 - - OCAML_VERSION=4.08 - - OCAML_VERSION=4.09 - -os: - - linux - - osx -language: c -install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-opam.sh -sudo: required -script: bash -ex .travis-opam.sh -branches: - only: - - gh-pages - - /.*/ -git: - depth: 2 -notifications: - email: false diff --git a/doc/api.odocl b/doc/api.odocl deleted file mode 100644 index ccc9110..0000000 --- a/doc/api.odocl +++ /dev/null @@ -1 +0,0 @@ -Punycode diff --git a/dune-project b/dune-project index 6aae99a..329069d 100644 --- a/dune-project +++ b/dune-project @@ -1 +1,21 @@ -(lang dune 1.9) +(lang dune 3.7) +(name punycode) +(generate_opam_files true) + +(license AGPL-3.0-only) +(maintainers "cfcs") +(authors "cfcs") +(source (github cfcs/ocaml-punycode)) + +(package + (name punycode) + (synopsis "RFC 3492: IDNA Punycode library") + (depends + (ocaml (>= 4.08)) + astring + uutf + rresult + (domain-name (>= 0.3)) + (alcotest :with-test) + (crowbar :with-test) + (qcheck :with-test))) \ No newline at end of file diff --git a/punycode.opam b/punycode.opam index 5502b13..cde867f 100644 --- a/punycode.opam +++ b/punycode.opam @@ -1,30 +1,35 @@ +# This file is generated by dune, edit dune-project instead opam-version: "2.0" -name: "punycode" -synopsis: "RFC 3492: IDNA Punycode library" -homepage: "https://github.com/cfcs/ocaml-punycode" -dev-repo: "git+https://github.com/cfcs/ocaml-punycode.git" -bug-reports: "https://github.com/cfcs/ocaml-punycode/issues" -doc: "https://cfcs.github.io/ocaml-punycode/doc" -author: ["cfcs"] -maintainer: ["cfcs"] -license: "AGPL" - -build: [ - ["dune" "build" "-p" name "-j" jobs] - ["dune" "build" "-p" name "runtest"] {with-test} -] - +synopsis: "RFC 3492: IDNA Punycode library" +maintainer: ["cfcs"] +authors: ["cfcs"] +license: "AGPL-3.0-only" +homepage: "https://github.com/cfcs/ocaml-punycode" +bug-reports: "https://github.com/cfcs/ocaml-punycode/issues" depends: [ - "ocaml" { >= "4.02" } - "dune" { >= "1.9.3" & build } - + "dune" {>= "3.7"} + "ocaml" {>= "4.08"} "astring" - "domain-name" { >= "0.3" } - "uchar" # for ocaml 4.02 compat - "rresult" "uutf" - + "rresult" + "domain-name" {>= "0.3"} "alcotest" {with-test} "crowbar" {with-test} "qcheck" {with-test} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] ] +dev-repo: "git+https://github.com/cfcs/ocaml-punycode.git" diff --git a/src/dune b/src/dune index ca74689..a95af71 100644 --- a/src/dune +++ b/src/dune @@ -3,5 +3,4 @@ (public_name punycode) (synopsis "Punycode IDNA library") (modules :standard) - (libraries astring domain-name uchar uutf rresult) -) + (libraries astring domain-name uutf rresult)) diff --git a/src/punycode.mli b/src/punycode.mli index 6393742..a02dd43 100644 --- a/src/punycode.mli +++ b/src/punycode.mli @@ -41,7 +41,7 @@ val msg_of_decode_error : punycode_decode_error -> [> `Msg of string] *) -(** {1:unicode2punycode Unicode -> Punycode}*) +(** {1:unicode2punycode Unicode -> Punycode} *) val to_encoded_domain_name : string -> diff --git a/src/punycode.mllib b/src/punycode.mllib deleted file mode 100644 index ccc9110..0000000 --- a/src/punycode.mllib +++ /dev/null @@ -1 +0,0 @@ -Punycode diff --git a/tests/dune b/tests/dune index 878ff2d..63acfde 100644 --- a/tests/dune +++ b/tests/dune @@ -1,13 +1,5 @@ -(executables - (names tests) - (public_names -) - (libraries punycode qcheck crowbar alcotest) -) -(alias - (name runtest) - (action - (progn - (run ./tests.exe) - ) - ) -) +(test + (name tests) + (package punycode) + (libraries punycode qcheck crowbar alcotest) + (modules tests))