Skip to content

Commit 3333edc

Browse files
committed
final
1 parent cce417f commit 3333edc

File tree

4 files changed

+140
-9
lines changed

4 files changed

+140
-9
lines changed

.github/scripts/common/hygiene-preamble.sh

-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
2222
r=$?
2323
done
2424
set -e
25-
git show $BASE_REF_SHA
26-
git show HEAD -q
27-
git log -3
28-
git show $PR_REF_SHA -q
29-
git diff $BASE_REF_SHA..$PR_REF_SHA --name-only
3025
fi
3126

3227
set +x

.github/scripts/main/main.sh

+110-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,65 @@
22

33
set -xue
44

5+
. .github/scripts/main/preamble.sh
6+
7+
unset-dev-version () {
8+
# disable git versioning to allow OPAMYES use for upgrade
9+
touch src/client/no-git-version
10+
}
11+
12+
export OCAMLRUNPARAM=b
13+
14+
(set +x ; echo -en "::group::build opam\r") 2>/dev/null
15+
if [[ $OPAM_TEST -eq 1 ]] || [[ $OPAM_DOC -eq 1 ]] ; then
16+
export OPAMROOT=$OPAMBSROOT
17+
# If the cached root is newer, regenerate a binary compatible root
18+
opam env || { rm -rf $OPAMBSROOT; init-bootstrap; }
19+
eval $(opam env)
20+
fi
21+
22+
case "$1" in
23+
*-pc-windows|*-w64-mingw32)
24+
CONFIGURE_PREFIX='D:\Local'
25+
PREFIX="$(cygpath "$CONFIGURE_PREFIX")";;
26+
*)
27+
PREFIX=~/local
28+
CONFIGURE_PREFIX="$PREFIX";;
29+
esac
30+
31+
if [ -e "$OCAML_LOCAL/_build" ]; then
32+
cp -a "$OCAML_LOCAL/_build" .
33+
fi
34+
35+
./configure --prefix $CONFIGURE_PREFIX --with-vendored-deps --with-mccs
36+
if [ "$OPAM_TEST" != "1" ]; then
37+
echo 'DUNE_PROFILE=dev' >> Makefile.config
38+
fi
39+
40+
if [ $OPAM_UPGRADE -eq 1 ]; then
41+
unset-dev-version
42+
fi
43+
# Disable implicit transitive deps
44+
sed -i -e '/(implicit_transitive_deps /s/true/false/' dune-project
45+
make all admin
46+
sed -i -e '/(implicit_transitive_deps /s/false/true/' dune-project
47+
48+
rm -f "$PREFIX/bin/opam"
49+
make install
50+
(set +x ; echo -en "::endgroup::build opam\r") 2>/dev/null
51+
52+
export PATH="$PREFIX/bin:$PATH"
53+
opam --version
554

655
if [ "$OPAM_DOC" = "1" ]; then
56+
rm -rf src_ext/
57+
make -C doc html man-html pages
758

