Skip to content

Example for dkml-workflows for an Opam Monorepo and Dune build workflow

License

Notifications You must be signed in to change notification settings

diskuv/dkml-workflows-monorepo-example

Repository files navigation

dkml-workflows-monorepo-example

Attention: This example is not ready for public use yet! Even though this example looks like it is working, the .opam.locked file was hand-edited. The fix is being tracked in issue opam-monorepo#327.

An Opam Monorepo example for the dkml-workflows collection of GitHub Action, GitLab CI/CD and desktop workflows. DKML helps you distribute native OCaml applications on the most common operating systems. In particular dkml-workflows builds:

  • Windows libraries and executables with the traditional Visual Studio compiler, avoiding hard-to-debug runtime issued caused by compiler incompatibilities
  • macOS libraries and executables for both Intel and ARM64 (Apple Silicon) architectures
  • Linux libraries and executables on an ancient "glibc" C library, letting you distribute your software to most Linux users while avoiding the alternative approach of static linking the system C library

The full list of examples is:

Example Who For
dkml-workflows-monorepo-example Not ready for public use yet!
You want to cross-compile ARM64 on Mac Intel.
You are building Mirage unikernels.
dkml-workflows-regular-example Everybody else

Before using these examples be sure to read the advantages and disadvantages of setup-dkml. One particular limitation is that, as of today, dkml-workflows only supports OCaml 4.12.1.

Expect to wait approximately:

Build Step First Time Subsequent Times
build / win32-windows_x86 33m 8m
build / win32-windows_x86_64 35m 11m
build / macos-darwin_all 26m 6m
build / manylinux2014-linux_x86 (CentOS 7, etc.) 20m 5m
build / manylinux2014-linux_x86_64 (CentOS 7, etc.) 16m 5m

You can see an example workflow at https://github.com/diskuv/dkml-workflows-monorepo-example/actions/workflows/package.yml

[1] setup-dkml/macos-darwin_all is doing double-duty: it is compiling x86_64 and arm64 systems.

For news about Diskuv OCaml, Twitter URL on Twitter.

Differences from the Opam Regular build flow

  • Opam Monorepo pull was used to pre-download all the Opam packages into the duniverse/ directory
  • The dkml-base-compiler and conf-dkml-cross-toolchain packages are used to get a cross-compiler for macOS.
  • The dune-universe Opam repository was added so that all Opam packages use Dune as their only build tool

Outstanding Issues before Public Release

Opam Monorepo Issues

  • Accept dkml-base-compiler.4.12.1~v1.0.0 instead of just ocaml-base-compiler.M.N.O
  • conf-dkml-cross-toolchain needs to be installed before any of the Dune packages are built; it provides the ocamlfind toolchains. Is this just x-opam-monorepo-opam-provided?

Tracked in issue opam-monorepo#327

Sponsor

OCSF logo Thanks to the OCaml Software Foundation for economic support to the development of Diskuv OCaml.

Status

What Branch/Tag Status
Builds and tests Builds and tests
Static checks Static checks