Skip to content

Commit

Permalink
Add dkml_target_abi to matrix
Browse files Browse the repository at this point in the history
Also adds DKML_TARGET_ABI to DKML_COMPILE_TYPE=VS compile spec.
  • Loading branch information
jonahbeckford committed Oct 7, 2024
1 parent 4723fe7 commit b6e6905
Show file tree
Hide file tree
Showing 33 changed files with 137 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ jobs:
- gh_os: windows-2019
abi_pattern: win32-windows_x86
dkml_host_abi: windows_x86
dkml_target_abi: windows_x86
- gh_os: windows-2019
abi_pattern: win32-windows_x86_64
dkml_host_abi: windows_x86_64
dkml_target_abi: windows_x86_64
- gh_os: ubuntu-latest
abi_pattern: manylinux2014-linux_x86
dkml_host_abi: linux_x86
dkml_target_abi: linux_x86
- gh_os: ubuntu-latest
abi_pattern: manylinux2014-linux_x86_64
dkml_host_abi: linux_x86_64
dkml_target_abi: linux_x86_64
- gh_os: macos-latest # Intel
abi_pattern: macos-darwin_all-intel
dkml_host_abi: darwin_x86_64
dkml_target_abi: darwin_x86_64
# macos-13-xlarge is NOT FREE even for Public projects as of 2023-11-25.
# - gh_os: macos-13-xlarge # Apple Silicon. https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/
# abi_pattern: macos-darwin_all-silicon
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/test-pc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:
setup-windows:
strategy:
fail-fast: true
matrix:
dkml_host_abi:
- windows_x86
- windows_x86_64
matrix:
include:
- dkml_host_abi: windows_x86
dkml_target_abi: windows_x86
- dkml_host_abi: windows_x86_64
dkml_target_abi: windows_x86_64
runs-on: windows-2019
name: build / ${{ matrix.dkml_host_abi }}

Expand All @@ -33,8 +35,9 @@ jobs:
strategy:
fail-fast: true
matrix:
dkml_host_abi:
- linux_x86_64
include:
- dkml_host_abi: linux_x86_64
dkml_target_abi: linux_x86_64
runs-on: ubuntu-latest
name: build / ${{ matrix.dkml_host_abi }}

Expand All @@ -51,6 +54,7 @@ jobs:
matrix:
include:
- dkml_host_abi: darwin_x86_64
dkml_target_abi: darwin_x86_64
runs-on: macos-latest
# macos-13-xlarge is NOT FREE even for Public projects as of 2023-11-25.
# - dkml_host_abi: darwin_arm64
Expand Down
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ test-pc-windows:
parallel:
matrix:
- dkml_host_abi: windows_x86
dkml_target_abi: windows_x86
- dkml_host_abi: windows_x86_64

dkml_target_abi: windows_x86_64
tags:
- saas-windows-medium-amd64

Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- If `docker_image` is set, then the tag will be `${docker_registry/}dkml-workflows/docker:latest` and the image id will be saved at `.ci/sd4/docker-image-id`.
The default `docker_runner`, which you can change, is `docker run --rm --workdir /work`.
A `-v "$(pwd):/work"` will be the first argument for `docker_runner`, the image id will be the second argument, and the command line (which assumes `/work` is mounted) will be the remainder of the arguments.
- Add `dkml_target_abi` to the test matrix

## 2.1.3

Expand Down
1 change: 1 addition & 0 deletions src/logic/caching.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ let cachekey_opambin ~read_script ~input:_ ~matrix =
md5 of it so we implicitly have a dependency on DEFAULT_DISKUV_OPAM_REPOSITORY_TAG *)
Digest.string script |> Digest.to_hex |> String.with_range ~len:6;
matrix "dkml_host_abi";
matrix "dkml_target_abi";
matrix "opam_abi";
]