859
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
960
. .github/scripts/common/hygiene-preamble.sh
10-
set -x
1161
set +e
1262
diff="git diff $BASE_REF_SHA..$PR_REF_SHA"
13-
$diff --name-only --diff-filter=A
14-
$diff --name-only --diff-filter=A | grep 'src/.*mli'
15-
files="`$diff --name-only --diff-filter=A | grep 'src/.*mli'`"
63+
files=`$diff --name-only --diff-filter=A | grep 'src/.*mli'`
1664
if [ -n "$files" ]; then
1765
echo '::group::new module added - checking it'
1866
if $diff --name-only --exit-code -- doc/index.html ; then
@@ -26,3 +74,61 @@ if [ "$OPAM_DOC" = "1" ]; then
2674
fi
2775
fi
2876
fi
77+
78+
if [ "$OPAM_TEST" = "1" ]; then
79+
# test if an upgrade is needed
80+
set +e
81+
opam list 2> /dev/null
82+
rcode=$?
83+
if [ $rcode -eq 10 ]; then
84+
echo "Recompiling for an opam root upgrade"
85+
(set +x ; echo -en "::group::rebuild opam\r") 2>/dev/null
86+
unset-dev-version
87+
make all admin
88+
rm -f "$PREFIX/bin/opam"
89+
make install
90+
opam list 2> /dev/null
91+
rcode=$?
92+
set -e
93+
if [ $rcode -ne 10 ]; then
94+
echo -e "\e[31mBad return code $rcode, should be 10\e[0m";
95+
exit $rcode
96+
fi
97+
(set +x ; echo -en "::endgroup::rebuild opam\r") 2>/dev/null
98+
fi
99+
set -e
100+
101+
# Note: these tests require a "system" compiler and will use the one in $OPAMBSROOT
102+
make tests
103+
104+
make distclean
105+
106+
# Compile and run opam-rt
107+
(set +x ; echo -en "::group::opam-rt\r") 2>/dev/null
108+
opamrt_url="https://github.com/ocaml-opam/opam-rt"
109+
if [ ! -d $CACHE/opam-rt ]; then
110+
git clone $opamrt_url $CACHE/opam-rt
111+
fi
112+
cd $CACHE/opam-rt
113+
git fetch origin
114+
if git ls-remote --exit-code origin $BRANCH ; then
115+
if git branch | grep -q $BRANCH; then
116+
git checkout $BRANCH
117+
git reset --hard origin/$BRANCH
118+
else
119+
git checkout -b $BRANCH origin/$BRANCH
120+
fi
121+
else
122+
git checkout master
123+
git reset --hard origin/master
124+
fi
125+
126+
test -d _opam || opam switch create . --no-install --formula '"ocaml-system"'
127+
eval $(opam env)
128+
opam pin $GITHUB_WORKSPACE -yn --with-version to-test
129+
# opam lib pins defined in opam-rt are ignored as there is a local pin
130+
opam pin . -yn --ignore-pin-depends
131+
opam install opam-rt --deps-only opam-devel.to-test
132+
make || { opam reinstall opam-client -y; make; }
133+
(set +x ; echo -en "::endgroup::opam-rt\r") 2>/dev/null
134+
fi

.github/workflows/main.yml

+29
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,35 @@ jobs:
113113
run: sudo apt install man2html
114114
- name: Checkout tree
115115
uses: actions/checkout@v3
116+
- name: src_ext/archives and opam-repository Cache
117+
id: archives
118+
uses: ocaml-opam/cache@opam
119+
with:
120+
path: |
121+
src_ext/archives
122+
~/opam-repository
123+
key: ${{ needs.Analyse.outputs.archives }}
124+
force-gzip: true
125+
- name: OCaml ${{ matrix.ocamlv }} Cache
126+
id: ocaml-cache
127+
uses: actions/cache@v3
128+
with:
129+
path: ~/.cache/ocaml-local/**
130+
key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ needs.Analyse.outputs.ocaml-cache }}
131+
- name: Create OCaml ${{ matrix.ocamlv }} cache
132+
if: steps.ocaml-cache.outputs.cache-hit != 'true'
133+
run: bash -exu .github/scripts/main/ocaml-cache.sh ${{ runner.os }} ${{ matrix.ocamlv }}
134+
- name: opam bootstrap Cache
135+
id: opam-bootstrap
136+
uses: actions/cache@v3
137+
with:
138+
path: |
139+
${{ env.OPAMBSROOT }}/**
140+
~/.cache/opam-local/bin/**
141+
key: opamdoc-${{ runner.os }}-${{ env.OPAMBSVERSION }}-${{ matrix.ocamlv }}-${{ env.OPAM_REPO_SHA }}-${{ needs.Analyse.outputs.opam-bs-cache }}
142+
- name: Create opam bootstrap cache
143+
if: steps.opam-bootstrap.outputs.cache-hit != 'true'
144+
run: bash -exu .github/scripts/main/opam-bs-cache.sh
116145
- name: Compile
117146
env:
118147
BASE_REF_SHA: ${{ github.event.pull_request.base.sha }}

src/client/opamClient.ml

+1
Original file line numberDiff line numberDiff line change
@@ -1733,3 +1733,4 @@ end
17331733

17341734

17351735

1736+

0 commit comments

Comments
 (0)