Skip to content

Commit

Permalink
travis: add a stage to test opam1.2 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Oct 16, 2019
1 parent 9f68bf0 commit 74e08cc
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
53 changes: 52 additions & 1 deletion .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export OPAMYES=1
export OCAMLRUNPARAM=b

( # Run subshell in bootstrap root env to build
echo -en "travis_fold:start:build\r"
if [[ $OPAM_TEST -eq 1 ]] ; then
export OPAMROOT=$OPAMBSROOT
eval $(opam env)
Expand All @@ -274,6 +275,10 @@ export OCAMLRUNPARAM=b
if [[ $OPAM_TEST$COLD -eq 0 ]] ; then
make lib-ext
fi
if [ "$TRAVIS_BUILD_STAGE_NAME" = "Upgrade" ]; then
# unset git versionning to allow OPAMYES use for upgrade
sed -i -e 's/\(.*with-stdout-to get-git-version.ml.*@@\).*/\1 \\"let version = None\\"")))/' src/client/dune
fi
make all
make man

Expand All @@ -295,13 +300,59 @@ export OCAMLRUNPARAM=b

opam switch default
opam switch remove $OPAMBSSWITCH --yes
else
elif [ "$TRAVIS_BUILD_STAGE_NAME" != "Upgrade" ]; then
# Note: these tests require a "system" compiler and will use the one in $OPAMBSROOT
OPAMEXTERNALSOLVER="$EXTERNAL_SOLVER" make tests ||
(tail -n 2000 _build/default/tests/fulltest-*.log; echo "-- TESTS FAILED --"; exit 1)
fi
echo -en "travis_fold:end:build\r"
)

if [ "$TRAVIS_BUILD_STAGE_NAME" = "Upgrade" ]; then
OPAM12DIR=~/opam1.2
CACHE=$OPAM12DIR/cache
export OPAMROOT=$CACHE/root20
if [[ ! -f $CACHE/bin/opam ]]; then
cd $OPAM12DIR
echo -en "travis_fold:start:opam12\r"
opam init --bare default git+https://github.com/ocaml/opam-repository#8be4290a
opam switch create opam12 --empty
eval `opam env`
OPAMEDITOR="sed -i -e 's/printconf/\"printconf\"/'" opam pin -n --edit dose 3.4.2 << EOF
EOF
mkdir -p $CACHE/sources
cd $CACHE/sources
wget https://github.com/ocaml/opam/archive/1.2.2.tar.gz -O opam1.2.tar.gz
tar -xzf opam1.2.tar.gz
cd opam-1.2.2
sed -i -e 's/cmdliner"/cmdliner" { <= "0.9.8" }/' opam
opam install ./opam --deps-only
grep -r "Debian.Version" * -l | xargs sed -i -e "s/Debian.Version.//"
cd $CACHE/sources/opam-1.2.2
./configure --prefix $CACHE
make clean
make
make install
echo -en "travis_fold:end:opam12\r"
fi
export OPAMROOT=/tmp/opamroot
rm -rf $OPAMROOT
if [[ ! -d $CACHE/root ]]; then
$CACHE/bin/opam init
cp -r /tmp/opamroot/ $CACHE/root
else
cp -r $CACHE/root /tmp/opamroot
fi
set +e
opam update
rcode=$?
if [ $rcode -ne 10 ]; then
echo "Bad return code $rcode, should be 10";
exit $rcode
fi
exit 0
fi

( # Finally run the tests, in a clean environment
export OPAMKEEPLOGS=1

Expand Down
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cache:
directories:
- $HOME/.opam.cached
- $HOME/local
- $HOME/opam1.2/cache

script:
- bash -exu .travis-ci.sh build
Expand All @@ -29,6 +30,9 @@ matrix:
- os: linux
env: OCAML_VERSION=4.03.0
stage: Build
- os: osx
env: OCAML_VERSION=4.03.0
stage: Build
- os: linux
env: OCAML_VERSION=4.04.2
stage: Build
Expand All @@ -41,14 +45,14 @@ matrix:
- os: linux
env: OCAML_VERSION=4.07.1
stage: Build
- os: linux
env: OCAML_VERSION=4.07.1
stage: Upgrade
- os: linux
stage: Hygiene
- os: osx
env: OCAML_VERSION=4.07.1 OPAM_TEST=1
stage: Test
- os: osx
env: OCAML_VERSION=4.03.0
stage: Test
- os: linux
env: OCAML_VERSION=4.07.1 OPAM_TEST=1
stage: Test
Expand All @@ -58,6 +62,7 @@ matrix:
- os: linux
env: COLD=1
stage: Test

notifications:
email:
- [email protected]
Expand Down

0 comments on commit 74e08cc

Please sign in to comment.