File tree Expand file tree Collapse file tree 2 files changed +47
-14
lines changed
Expand file tree Collapse file tree 2 files changed +47
-14
lines changed Original file line number Diff line number Diff line change 2222
2323 - name : Build Claml
2424 run : |
25- ./build.sh
25+ ./build.sh --user-opam-switch
2626
27- - name : Run test (regression)
28- run : eval $(opam env) && make test
27+ - name : Run test
28+ run : eval -- exec make test
Original file line number Diff line number Diff line change @@ -7,19 +7,52 @@ export OPAMYES=1
77NCPU=" $( getconf _NPROCESSORS_ONLN 2> /dev/null || echo 1) "
88OCAML_VERSION=" 5.1.0"
99CLAML_OPAM_SWITCH=claml-" $OCAML_VERSION +flambda"
10- opam init --compiler=$OCAML_VERSION -j $NCPU --no-setup
1110
12- switch_exists=no
13- for installed_switch in $( opam switch list --short) ; do
14- if [[ " $installed_switch " == " $CLAML_OPAM_SWITCH " ]]; then
15- switch_exists=yes
16- break
17- fi
11+ USER_OPAM_SWITCH=no
12+
13+ function usage() {
14+ echo " Usage: $0 [options]"
15+ echo
16+ echo " options:"
17+ echo " -h,--help show this message"
18+ echo " --user-opam-switch use the current opam switch to install haechi (default: $OPAM_SWITCH )"
19+ echo
20+ echo " examples:"
21+ echo " $0 # build haechi with default options"
22+ echo " $0 --user-opam-switch # build haechi in the current opam switch (e.g., for Github CI)"
23+ }
24+
25+ while [[ $# -gt 0 ]]; do
26+ opt_key=" $1 "
27+ case $opt_key in
28+ --user-opam-switch)
29+ USER_OPAM_SWITCH=yes
30+ shift
31+ continue
32+ ;;
33+ esac
1834done
19- if [ " $switch_exists " = " no" ]; then
20- opam switch create $CLAML_OPAM_SWITCH $OCAML_VERSION
21- else
22- opam switch $CLAML_OPAM_SWITCH
35+
36+ function setup_opam() {
37+ opam init --compiler=$OCAML_VERSION -j $NCPU --no-setup
38+
39+ switch_exists=no
40+ for installed_switch in $( opam switch list --short) ; do
41+ if [[ " $installed_switch " == " $CLAML_OPAM_SWITCH " ]]; then
42+ switch_exists=yes
43+ break
44+ fi
45+ done
46+
47+ if [ " $switch_exists " = " no" ]; then
48+ opam switch create $CLAML_OPAM_SWITCH $OCAML_VERSION
49+ else
50+ opam switch $CLAML_OPAM_SWITCH
51+ fi
52+ }
53+
54+ if [ " $USER_OPAM_SWITCH " == " no" ]; then
55+ setup_opam
2356fi
2457
2558eval $( SHELL=bash opam config env --switch=$CLAML_OPAM_SWITCH )
You can’t perform that action at this time.
0 commit comments