From 6dd0bebbee6a9c6eabc01e5efe71537e05ca2ea5 Mon Sep 17 00:00:00 2001 From: Kate Date: Mon, 30 Sep 2024 19:23:52 +0100 Subject: [PATCH 1/5] Fix the compilation of opam on Windows with OCaml >= 5.0 (again) --- master_changes.md | 1 + src/core/dune | 4 +++ src/core/opamStubs.ocaml4.ml | 39 +------------------------ src/core/opamStubs.ocaml5.ml | 2 -- src/core/opamWin32Stubs.win32.ml | 49 ++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 40 deletions(-) create mode 100644 src/core/opamWin32Stubs.win32.ml diff --git a/master_changes.md b/master_changes.md index 8a3128d6d00..f67d3879d14 100644 --- a/master_changes.md +++ b/master_changes.md @@ -74,6 +74,7 @@ users) * Bump the requirement for dune to 2.8 [#6204 @kit-ty-kate] * Bump the vendored version of dune to 3.16.0, cppo to 1.7.0 and extlib to 1.8.0 [#6223 @kit-ty-kate] * Fix compilation with OCaml 5.3 when using the vendored extlib by updating to the 5.3 compatible version (e.g. `make cold` or `./configure --with-vendored-deps`) [#6223 @kit-ty-kate] + * Fix the compilation of opam on Windows with OCaml >= 5.0 again [#6216 @kit-ty-kate] ## Infrastructure diff --git a/src/core/dune b/src/core/dune index 723aa44aaab..4fa3e09cdc5 100644 --- a/src/core/dune +++ b/src/core/dune @@ -29,6 +29,10 @@ (enabled_if (<> %{os_type} "Win32")) (action (copy# opamStubs.unix.ml opamStubs.ml))) +(rule + (enabled_if (= %{os_type} "Win32")) + (action (copy# opamWin32Stubs.win32.ml opamWin32Stubs.ml))) + (rule (enabled_if (and (= %{os_type} "Win32") (< %{ocaml_version} "5.0"))) (action (copy# opamStubs.ocaml4.ml opamStubs.ml))) diff --git a/src/core/opamStubs.ocaml4.ml b/src/core/opamStubs.ocaml4.ml index 7763f92837c..ef077a67e8b 100644 --- a/src/core/opamStubs.ocaml4.ml +++ b/src/core/opamStubs.ocaml4.ml @@ -8,45 +8,8 @@ (* *) (**************************************************************************) -include OpamStubsTypes +include OpamWin32Stubs -external getCurrentProcessID : unit -> int32 = "OPAMW_GetCurrentProcessID" -let getpid () = Int32.to_int (getCurrentProcessID ()) -(* Polymorphic parameters below are used as placeholders for types in - * OpamStubsTypes - it's not worth the effort of propagating the types here, - * even if it does result in some ugly-looking primitives! - *) -external getStdHandle : 'a -> 'b = "OPAMW_GetStdHandle" -external getConsoleScreenBufferInfo : 'a -> 'b = "OPAMW_GetConsoleScreenBufferInfo" -external setConsoleTextAttribute : 'a -> int -> unit = "OPAMW_SetConsoleTextAttribute" -external fillConsoleOutputCharacter : 'a -> char -> int -> int * int -> bool = "OPAMW_FillConsoleOutputCharacter" -external getConsoleMode : 'a -> int = "OPAMW_GetConsoleMode" -external setConsoleMode : 'a -> int -> bool = "OPAMW_SetConsoleMode" -external getWindowsVersion : unit -> int * int * int * int = "OPAMW_GetWindowsVersion" -external getArchitecture : unit -> 'a = "OPAMW_GetArchitecture" -external waitpids : int list -> int -> int * Unix.process_status = "OPAMW_waitpids" -external readRegistry : 'a -> string -> string -> 'b -> 'c option = "OPAMW_ReadRegistry" -external enumRegistry : 'a -> string -> 'b -> (string * 'c) list = "OPAMW_RegEnumValue" -external writeRegistry : 'a -> string -> string -> 'b -> 'c -> unit = "OPAMW_WriteRegistry" -external getConsoleOutputCP : unit -> int = "OPAMW_GetConsoleOutputCP" -external getCurrentConsoleFontEx : 'a -> bool -> 'b = "OPAMW_GetCurrentConsoleFontEx" -external create_glyph_checker : string -> 'a * 'a = "OPAMW_CreateGlyphChecker" -external delete_glyph_checker : 'a * 'a -> unit = "OPAMW_DeleteGlyphChecker" -external has_glyph : 'a * 'a -> Uchar.t -> bool = "OPAMW_HasGlyph" -external getProcessArchitecture : int32 option -> 'a = "OPAMW_GetProcessArchitecture" -external process_putenv : int32 -> string -> string -> bool = "OPAMW_process_putenv" -external getPathToHome : unit -> string = "OPAMW_GetPathToHome" -external getPathToSystem : unit -> string = "OPAMW_GetPathToSystem" -external getPathToLocalAppData : unit -> string = "OPAMW_GetPathToLocalAppData" -external sendMessageTimeout : nativeint -> int -> int -> 'a -> 'b -> 'c -> int * 'd = "OPAMW_SendMessageTimeout_byte" "OPAMW_SendMessageTimeout" -external getProcessAncestry : unit -> (int32 * string) list = "OPAMW_GetProcessAncestry" -external getConsoleAlias : string -> string -> string = "OPAMW_GetConsoleAlias" -external getConsoleWindowClass : unit -> string option = "OPAMW_GetConsoleWindowClass" -external setErrorMode : int -> int = "OPAMW_SetErrorMode" -external getErrorMode : unit -> int = "OPAMW_GetErrorMode" -external setConsoleToUTF8 : unit -> unit = "OPAMW_SetConsoleToUTF8" -external getVersionInfo : string -> 'a option = "OPAMW_GetVersionInfo" -external get_initial_environment : unit -> string list = "OPAMW_CreateEnvironmentBlock" external win_create_process : string -> string -> string option -> Unix.file_descr -> Unix.file_descr -> Unix.file_descr -> int = "win_create_process" "win_create_process_native" diff --git a/src/core/opamStubs.ocaml5.ml b/src/core/opamStubs.ocaml5.ml index 74f6c9c8c13..c1b977b837b 100644 --- a/src/core/opamStubs.ocaml5.ml +++ b/src/core/opamStubs.ocaml5.ml @@ -8,9 +8,7 @@ (* *) (**************************************************************************) -include OpamStubsTypes include OpamWin32Stubs -let getpid () = Int32.to_int (getCurrentProcessID ()) external win_create_process : string -> string -> string option -> Unix.file_descr -> Unix.file_descr -> Unix.file_descr -> int diff --git a/src/core/opamWin32Stubs.win32.ml b/src/core/opamWin32Stubs.win32.ml new file mode 100644 index 00000000000..c9286dee923 --- /dev/null +++ b/src/core/opamWin32Stubs.win32.ml @@ -0,0 +1,49 @@ +(**************************************************************************) +(* *) +(* Copyright 2018 MetaStack Solutions Ltd. *) +(* *) +(* All rights reserved. This file is distributed under the terms of the *) +(* GNU Lesser General Public License version 2.1, with the special *) +(* exception on linking described in the file LICENSE. *) +(* *) +(**************************************************************************) + +include OpamStubsTypes + +external getCurrentProcessID : unit -> int32 = "OPAMW_GetCurrentProcessID" +let getpid () = Int32.to_int (getCurrentProcessID ()) +(* Polymorphic parameters below are used as placeholders for types in + * OpamStubsTypes - it's not worth the effort of propagating the types here, + * even if it does result in some ugly-looking primitives! + *) +external getStdHandle : 'a -> 'b = "OPAMW_GetStdHandle" +external getConsoleScreenBufferInfo : 'a -> 'b = "OPAMW_GetConsoleScreenBufferInfo" +external setConsoleTextAttribute : 'a -> int -> unit = "OPAMW_SetConsoleTextAttribute" +external fillConsoleOutputCharacter : 'a -> char -> int -> int * int -> bool = "OPAMW_FillConsoleOutputCharacter" +external getConsoleMode : 'a -> int = "OPAMW_GetConsoleMode" +external setConsoleMode : 'a -> int -> bool = "OPAMW_SetConsoleMode" +external getWindowsVersion : unit -> int * int * int * int = "OPAMW_GetWindowsVersion" +external getArchitecture : unit -> 'a = "OPAMW_GetArchitecture" +external waitpids : int list -> int -> int * Unix.process_status = "OPAMW_waitpids" +external readRegistry : 'a -> string -> string -> 'b -> 'c option = "OPAMW_ReadRegistry" +external enumRegistry : 'a -> string -> 'b -> (string * 'c) list = "OPAMW_RegEnumValue" +external writeRegistry : 'a -> string -> string -> 'b -> 'c -> unit = "OPAMW_WriteRegistry" +external getConsoleOutputCP : unit -> int = "OPAMW_GetConsoleOutputCP" +external getCurrentConsoleFontEx : 'a -> bool -> 'b = "OPAMW_GetCurrentConsoleFontEx" +external create_glyph_checker : string -> 'a * 'a = "OPAMW_CreateGlyphChecker" +external delete_glyph_checker : 'a * 'a -> unit = "OPAMW_DeleteGlyphChecker" +external has_glyph : 'a * 'a -> Uchar.t -> bool = "OPAMW_HasGlyph" +external getProcessArchitecture : int32 option -> 'a = "OPAMW_GetProcessArchitecture" +external process_putenv : int32 -> string -> string -> bool = "OPAMW_process_putenv" +external getPathToHome : unit -> string = "OPAMW_GetPathToHome" +external getPathToSystem : unit -> string = "OPAMW_GetPathToSystem" +external getPathToLocalAppData : unit -> string = "OPAMW_GetPathToLocalAppData" +external sendMessageTimeout : nativeint -> int -> int -> 'a -> 'b -> 'c -> int * 'd = "OPAMW_SendMessageTimeout_byte" "OPAMW_SendMessageTimeout" +external getProcessAncestry : unit -> (int32 * string) list = "OPAMW_GetProcessAncestry" +external getConsoleAlias : string -> string -> string = "OPAMW_GetConsoleAlias" +external getConsoleWindowClass : unit -> string option = "OPAMW_GetConsoleWindowClass" +external setErrorMode : int -> int = "OPAMW_SetErrorMode" +external getErrorMode : unit -> int = "OPAMW_GetErrorMode" +external setConsoleToUTF8 : unit -> unit = "OPAMW_SetConsoleToUTF8" +external getVersionInfo : string -> 'a option = "OPAMW_GetVersionInfo" +external get_initial_environment : unit -> string list = "OPAMW_CreateEnvironmentBlock" From 3a84ce689194128e32c6cacd1cbe079e19b21fe6 Mon Sep 17 00:00:00 2001 From: Kate Date: Wed, 25 Sep 2024 19:27:30 +0100 Subject: [PATCH 2/5] GHA: Add OCaml 5.2.0 to the build matrix and add the mechanism to test more than one default version --- .github/workflows/ci.ml | 18 +++++++++++------- .github/workflows/main.yml | 2 +- master_changes.md | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index e628ac7999e..a96498efc40 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -15,7 +15,11 @@ open Lib let ocamls = [ (* Fully supported versions *) - "4.08.1"; "4.09.1"; "4.10.2"; "4.11.2"; "4.12.1"; "4.13.1"; "5.0.0"; "5.1.1"; "4.14.1"; + "4.08.1"; "4.09.1"; "4.10.2"; "4.11.2"; "4.12.1"; "4.13.1"; + "5.0.0"; "5.1.1"; "5.2.0"; + + (* The last elements of the list after 4.14 will be used as default versions *) + "4.14.1"; ] (* Entry point for the workflow. Workflows are specified as continuations where @@ -65,7 +69,7 @@ let end_workflow ~oc:_ ~workflow:_ = () let ocamls = List.map (fun v -> Scanf.sscanf v "%u.%u.%u" (fun major minor _ -> ((major, minor), v))) ocamls -let latest_ocaml = List.fold_left (fun _ (v, _) -> v) (0, 0) ocamls +let start_latests_ocaml = (4, 14) let platform_ocaml_matrix ?(dir=List.drop_while) ~fail_fast start_version = (fail_fast, @@ -351,7 +355,7 @@ let main_test_job ~analyse_job ~build_linux_job ~build_windows_job:_ ~build_macO | MacOS -> [analyse_job] (* This isn't gated on build_macOS_job for speed *) | Linux -> [analyse_job; build_linux_job] in - let matrix = platform_ocaml_matrix ~fail_fast:false latest_ocaml in + let matrix = platform_ocaml_matrix ~fail_fast:false start_latests_ocaml in let host = host_of_platform platform in let ocamlv = "${{ matrix.ocamlv }}" in job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~env:[("OPAM_TEST", "1")] ~matrix ~needs ("Test-" ^ name_of_platform platform) @@ -391,7 +395,7 @@ let solvers_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_jo let only_on target = only_on platform target in let needs = [analyse_job; (match platform with Linux -> build_linux_job | Windows -> build_windows_job | MacOS -> build_macOS_job)] in let env = [("SOLVER", "${{ matrix.solver }}"); ("OPAMBSROOT", "~/.cache/opam.${{ matrix.solver }}.cached")] in - let (fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:false latest_ocaml in + let (fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:false start_latests_ocaml in let matrix = (fail_fast, ("solver", ["z3"; "0install"])::matrix, []) in @@ -413,7 +417,7 @@ let upgrade_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_jo let host = host_of_platform platform in let only_on target = only_on platform target in let needs = [analyse_job; (match platform with Linux -> build_linux_job | Windows -> build_windows_job | MacOS -> build_macOS_job)] in - let matrix = platform_ocaml_matrix ~fail_fast:false latest_ocaml in + let matrix = platform_ocaml_matrix ~fail_fast:false start_latests_ocaml in let ocamlv = "${{ matrix.ocamlv }}" in job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~needs ~matrix ("Upgrade-" ^ name_of_platform platform) ++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"]) @@ -490,8 +494,8 @@ let main oc : unit = ++ analyse_job ~keys ~platforms:[Linux] @@ fun analyse_job -> cygwin_job ~analyse_job @@ fun cygwin_job -> main_build_job ~analyse_job ~cygwin_job ~section:"Build" Linux (4, 08) - @@ fun build_linux_job -> main_build_job ~analyse_job ~cygwin_job Windows latest_ocaml - @@ fun build_windows_job -> main_build_job ~analyse_job ~cygwin_job MacOS latest_ocaml + @@ fun build_linux_job -> main_build_job ~analyse_job ~cygwin_job Windows start_latests_ocaml + @@ fun build_windows_job -> main_build_job ~analyse_job ~cygwin_job MacOS start_latests_ocaml @@ fun build_macOS_job -> main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam tests" Linux @@ fun _ -> main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS @@ fun _ -> cold_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam cold" Linux diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 87567fa4a5e..33054dcc02c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: needs: Analyse strategy: matrix: - ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 4.14.1 ] + ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 5.2.0, 4.14.1 ] fail-fast: true steps: - name: Install bubblewrap diff --git a/master_changes.md b/master_changes.md index f67d3879d14..de6033579ac 100644 --- a/master_changes.md +++ b/master_changes.md @@ -118,6 +118,8 @@ users) ### Engine ## Github Actions + * Add OCaml 5.2.0 to the build matrix [#6216 @kit-ty-kate] + * Allow to have more than one OCaml default version to run on all jobs [#6216 @kit-ty-kate] ## Doc * Update the command to install opam to point to the new simplified url on opam.ocaml.org [#6226 @kit-ty-kate] From ab95514045b8e9856eba0c67534ad9297ca342f2 Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 1 Oct 2024 21:04:58 +0100 Subject: [PATCH 3/5] GHA: Bump 4.14 to the latest patch version (4.14.2) --- .github/workflows/ci.ml | 2 +- .github/workflows/main.yml | 18 +++++++++--------- master_changes.md | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index a96498efc40..77ffd687992 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -19,7 +19,7 @@ let ocamls = [ "5.0.0"; "5.1.1"; "5.2.0"; (* The last elements of the list after 4.14 will be used as default versions *) - "4.14.1"; + "4.14.2"; ] (* Entry point for the workflow. Workflows are specified as continuations where diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 33054dcc02c..10df4d143b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: needs: Analyse strategy: matrix: - ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 5.2.0, 4.14.1 ] + ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 5.2.0, 4.14.2 ] fail-fast: true steps: - name: Install bubblewrap @@ -143,7 +143,7 @@ jobs: matrix: host: [ x86_64-pc-cygwin, i686-w64-mingw32, x86_64-w64-mingw32, i686-pc-windows, x86_64-pc-windows ] build: [ x86_64-pc-cygwin ] - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: false defaults: run: @@ -226,7 +226,7 @@ jobs: needs: Analyse strategy: matrix: - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: true steps: - name: Checkout tree @@ -262,7 +262,7 @@ jobs: needs: [ Analyse, Build-Linux ] strategy: matrix: - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: false env: OPAM_TEST: 1 @@ -316,7 +316,7 @@ jobs: needs: Analyse strategy: matrix: - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: false env: OPAM_TEST: 1 @@ -403,7 +403,7 @@ jobs: strategy: matrix: solver: [ z3, 0install ] - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: false env: SOLVER: ${{ matrix.solver }} @@ -451,7 +451,7 @@ jobs: strategy: matrix: solver: [ z3, 0install ] - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: false env: SOLVER: ${{ matrix.solver }} @@ -499,7 +499,7 @@ jobs: needs: [ Analyse, Build-Linux ] strategy: matrix: - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: false steps: - name: Install bubblewrap @@ -532,7 +532,7 @@ jobs: needs: [ Analyse, Build-macOS ] strategy: matrix: - ocamlv: [ 4.14.1 ] + ocamlv: [ 4.14.2 ] fail-fast: false steps: - name: Checkout tree diff --git a/master_changes.md b/master_changes.md index de6033579ac..d5ae2a3584a 100644 --- a/master_changes.md +++ b/master_changes.md @@ -120,6 +120,7 @@ users) ## Github Actions * Add OCaml 5.2.0 to the build matrix [#6216 @kit-ty-kate] * Allow to have more than one OCaml default version to run on all jobs [#6216 @kit-ty-kate] + * Bump 4.14 to the latest patch version (4.14.2) [#6216 @kit-ty-kate] ## Doc * Update the command to install opam to point to the new simplified url on opam.ocaml.org [#6226 @kit-ty-kate] From 62b7c8610c70e82183553e4fc5b0b4f073c13da2 Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 1 Oct 2024 21:05:59 +0100 Subject: [PATCH 4/5] GHA: Add OCaml 5.2.0 as one of the default tested compiler Windows is an exception since MSVC isn't supported yet (will be in 5.3.0), and Cygwin fails when used in combination with C++ stubs. So only MinGW x86_64 is tested because it's the only one that both works and is reasonably fast to run (i686 is too slow since it's using bytecode). --- .github/workflows/ci.ml | 36 ++++++++++++++++++++++++++++-------- .github/workflows/main.yml | 38 +++++++++++++++++++++++++++----------- master_changes.md | 2 +- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index 77ffd687992..9329f08f32d 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -13,14 +13,17 @@ open Lib +let latest_ocaml4 = "4.14.2" +let latest_ocaml5 = "5.2.0" (* Add this number to ocamls below when the next version comes out *) let ocamls = [ (* Fully supported versions *) "4.08.1"; "4.09.1"; "4.10.2"; "4.11.2"; "4.12.1"; "4.13.1"; - "5.0.0"; "5.1.1"; "5.2.0"; + "5.0.0"; "5.1.1"; (* The last elements of the list after 4.14 will be used as default versions *) - "4.14.2"; + latest_ocaml4; latest_ocaml5; ] +let start_latests_ocaml = (4, 14) (* Entry point for the workflow. Workflows are specified as continuations where each job is passed as a continuation to the [workflow], terminated with @@ -69,8 +72,6 @@ let end_workflow ~oc:_ ~workflow:_ = () let ocamls = List.map (fun v -> Scanf.sscanf v "%u.%u.%u" (fun major minor _ -> ((major, minor), v))) ocamls -let start_latests_ocaml = (4, 14) - let platform_ocaml_matrix ?(dir=List.drop_while) ~fail_fast start_version = (fail_fast, [("ocamlv", List.map snd (dir (fun ocaml -> fst ocaml <> start_version) ocamls))], @@ -300,13 +301,32 @@ let main_build_job ~analyse_job ~cygwin_job ?section runner start_version ~oc ~w (* Intentionally fail fast, no need to run all build if there is a * problem in a given version; usually it is functions not defined in lower * versions of OCaml. *) - let (_fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:true start_version in let (matrix, includes) = if platform = Windows then - (("host", ["x86_64-pc-cygwin"; "i686-w64-mingw32"; "x86_64-w64-mingw32"; "i686-pc-windows"; "x86_64-pc-windows"]) :: - ("build", ["x86_64-pc-cygwin"]) :: - matrix, []) + let matrix = + let ocaml4 = [ + "x86_64-pc-cygwin"; + "i686-w64-mingw32"; + "x86_64-w64-mingw32"; + "i686-pc-windows"; + "x86_64-pc-windows" + ] in + let ocaml5 = [ + "x86_64-w64-mingw32"; + (* "x86_64-pc-windows"; 5.3 needed *) + ] in + let matrix_elem ocamlv hosts = + let elem ocaml host = + [("host", host); ("build", "x86_64-pc-cygwin"); ("ocamlv", ocaml)] + in + List.map (elem ocamlv) hosts + in + matrix_elem latest_ocaml4 ocaml4 + @ matrix_elem latest_ocaml5 ocaml5 + in + ([], matrix) else + let (_fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:true start_version in (matrix, []) in let matrix = ((platform <> Windows), matrix, includes) in let needs = if platform = Windows then [analyse_job; cygwin_job] else [analyse_job] in diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10df4d143b6..b9c935012de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: needs: Analyse strategy: matrix: - ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 5.2.0, 4.14.2 ] + ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 4.14.2, 5.2.0 ] fail-fast: true steps: - name: Install bubblewrap @@ -141,9 +141,25 @@ jobs: needs: [ Analyse, Cygwin ] strategy: matrix: - host: [ x86_64-pc-cygwin, i686-w64-mingw32, x86_64-w64-mingw32, i686-pc-windows, x86_64-pc-windows ] - build: [ x86_64-pc-cygwin ] - ocamlv: [ 4.14.2 ] + include: + - host: x86_64-pc-cygwin + build: x86_64-pc-cygwin + ocamlv: 4.14.2 + - host: i686-w64-mingw32 + build: x86_64-pc-cygwin + ocamlv: 4.14.2 + - host: x86_64-w64-mingw32 + build: x86_64-pc-cygwin + ocamlv: 4.14.2 + - host: i686-pc-windows + build: x86_64-pc-cygwin + ocamlv: 4.14.2 + - host: x86_64-pc-windows + build: x86_64-pc-cygwin + ocamlv: 4.14.2 + - host: x86_64-w64-mingw32 + build: x86_64-pc-cygwin + ocamlv: 5.2.0 fail-fast: false defaults: run: @@ -226,7 +242,7 @@ jobs: needs: Analyse strategy: matrix: - ocamlv: [ 4.14.2 ] + ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: true steps: - name: Checkout tree @@ -262,7 +278,7 @@ jobs: needs: [ Analyse, Build-Linux ] strategy: matrix: - ocamlv: [ 4.14.2 ] + ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: false env: OPAM_TEST: 1 @@ -316,7 +332,7 @@ jobs: needs: Analyse strategy: matrix: - ocamlv: [ 4.14.2 ] + ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: false env: OPAM_TEST: 1 @@ -403,7 +419,7 @@ jobs: strategy: matrix: solver: [ z3, 0install ] - ocamlv: [ 4.14.2 ] + ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: false env: SOLVER: ${{ matrix.solver }} @@ -451,7 +467,7 @@ jobs: strategy: matrix: solver: [ z3, 0install ] - ocamlv: [ 4.14.2 ] + ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: false env: SOLVER: ${{ matrix.solver }} @@ -499,7 +515,7 @@ jobs: needs: [ Analyse, Build-Linux ] strategy: matrix: - ocamlv: [ 4.14.2 ] + ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: false steps: - name: Install bubblewrap @@ -532,7 +548,7 @@ jobs: needs: [ Analyse, Build-macOS ] strategy: matrix: - ocamlv: [ 4.14.2 ] + ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: false steps: - name: Checkout tree diff --git a/master_changes.md b/master_changes.md index d5ae2a3584a..58fffdc40cb 100644 --- a/master_changes.md +++ b/master_changes.md @@ -119,7 +119,7 @@ users) ## Github Actions * Add OCaml 5.2.0 to the build matrix [#6216 @kit-ty-kate] - * Allow to have more than one OCaml default version to run on all jobs [#6216 @kit-ty-kate] + * Allow to have more than one OCaml default version to run all jobs and add 5.2 to the list of default versions together with 4.14 [#6216 @kit-ty-kate] * Bump 4.14 to the latest patch version (4.14.2) [#6216 @kit-ty-kate] ## Doc From af04f8b815768e5735bcb233a88e5022b498d06f Mon Sep 17 00:00:00 2001 From: Kate Date: Thu, 3 Oct 2024 13:27:19 +0100 Subject: [PATCH 5/5] GHA: remove the opam master cache to allow adding new platforms not supported by master This marginally increases build time (by 30s best case scenario) but is a necessary fix --- .github/scripts/main/create-ocaml-cache.sh | 42 ---------------------- .github/scripts/main/main.sh | 4 --- .github/scripts/main/ocaml-cache.sh | 12 ++++--- .github/workflows/ci.ml | 2 +- .github/workflows/main.yml | 4 +-- 5 files changed, 10 insertions(+), 54 deletions(-) delete mode 100755 .github/scripts/main/create-ocaml-cache.sh diff --git a/.github/scripts/main/create-ocaml-cache.sh b/.github/scripts/main/create-ocaml-cache.sh deleted file mode 100755 index 25b9bcdca94..00000000000 --- a/.github/scripts/main/create-ocaml-cache.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -set -xue - -OCAML_BRANCH="$1" -PREFIX="$2" -EXE="$3" -OCAML_LOCAL="$4" -PLATFORM="$5" - -if [[ $OCAML_BRANCH -gt 407 ]]; then - make -C src_ext dune-local.stamp - cd src_ext/dune-local - ocaml boot/bootstrap.ml - cp _boot/dune.exe "$PREFIX/bin/dune$EXE" - cd ../.. - - git clean -dfX - - if [[ -n $GITHUB_BASE_REF ]]; then - git tag combak - git fetch origin $GITHUB_BASE_REF - git checkout origin/$GITHUB_BASE_REF - fi - - ./configure --with-vendored-deps - make - cp -a _build "$OCAML_LOCAL/" - rm -f "$OCAML_LOCAL/_build/log" - mv "$OCAML_LOCAL/_build/default/src_ext" "$OCAML_LOCAL/_build/" - rm -rf "$OCAML_LOCAL/_build/default"/* "$OCAML_LOCAL/_build/install" - mv "$OCAML_LOCAL/_build/src_ext" "$OCAML_LOCAL/_build/default/" - git clean -dfX - if [[ -n $GITHUB_BASE_REF ]]; then - git checkout combak - fi -fi - -# The Windows BSD tar can't cope with symlinks, so we pre-tar the archive and cache that! -if [[ $PLATFORM = 'Windows' ]]; then - tar -C "$OCAML_LOCAL" -pcf "$OCAML_LOCAL.tar" . -fi diff --git a/.github/scripts/main/main.sh b/.github/scripts/main/main.sh index bebd00bd96c..dcc5ccb8bda 100644 --- a/.github/scripts/main/main.sh +++ b/.github/scripts/main/main.sh @@ -28,10 +28,6 @@ case "$1" in CONFIGURE_PREFIX="$PREFIX";; esac -if [ -e "$OCAML_LOCAL/_build" ]; then - cp -a "$OCAML_LOCAL/_build" . -fi - ./configure --prefix $CONFIGURE_PREFIX --with-vendored-deps --with-mccs if [ "$OPAM_TEST" != "1" ]; then echo 'DUNE_PROFILE=dev' >> Makefile.config diff --git a/.github/scripts/main/ocaml-cache.sh b/.github/scripts/main/ocaml-cache.sh index c9f578dc2cc..ac94f664775 100644 --- a/.github/scripts/main/ocaml-cache.sh +++ b/.github/scripts/main/ocaml-cache.sh @@ -146,8 +146,10 @@ EOF chmod +x "$OCAML_LOCAL/bin/ocamldoc" fi -# Hand-over control to a separate script in case the branch being tested -# updates this script, which will fail on Windows (since the script is "open" -# and can't be overwritten) -cp -pf .github/scripts/main/create-ocaml-cache.sh ../create-ocaml-cache.sh -exec ../create-ocaml-cache.sh "$OCAML_BRANCH" "$PREFIX" "$EXE" "$OCAML_LOCAL" "$PLATFORM" +make -C src_ext dune-local.stamp +cd src_ext/dune-local +ocaml boot/bootstrap.ml +cp _boot/dune.exe "$PREFIX/bin/dune$EXE" +cd ../.. + +git clean -dfX diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index 9329f08f32d..73b0f1dd973 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -506,7 +506,7 @@ let main oc : unit = ] in let keys = [ ("archives", "archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }}"); - ("ocaml-cache", "${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.sh') }}"); + ("ocaml-cache", "${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }}"); ("cygwin", "${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }}"); ("opam-bs-cache", "${{ hashFiles('.github/scripts/main/opam-bs-cache.sh', '*.opam', '.github/scripts/main/preamble.sh') }}"); ] in diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b9c935012de..33e3b3d8ce4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,8 +58,8 @@ jobs: run: | echo archives=archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }} echo archives=archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }} >> $GITHUB_OUTPUT - echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.sh') }} - echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.sh') }} >> $GITHUB_OUTPUT + echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} + echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} >> $GITHUB_OUTPUT echo cygwin=${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }} echo cygwin=${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }} >> $GITHUB_OUTPUT echo opam-bs-cache=${{ hashFiles('.github/scripts/main/opam-bs-cache.sh', '*.opam', '.github/scripts/main/preamble.sh') }}