Expand Down
36 changes: 29 additions & 7 deletions src/logic/model.ml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ let matrix =
("exe_ext", Jg_types.Tstr {|.exe|});
("opam_abi", Jg_types.Tstr {|windows_x86|});
("dkml_host_abi", Jg_types.Tstr {|windows_x86|});
("dkml_target_abi", Jg_types.Tstr {|windows_x86|});
("gh_opam_root", Jg_types.Tstr {|D:/.opam|});
("gl_opam_root", Jg_types.Tstr {|C:/o|});
("gl_opam_root_cacheable", Jg_types.Tstr {|${CI_PROJECT_DIR}/.ci/o|});
Expand All @@ -284,6 +285,7 @@ let matrix =
("exe_ext", Jg_types.Tstr {|.exe|});
("opam_abi", Jg_types.Tstr {|windows_x86_64|});
("dkml_host_abi", Jg_types.Tstr {|windows_x86_64|});
("dkml_target_abi", Jg_types.Tstr {|windows_x86_64|});
("gh_opam_root", Jg_types.Tstr {|D:/.opam|});
("gl_opam_root", Jg_types.Tstr {|C:/o|});
("gl_opam_root_cacheable", Jg_types.Tstr {|${CI_PROJECT_DIR}/.ci/o|});
Expand Down Expand Up @@ -334,6 +336,7 @@ let matrix =
(* macos-13-xlarge is Apple Silicon. BUT NOT FREE: https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/ *)
("gh_unix_shell", Jg_types.Tstr {|sh|});
("dkml_host_abi", Jg_types.Tstr {|darwin_x86_64|});
("dkml_target_abi", Jg_types.Tstr {|darwin_x86_64|});
("gh_opam_root", Jg_types.Tstr {|/Users/runner/.opam|});
("pc_opam_root", Jg_types.Tstr {|${PC_PROJECT_DIR}/.ci/o|});
];
Expand All @@ -344,6 +347,7 @@ let matrix =
("gl_image", Jg_types.Tstr "macos-13-xcode-14");
("gh_unix_shell", Jg_types.Tstr {|sh|});
("dkml_host_abi", Jg_types.Tstr {|darwin_arm64|});
("dkml_target_abi", Jg_types.Tstr {|darwin_arm64|});
("gl_opam_root", Jg_types.Tstr {|${CI_PROJECT_DIR}/.ci/o|});
("pc_opam_root", Jg_types.Tstr {|${PC_PROJECT_DIR}/.ci/o|});
]
Expand Down Expand Up @@ -393,6 +397,7 @@ let matrix =
("gh_os", Jg_types.Tstr "ubuntu-latest");
("gh_unix_shell", Jg_types.Tstr {|sh|});
("dkml_host_abi", Jg_types.Tstr {|linux_x86|});
("dkml_target_abi", Jg_types.Tstr {|linux_x86|});
("gh_opam_root", Jg_types.Tstr {|.ci/o|});
("gl_opam_root", Jg_types.Tstr {|.ci/o|});
("pc_opam_root", Jg_types.Tstr {|.ci/o|});
Expand All @@ -416,6 +421,7 @@ let matrix =
("gh_os", Jg_types.Tstr "ubuntu-latest");
("gh_unix_shell", Jg_types.Tstr {|sh|});
("dkml_host_abi", Jg_types.Tstr {|linux_x86_64|});
("dkml_target_abi", Jg_types.Tstr {|linux_x86_64|});
("gh_opam_root", Jg_types.Tstr {|.ci/o|});
("gl_opam_root", Jg_types.Tstr {|.ci/o|});
("pc_opam_root", Jg_types.Tstr {|.ci/o|});
Expand All @@ -431,6 +437,7 @@ module Aggregate = struct
type t = {
mutable dkml_host_os_opt : Jg_types.tvalue option;
mutable dkml_host_abi_opt : string option;
mutable dkml_target_abi_opt : string option;
mutable opam_root_opt : string option;
mutable opam_root_cacheable_opt : string option;
mutable supports_gh : bool;
Expand All @@ -441,6 +448,7 @@ module Aggregate = struct
{
dkml_host_os_opt = None;
dkml_host_abi_opt = None;
dkml_target_abi_opt = None;
opam_root_opt = None;
opam_root_cacheable_opt = None;
supports_gh = true;
Expand All @@ -457,6 +465,7 @@ module Aggregate = struct
(* Capture scalar values *)
(match name with
| "dkml_host_abi" -> t.dkml_host_abi_opt <- value_as_string
| "dkml_target_abi" -> t.dkml_target_abi_opt <- value_as_string
| "opam_root" -> t.opam_root_opt <- value_as_string
| "opam_root_cacheable" -> t.opam_root_cacheable_opt <- value_as_string
| "no_gh" -> t.supports_gh <- false
Expand All @@ -469,6 +478,7 @@ module Aggregate = struct
| _ -> ()

let dkml_host_abi_opt t = t.dkml_host_abi_opt
let dkml_target_abi_opt t = t.dkml_target_abi_opt
let opam_root_opt t = t.opam_root_opt
let opam_root_cacheable_opt t = t.opam_root_cacheable_opt
let supports_gl t = t.supports_gl
Expand All @@ -478,11 +488,13 @@ module Aggregate = struct
match
( t.dkml_host_os_opt,
t.dkml_host_abi_opt,
t.dkml_target_abi_opt,
t.opam_root_opt,
t.opam_root_cacheable_opt )
with
| ( Some dkml_host_os,
Some dkml_host_abi,
Some dkml_target_abi,
Some opam_root,
opam_root_cacheable_opt ) ->
let opam_root_cacheable =
Expand All @@ -492,19 +504,23 @@ module Aggregate = struct
in
[
("dkml_host_abi", Jg_types.Tstr dkml_host_abi);
("dkml_target_abi", Jg_types.Tstr dkml_target_abi);
("dkml_host_os", dkml_host_os);
("opam_root", Jg_types.Tstr opam_root);
("opam_root_cacheable", Jg_types.Tstr opam_root_cacheable);
]
| Some _, None, Some _, _ ->
| Some _, None, _, Some _, _ ->
failwith "Expected dkml_host_abi would be found"
| Some _, Some _, None, _ -> failwith "Expected opam_root would be found"
| None, Some _, Some _, _ ->
| Some _, Some _, None, Some _, _ ->
failwith "Expected dkml_target_abi would be found"
| Some _, Some _, Some _, None, _ ->
failwith "Expected opam_root would be found"
| None, Some _, Some _, Some _, _ ->
failwith "Expected dkml_host_os would be derived"
| _ ->
failwith
"Expected dkml_host_abi and opam_root would be found and \
dkml_host_os would be derived"
"Expected dkml_host_abi, dkml_target_abi and opam_root would be \
found and dkml_host_os would be derived"
end

(**
Expand All @@ -521,13 +537,15 @@ end
{ name: "exe_ext", value: '.exe' },
{ name: "opam_abi", value: 'windows_x86' },
{ name: "dkml_host_abi", value: 'windows_x86' },
{ name: "dkml_target_abi", value: 'windows_x86' },
{ name: "opam_root", value: '${CI_PROJECT_DIR}/.ci/o' },
{ name: "vsstudio_hostarch", value: 'x64' },
{ name: "vsstudio_arch", value: 'x86' },
{ name: "ocaml_options", value: 'ocaml-option-32bit' },
...
],
dkml_host_abi: "windows_x86",
dkml_target_abi: "windows_x86",
dkml_host_os: "windows",
opam_root: "${CI_PROJECT_DIR}/.ci/o",
opam_root_cacheable: "${CI_PROJECT_DIR}/.ci/o",
Expand Down Expand Up @@ -585,6 +603,7 @@ let full_matrix_as_list ?must_support_gl ?must_support_gh ~allow_dkml_host_abi
exe_ext: '.exe',
opam_abi: 'windows_x86',
dkml_host_abi: 'windows_x86',
dkml_target_abi: 'windows_x86',
opam_root: '${CI_PROJECT_DIR}/.ci/o',
vsstudio_hostarch: 'x64',
vsstudio_arch: 'x86',
Expand All @@ -611,8 +630,10 @@ let vars_as_object ?must_support_gl ?must_support_gh ~allow_dkml_host_abi
(function
| Jg_types.Tobj
[
(* We are using brittle pattern matching ... the order must be the same as the original. *)
("vars", Jg_types.Tlist vars);
("dkml_host_abi", Jg_types.Tstr dkml_host_abi);
("dkml_target_abi", Jg_types.Tstr _dkml_target_abi);
("dkml_host_os", Jg_types.Tstr dkml_host_os);
("opam_root", Jg_types.Tstr _opam_root);
("opam_root_cacheable", Jg_types.Tstr opam_root_cacheable);
Expand All @@ -635,8 +656,9 @@ let vars_as_object ?must_support_gl ?must_support_gh ~allow_dkml_host_abi
| _ ->
failwith
"Expecting [('vars', Tlist varlist); ('dkml_host_abi', ...); \
('dkml_host_os', ...); ('opam_root', ...); \
('opam_root_cacheable', ...); ...] where vars is the first item")
('dkml_target_abi', ...); ('dkml_host_os', ...); ('opam_root', \
...); ('opam_root_cacheable', ...); ...] where vars is the \
first item")
matrix
in
let f_vars_to_obj = function
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/setup-dkml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ GIT_LOCATION=${GIT_LOCATION:-}
Matrix
------
dkml_host_abi=$dkml_host_abi
dkml_target_abi=$dkml_target_abi
abi_pattern=$abi_pattern
opam_root=${opam_root}
opam_root_cacheable=${opam_root_cacheable}
Expand Down Expand Up @@ -1180,6 +1181,7 @@ do_use_vsstudio() {
echo " [DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\"]" >>"$OPSC"
echo " [DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\"]" >>"$OPSC"
echo " [DKML_HOST_ABI = \"${dkml_host_abi}\"]" >>"$OPSC"
echo " [DKML_TARGET_ABI = \"${dkml_target_abi}\"]" >>"$OPSC"
echo ']' >>"$OPSC"
cat "$OPSC" # print
;;
Expand All @@ -1193,6 +1195,7 @@ do_use_vsstudio() {
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_HOST_ABI = \"${dkml_host_abi}\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_TARGET_ABI = \"${dkml_target_abi}\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv # print
;;
esac
Expand Down
3 changes: 0 additions & 3 deletions src/scripts/teardown-dkml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ VERBOSE=${VERBOSE:-}
------
Matrix
------
dkml_host_abi=$dkml_host_abi
opam_root=${opam_root}
opam_root_cacheable=${opam_root_cacheable}
original_opam_root=${original_opam_root}
original_opam_root_cacheable=${original_opam_root_cacheable}
unix_opam_root=${unix_opam_root}
unix_opam_root_cacheable=${unix_opam_root_cacheable}
.
Expand Down
2 changes: 2 additions & 0 deletions test/gh-darwin/post/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ runs:
gh_os='macos-latest'
gh_unix_shell='sh'
dkml_host_abi='darwin_x86_64'
dkml_target_abi='darwin_x86_64'
opam_root='/Users/runner/.opam'
#
# note: All Darwin machines can cross-compile so they are equal except [dkml_host_abi].
Expand All @@ -36,6 +37,7 @@ runs:
}
add dkml_host_abi "$dkml_host_abi"
add dkml_target_abi "$dkml_target_abi"
add abi_pattern "$abi_pattern"
add opam_root "$opam_root"
add opam_root_cacheable "$opam_root_cacheable"
Expand Down
10 changes: 6 additions & 4 deletions test/gh-darwin/pre/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ runs:
gh_os='macos-latest'
gh_unix_shell='sh'
dkml_host_abi='darwin_x86_64'
dkml_target_abi='darwin_x86_64'
opam_root='/Users/runner/.opam'
#
# note: All Darwin machines can cross-compile so they are equal except [dkml_host_abi].
Expand All @@ -77,6 +78,7 @@ runs:
}
add dkml_host_abi "$dkml_host_abi"
add dkml_target_abi "$dkml_target_abi"
add abi_pattern "$abi_pattern"
add opam_root "$opam_root"
add opam_root_cacheable "$opam_root_cacheable"
Expand Down Expand Up @@ -506,6 +508,7 @@ runs:
Matrix
------
dkml_host_abi=$dkml_host_abi
dkml_target_abi=$dkml_target_abi
abi_pattern=$abi_pattern
opam_root=${opam_root}
opam_root_cacheable=${opam_root_cacheable}
Expand Down Expand Up @@ -1539,6 +1542,7 @@ runs:
echo " [DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\"]" >>"$OPSC"
echo " [DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\"]" >>"$OPSC"
echo " [DKML_HOST_ABI = \"${dkml_host_abi}\"]" >>"$OPSC"
echo " [DKML_TARGET_ABI = \"${dkml_target_abi}\"]" >>"$OPSC"
echo ']' >>"$OPSC"
cat "$OPSC" # print
;;
Expand All @@ -1552,6 +1556,7 @@ runs:
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_HOST_ABI = \"${dkml_host_abi}\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_TARGET_ABI = \"${dkml_target_abi}\""
opamrun option --switch "$do_use_vsstudio_NAME" setenv # print
;;
esac
Expand Down Expand Up @@ -1708,11 +1713,8 @@ runs:
------
Matrix
------
dkml_host_abi=$dkml_host_abi
opam_root=${opam_root}
opam_root_cacheable=${opam_root_cacheable}
original_opam_root=${original_opam_root}
original_opam_root_cacheable=${original_opam_root_cacheable}
unix_opam_root=${unix_opam_root}
unix_opam_root_cacheable=${unix_opam_root_cacheable}
.
Expand Down Expand Up @@ -1805,7 +1807,7 @@ runs:
shell: bash
run: |
set -x
echo 'ba41bf-${{ steps.full_matrix_vars.outputs.dkml_host_abi }}-${{ steps.full_matrix_vars.outputs.opam_abi }}' > .ci/sd4/cachekey.opam.binaries
echo '72fb2c-${{ steps.full_matrix_vars.outputs.dkml_host_abi }}-${{ steps.full_matrix_vars.outputs.dkml_target_abi }}-${{ steps.full_matrix_vars.outputs.opam_abi }}' > .ci/sd4/cachekey.opam.binaries
echo '${{ steps.full_matrix_vars.outputs.abi_pattern }}-${{ steps.full_matrix_vars.outputs.vsstudio_arch }}-${{ steps.full_matrix_vars.outputs.vsstudio_hostarch }}-${{ steps.full_matrix_vars.outputs.vsstudio_dir }}-${{ steps.full_matrix_vars.outputs.vsstudio_vcvarsver }}-${{ steps.full_matrix_vars.outputs.vsstudio_winsdkver }}-${{ steps.full_matrix_vars.outputs.vsstudio_msvspreference }}-${{ steps.full_matrix_vars.outputs.vsstudio_cmakegenerator }}' > .ci/sd4/cachekey.vsstudio
echo '${{ inputs.OCAML_COMPILER }}-${{ inputs.DISKUV_OPAM_REPOSITORY }}-${{ inputs.DKML_COMPILER }}-${{ inputs.CONF_DKML_CROSS_TOOLCHAIN }}' > .ci/sd4/cachekey.ci.inputs
Expand Down
3 changes: 3 additions & 0 deletions test/gh-linux/post/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ runs:
gh_os='ubuntu-latest';
gh_unix_shell='sh';
dkml_host_abi='linux_x86';
dkml_target_abi='linux_x86';
opam_root='.ci/o';
in_docker='true';
dockcross_image='dockcross/manylinux2014-x86';
Expand All @@ -39,6 +40,7 @@ runs:
gh_os='ubuntu-latest';
gh_unix_shell='sh';
dkml_host_abi='linux_x86_64';
dkml_target_abi='linux_x86_64';
opam_root='.ci/o';
dockcross_image='dockcross/manylinux2014-x64';
dockcross_run_extra_args='--platform linux/amd64';
Expand All @@ -52,6 +54,7 @@ runs:
}
add dkml_host_abi "$dkml_host_abi"
add dkml_target_abi "$dkml_target_abi"
add abi_pattern "$abi_pattern"
add opam_root "$opam_root"
add opam_root_cacheable "$opam_root_cacheable"
Expand Down
Loading

0 comments on commit b6e6905

Please sign in to comment.