diff --git a/appveyor-retry.cmd b/appveyor-retry.cmd new file mode 100644 index 0000000000000000000000000000000000000000..ac3836508576b869ec0fb87acfefaf3665a9532b --- /dev/null +++ b/appveyor-retry.cmd @@ -0,0 +1,21 @@ +@echo off +rem Source: https://github.com/appveyor/ci/blob/master/scripts/appveyor-retry.cmd +rem initiate the retry number +set retryNumber=0 +set maxRetries=3 + +:RUN +%* +set LastErrorLevel=%ERRORLEVEL% +IF %LastErrorLevel% == 0 GOTO :EOF +set /a retryNumber=%retryNumber%+1 +IF %reTryNumber% == %maxRetries% (GOTO :FAILED) + +:RETRY +set /a retryNumberDisp=%retryNumber%+1 +@echo Command "%*" failed with exit code %LastErrorLevel%. Retrying %retryNumberDisp% of %maxRetries% +GOTO :RUN + +: FAILED +@echo Sorry, we tried running command for %maxRetries% times and all attempts were unsuccessful! +EXIT /B %LastErrorLevel% diff --git a/appveyor.yml b/appveyor.yml index 15b6ec186c79406faed1c48970df49394c70a5bf..01e4eba8b133a22f3c2323ceb944f4cff6fde4c3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ build_script: # 'echo "" |' works around an AppVeyor issue: # https://github.com/commercialhaskell/stack/issues/1097#issuecomment-145747849 - - echo "" | ..\cabal install --only-dependencies --enable-tests + - echo "" | ..\appveyor-retry ..\cabal install --only-dependencies --enable-tests - Setup configure --user --ghc-option=-Werror --enable-tests - Setup build @@ -27,7 +27,7 @@ build_script: # - echo "" | ..\cabal install hackage-repo-tool --allow-newer=Cabal,time --constraint="Cabal == 1.25.0.0" - cd ..\cabal-testsuite - ghc --make -threaded -i Setup.hs -package Cabal-1.25.0.0 - - echo "" | ..\cabal install --only-dependencies --enable-tests + - echo "" | ..\appveyor-retry ..\cabal install --only-dependencies --enable-tests - Setup configure --user --ghc-option=-Werror --enable-tests - Setup build # Must install the test suite, so that our GHCi invocation picks it up @@ -39,8 +39,8 @@ build_script: # - Setup test --show-details=streaming --test-option=--hide-successes - cd ..\cabal-install - ghc --make -threaded -i -i. Setup.hs -Wall -Werror - - echo "" | ..\cabal install happy - - echo "" | ..\cabal install --only-dependencies --enable-tests + - echo "" | ..\appveyor-retry ..\cabal install happy + - echo "" | ..\appveyor-retry ..\cabal install --only-dependencies --enable-tests - ..\cabal configure --user --ghc-option=-Werror --enable-tests - ..\cabal build # update package index again, this time for the cabal under test