Skip to content

Commit

Permalink
GHA: Add OCaml 5.2.0 as one of the default tested compiler
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
kit-ty-kate committed Oct 8, 2024
1 parent ab95514 commit 62b7c86
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 20 deletions.
36 changes: 28 additions & 8 deletions .github/workflows/ci.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))],
Expand Down Expand Up @@ -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
Expand Down
38 changes: 27 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62b7c86

Please sign in to comment.