doc01.gms : runs linkchecker on offline documentation

Description

Run's a linkchecker on the documentation in %gams.sysdir%/docs.

Contributor: Jarungjit Parnjai, Stefan Vigerske, May 2015


Small Model of Type : GAMS


Category : GAMS Test library


Main file : doc01.gms

$title runs linkchecker on offline documentation (DOC01,SEQ=681)

$onText
Run's a linkchecker on the documentation in %gams.sysdir%/docs.

Contributor: Jarungjit Parnjai, Stefan Vigerske, May 2015
$offText


* run only on build systems, where linkchecker is available
$if not setenv GPORTBIN $abort.noError 'no linkchecker available'
$if set noComp $abort.noError 'no linkchecker available'

* checking links to external webpages takes times and is error prone, do this only on anton in licensed builds for now
$set checkextern 0
$if not set DEMOSIZE $if %sysenv.GHOST% == anton.gams.com $set checkextern 1
* if not building master or distXX, then do not check links to external webpages
* (we are probably in a feature or bugfix branch where we test some solver update)
$if not %sysenv.GBRANCHNAME% == master $if not %sysenv.GBRANCHNAME% == dist%sysenv.GVERSIONMAJOR% $set checkextern 0

$set ignore
$if NOT %system.isAlphaBeta% == 0 $set ignore ^https://www.gams.com/%sysenv.DIST%

* disable http-redirected warnings for now (#6298)
* disable http-rate-limited warnings, as they are not in our control
$onEcho > linkcheckerrc
[filtering]
checkextern = %checkextern%
ignore = %ignore%
  ^http://doi.org
  ^http://www.amazon.com
  ^https://www.amazon.com
nofollow =
ignorewarnings = http-redirected,http-rate-limited

[output]
status = 0
fileoutput = html

[checking]
sslverify=0
$offEcho

* call linkchecker for docs and model libraries
$set LINKCHECKERCALL python -c 'from linkcheck.command.linkchecker import linkchecker; linkchecker()'
* on macOS, the docs are not in sysdir anymore, but in  ../../../Resources/docs
$if     dexist '%gams.sysdir%../../../Resources/docs' $call sh -c "%LINKCHECKERCALL% -flinkcheckerrc '%gams.sysdir%../../../Resources/docs/index.html' '%gams.sysdir%'../../../Resources/*_ml/libhtml/index.html"
$if not dexist '%gams.sysdir%../../../Resources/docs' $call sh -c "%LINKCHECKERCALL% -flinkcheckerrc '%gams.sysdir%docs/index.html' '%gams.sysdir%'/*_ml/libhtml/index.html"

$if errorlevel 1 $abort 'broken links in docu, inspect linkchecker-out.html'