Migrate GitHub CI to OxCaml
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
This commit is contained in:
committed by
Tudor Brindus
parent
1f28c8a51f
commit
1d6e208763
@@ -11,7 +11,7 @@ jobs:
|
||||
os:
|
||||
- ubuntu_x64_8_cores
|
||||
ocaml-version:
|
||||
- 4.14.0
|
||||
- '5.2.0+ox'
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.opam
|
||||
key: ${{ matrix.os }}-opam-${{ matrix.ocaml-version }}-flambda-musl-v6
|
||||
key: ${{ matrix.os }}-opam-${{ matrix.ocaml-version }}-1
|
||||
|
||||
- name: Install musl-compatible kernel headers
|
||||
run: |
|
||||
@@ -29,11 +29,12 @@ jobs:
|
||||
curl -L https://github.com/sabotage-linux/kernel-headers/archive/refs/tags/v4.19.88-1.tar.gz | \
|
||||
tar -xz -C musl-kernel --strip-components=1
|
||||
echo "C_INCLUDE_PATH=$(pwd)/musl-kernel/x86/include" >> "$GITHUB_ENV"
|
||||
echo "CC=musl-gcc" >> "$GITHUB_ENV"
|
||||
|
||||
- name: "Install apt packages"
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install bubblewrap musl-tools libucl1
|
||||
sudo apt-get install -y bubblewrap musl musl-tools libucl1 rsync
|
||||
|
||||
- name: Install upx
|
||||
run: |
|
||||
@@ -50,7 +51,7 @@ jobs:
|
||||
CC=musl-gcc ./configure --libdir=/usr/lib/x86_64-linux-musl --includedir=/usr/include/x86_64-linux-musl
|
||||
make -j$(nproc)
|
||||
sudo make install
|
||||
|
||||
|
||||
- name: Build zstd with musl
|
||||
run: |
|
||||
mkdir musl-zstd
|
||||
@@ -62,7 +63,7 @@ jobs:
|
||||
|
||||
- name: Use OCaml ${{ matrix.ocaml-version }}
|
||||
run: |
|
||||
sudo wget -O /usr/local/bin/opam https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-x86_64-linux
|
||||
sudo wget -O /usr/local/bin/opam https://github.com/ocaml/opam/releases/download/2.5.0/opam-2.5.0-x86_64-linux
|
||||
sudo chmod a+x /usr/local/bin/opam
|
||||
|
||||
export OPAMYES=1
|
||||
@@ -71,13 +72,28 @@ jobs:
|
||||
echo "OPAMJOBS=$OPAMJOBS" >> "$GITHUB_ENV"
|
||||
|
||||
opam init --bare -yav https://github.com/ocaml/opam-repository.git
|
||||
opam switch set ${{ matrix.ocaml-version }}-flambda-musl 2>/dev/null || \
|
||||
opam switch create ${{ matrix.ocaml-version }}-flambda-musl \
|
||||
--packages=ocaml-variants.${{ matrix.ocaml-version }}+options,ocaml-option-flambda,ocaml-option-musl
|
||||
opam switch set ${{ matrix.ocaml-version }} 2>/dev/null || \
|
||||
opam switch create ${{ matrix.ocaml-version }} --repos ox=git+https://github.com/oxcaml/opam-repository.git,default
|
||||
|
||||
- name: Vendor Basement
|
||||
run: |
|
||||
mkdir ../basement
|
||||
curl -L 'https://github.com/janestreet/basement/archive/c657898128a97dcdfbe4b25d79fd0de2e1e5218f.tar.gz' | \
|
||||
tar -C ../basement -xz --strip-components=1
|
||||
git -C ../basement apply $PWD/vendor/basement-semaphore-bug-fix.patch
|
||||
opam pin basement ../basement
|
||||
|
||||
- name: Vendor Core_unix
|
||||
run: |
|
||||
mkdir ../core_unix
|
||||
curl -L 'https://github.com/janestreet/core_unix/archive/63390a3f75376156e77ed49d6cc07ca48a90dd53.tar.gz' | \
|
||||
tar -C ../core_unix -xz --strip-components=1
|
||||
git -C ../core_unix apply $PWD/vendor/core-unix-musl-compatibility.patch
|
||||
opam pin core_unix ../core_unix
|
||||
|
||||
- run: opam install ./magic-trace.opam --deps-only
|
||||
|
||||
- run: opam install ocamlformat.0.26.2
|
||||
- run: opam install ocamlformat
|
||||
- run: opam exec -- dune build @fmt
|
||||
|
||||
- run: opam exec -- make PROFILE=static
|
||||
|
||||
@@ -11,6 +11,7 @@ build: [
|
||||
]
|
||||
depends: [
|
||||
"ocaml" {>= "4.14"}
|
||||
"ocaml_intrinsics"
|
||||
"async"
|
||||
"camlzip"
|
||||
"cohttp"
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
commit 16d35743d6b52bc0b38702a459025ba82bd8811f
|
||||
Author: Fake Name <fake@gmail.com>
|
||||
Date: Thu Dec 11 03:26:20 2025 +0000
|
||||
|
||||
Fix bug where `sem_close` was being called on an unnamed semaphore
|
||||
|
||||
diff --git a/src/blocking_mutex.h b/src/blocking_mutex.h
|
||||
index b1d01df..c4658e3 100644
|
||||
--- a/src/blocking_mutex.h
|
||||
+++ b/src/blocking_mutex.h
|
||||
@@ -106,7 +106,7 @@ Caml_inline int blocking_mutex_destroy(blocking_mutex mut) {
|
||||
caml_stat_free(mut);
|
||||
return MUTEX_SUCCESS;
|
||||
#else
|
||||
- if (sem_close(&mut->sem) == MUTEX_SUCCESS) {
|
||||
+ if (sem_destroy(&mut->sem) == MUTEX_SUCCESS) {
|
||||
caml_stat_free(mut);
|
||||
return MUTEX_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
commit 3254c4bb0793ab87c674ddd9f404cb21dd20e311
|
||||
Author: Fake Name <fake@gmail.com>
|
||||
Date: Thu Dec 11 01:21:19 2025 +0000
|
||||
|
||||
Make `Core_unix` compatible with `musl`
|
||||
|
||||
diff --git a/bigstring_unix/src/bigstring_unix_stubs.c b/bigstring_unix/src/bigstring_unix_stubs.c
|
||||
index 785ff10..009c2cb 100644
|
||||
--- a/bigstring_unix/src/bigstring_unix_stubs.c
|
||||
+++ b/bigstring_unix/src/bigstring_unix_stubs.c
|
||||
@@ -28,7 +28,7 @@
|
||||
#define bswap_16 OSSwapInt16
|
||||
#define bswap_32 OSSwapInt32
|
||||
#define bswap_64 OSSwapInt64
|
||||
-#elif __GLIBC__
|
||||
+#elif defined(__linux__)
|
||||
#include <byteswap.h>
|
||||
#include <malloc.h>
|
||||
#else
|
||||
diff --git a/core_unix/src/core_unix_stubs.c b/core_unix/src/core_unix_stubs.c
|
||||
index 216b5be..847d707 100644
|
||||
--- a/core_unix/src/core_unix_stubs.c
|
||||
+++ b/core_unix/src/core_unix_stubs.c
|
||||
@@ -378,7 +378,7 @@ CAMLprim value core_unix_fdatasync(value v_fd) {
|
||||
return Val_unit;
|
||||
}
|
||||
#else
|
||||
-#warning "_POSIX_SYNCHRONIZED_IO undefined or <= 0; aliasing unix_fdatasync to unix_fsync"
|
||||
+//#warning "_POSIX_SYNCHRONIZED_IO undefined or <= 0; aliasing unix_fdatasync to unix_fsync"
|
||||
CAMLprim value core_unix_fdatasync(value v_fd) { return core_unix_fsync(v_fd); }
|
||||
#endif
|
||||
|
||||
@@ -789,7 +789,7 @@ CAMLprim value core_unix_clock_thread_cputime_id_stub(value __unused v_unit) {
|
||||
#undef CLOCK
|
||||
|
||||
#else
|
||||
-#warning "posix timers not present; clock functions undefined"
|
||||
+//#warning "posix timers not present; clock functions undefined"
|
||||
#endif
|
||||
|
||||
/* Resource limits */
|
||||
@@ -1506,7 +1506,7 @@ CAMLprim value core_unix_sched_setscheduler(value v_pid, value v_policy,
|
||||
return Val_unit;
|
||||
}
|
||||
#else
|
||||
-#warning "_POSIX_PRIORITY_SCHEDULING not present; sched_setscheduler undefined"
|
||||
+//#warning "_POSIX_PRIORITY_SCHEDULING not present; sched_setscheduler undefined"
|
||||
CAMLprim value core_unix_sched_setscheduler(value __unused v_pid, value __unused v_policy,
|
||||
value __unused v_priority) {
|
||||
caml_invalid_argument("sched_setscheduler unimplemented");
|
||||
@@ -1599,7 +1599,7 @@ CAMLprim value core_unix_strptime_l(value v_locale, value v_allow_trailing_input
|
||||
value v_fmt, value v_s) {
|
||||
|
||||
locale_t locale = (locale_t)Nativeint_val(v_locale);
|
||||
- return core_unix_strptime_gen(locale, v_allow_trailing_input, v_fmt, v_s, strptime_l);
|
||||
+ return core_unix_strptime_gen(locale, v_allow_trailing_input, v_fmt, v_s, strptime_callback);
|
||||
}
|
||||
|
||||
CAMLprim value core_unix_remove(value v_path) {
|
||||
diff --git a/filename_unix/src/filename_unix_stubs.c b/filename_unix/src/filename_unix_stubs.c
|
||||
index e4826a1..c14cafa 100644
|
||||
--- a/filename_unix/src/filename_unix_stubs.c
|
||||
+++ b/filename_unix/src/filename_unix_stubs.c
|
||||
@@ -28,7 +28,7 @@ CAMLprim value core_unix_realpath(value v_path) {
|
||||
}
|
||||
#else
|
||||
CAMLprim value core_unix_realpath(value v_path) {
|
||||
- char *path = String_val(v_path);
|
||||
+ const char *path = String_val(v_path);
|
||||
/* [realpath] is inherently broken without GNU-extension, and this
|
||||
seems like a reasonable thing to do if we do not build against
|
||||
GLIBC. */
|
||||
diff --git a/linux_ext/src/linux_ext_stubs.c b/linux_ext/src/linux_ext_stubs.c
|
||||
index 3a948b7..6d9e7f0 100644
|
||||
--- a/linux_ext/src/linux_ext_stubs.c
|
||||
+++ b/linux_ext/src/linux_ext_stubs.c
|
||||
@@ -230,7 +230,7 @@ CAMLprim value core_linux_sendmsg_nonblocking_no_sigpipe_stub(value v_fd, value
|
||||
int count = Int_val(v_count);
|
||||
ssize_t ret;
|
||||
struct iovec *iovecs = caml_stat_alloc(sizeof(struct iovec) * count);
|
||||
- struct msghdr msghdr = {NULL, 0, NULL, 0, NULL, 0, 0};
|
||||
+ struct msghdr msghdr = {NULL, 0, NULL, 0, 0, 0, 0};
|
||||
msghdr.msg_iov = iovecs;
|
||||
msghdr.msg_iovlen = count;
|
||||
for (--count; count >= 0; --count) {
|
||||
diff --git a/time_float_unix/time_unix/dune b/time_float_unix/time_unix/dune
|
||||
deleted file mode 100644
|
||||
index 729e749..0000000
|
||||
--- a/time_float_unix/time_unix/dune
|
||||
+++ /dev/null
|
||||
@@ -1,6 +0,0 @@
|
||||
-(library
|
||||
- (name time_unix)
|
||||
- (public_name core_unix.time_unix)
|
||||
- (libraries time_float_unix)
|
||||
- (preprocess
|
||||
- (pps ppx_jane)))
|
||||
diff --git a/time_float_unix/time_unix/time_unix.ml b/time_float_unix/time_unix/time_unix.ml
|
||||
deleted file mode 100644
|
||||
index c1bdb7d..0000000
|
||||
--- a/time_float_unix/time_unix/time_unix.ml
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-[@@@deprecated "[since 2022-04] Use [Time_float_unix] instead"]
|
||||
-(* In the immortal words of MC Hammer: "Stop ... (using) unix time!" *)
|
||||
-
|
||||
-include Time_float_unix
|
||||
Reference in New Issue
Block a user