Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another test #16

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ jobs:
os: [ubuntu, macos]
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install opam
with:
submodules: 'true'
- uses: facebook/install-dotslash@latest
- run: sudo apt-get install opam
if: matrix.os == 'ubuntu'
- run: brew install opam
if: matrix.os == 'macos'
- run: |-
opam init --compiler=5.1.1 --disable-sandboxing -y
opam install ocamlfind
opam init --color=always --compiler=5.1.1 --disable-sandboxing -y
opam install --color=always ocamlfind
opam env | sed -e "s/ export .*//g" -e "s/'//g" -e "s/\;//g" >> $GITHUB_ENV
- run: |-
mkdir -p third-party/ocaml
cd third-party/ocaml
ln -s "$OPAM_SWITCH_PREFIX" opam
- run: |-
(cd third-party/ocaml && ln -s "$OPAM_SWITCH_PREFIX" opam)
python3 dromedary.py -s "$(basename $OPAM_SWITCH_PREFIX)" -o third-party/ocaml/BUCK.test
cat third-party/ocaml/BUCK.test
- run: echo "PATH=$(pwd):$PATH" >> $GITHUB_ENV
- run: |-
buck2 run root//test:version
cat $(buck2 build root//test:config --show-full-simple-output)
24 changes: 22 additions & 2 deletions test/BUCK.test
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# Example commands to generate 'third-party/ocaml/BUCK.test'.
# ```
# mkdir -p third-party/ocaml
# python3 ~/project/ocaml-scripts/dromedary.py -s "$(basename $OPAM_SWITCH_PREFIX)" -o ~/project/ocaml-scripts/third-party/ocaml/BUCK.test
# ```

_SUPPORTED = not host_info().os.is_windows

# buildifier: disable=no-effect
cxx_binary(
name = "version",
srcs = ["version.c"],
deps = ["root//third-party/ocaml:ocaml-dev"],
) if _SUPPORTED else None

# buildifier: disable=no-effect
genrule(
name = "config",
out = "config.txt",
bash = '$(exe_target root//third-party/ocaml:ocamlopt-exe) -config > $OUT',
) if _SUPPORTED else None

# buildifier: disable=no-effect
ocaml_binary(
name = "test-unix",
srcs = ["test_unix.ml"],
name = "unix",
srcs = ["unix.ml"],
deps = ["root//third-party/ocaml:unix"],
) if _SUPPORTED else None
File renamed without changes.
13 changes: 13 additions & 0 deletions test/version.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <stdio.h>

#include <caml/version.h>

char const* ocaml_version() {
return OCAML_VERSION_STRING;
}

int main() {
printf("The OCaml toolchain, version %s\n", ocaml_version());

return 0;
}