Skip to content

Commit

Permalink
Merge pull request #23 from cgasparini/markdown-link-check
Browse files Browse the repository at this point in the history
Add markdown link check
  • Loading branch information
jozef-slezak committed Oct 13, 2017
2 parents da56cb6 + f4c9389 commit 7fc98a9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -12,8 +12,10 @@ before_install:
- sudo apt-get update -q
- sudo apt-get install glide -y
- go get github.com/mattn/goveralls
- sudo apt-get install npm && npm install -g markdown-link-check

script:
- make check_links || true
- make all

after_success:
Expand Down
21 changes: 12 additions & 9 deletions Makefile
Expand Up @@ -2,14 +2,6 @@ include Makeroutines.mk

COVER_DIR=/tmp/

# fix sirupsen/Sirupsen problem
define fix_sirupsen_case_sensitivity_problem
@echo "# fixing sirupsen case sensitivity problem, please wait ..."
@-rm -rf vendor/github.com/Sirupsen
@-find ./ -type f -name "*.go" -exec sed -i -e 's/github.com\/Sirupsen\/logrus/github.com\/sirupsen\/logrus/g' {} \;
endef


# run all tests with coverage
define test_cover_only
@echo "# running unit tests with coverage analysis"
Expand All @@ -21,6 +13,14 @@ define test_cover_only
@echo "# done"
endef

# verify that links in markdown files are valid
# requires npm install -g markdown-link-check
define check_links_only
@echo "# checking links"
@./scripts/check_links.sh
@echo "# done"
endef

# build all binaries
build:
@echo "# building"
Expand Down Expand Up @@ -51,6 +51,9 @@ checkstyle:
@gometalinter --vendor --exclude=vendor --deadline 1m --enable-gc --disable=aligncheck --disable=gotype --disable=gotypex --exclude=mock ./...
@echo "# done"

check_links:
$(call check_links_only)

# run all tests
test:
@echo "# running unit tests"
Expand Down Expand Up @@ -99,4 +102,4 @@ all:
@make run-examples
@make clean

.PHONY: build get-tools install-dep update-dep checkstyle test test-cover test-cover-without-report build-examples run-examples clean all
.PHONY: build get-tools install-dep update-dep checkstyle test test-cover test-cover-without-report build-examples run-examples clean all check_links
7 changes: 7 additions & 0 deletions Makeroutines.mk
Expand Up @@ -15,4 +15,11 @@ define update_dependencies
@glide cc
@echo "# glide cache cleared"
@glide install --strip-vendor
endef

# fix sirupsen/Sirupsen problem
define fix_sirupsen_case_sensitivity_problem
@echo "# fixing sirupsen case sensitivity problem, please wait ..."
@-rm -rf vendor/github.com/Sirupsen
@-find ./ -type f -name "*.go" -exec sed -i -e 's/github.com\/Sirupsen\/logrus/github.com\/sirupsen\/logrus/g' {} \;
endef
2 changes: 1 addition & 1 deletion examples/gobgp_watch_plugin/README.md
Expand Up @@ -9,7 +9,7 @@ make run-examples
For explanatory step-by-step procedure, keep reading.
### Architecture
![arch](../../docs/imgs/dockerGoBGPExample.png "Ligato BGP Agent Example")
Architecture consists of 2 `Ligato CN-Infra` plugins and the [Route Reflector](../route-reflector-gobgp-docker) in docker container. The lifecycle of plugins is controlled by [CN-Infra](https://github.com/ligato/cn-infra) Core component. The Example plugin will communicate with the `GoBGP plugin` and the `GoBGP plugin` will be communicating with Route reflector node(implemented by [GoBGP](https://github.com/osrg/gobgp)) using BGP protocol. Any new learned reachable routes from the Route reflector will be passed through the `GoBGP Plugin` to the Example plugin. The Example plugin will write received route to the console.
Architecture consists of 2 `Ligato CN-Infra` plugins and the [Route Reflector](../../docker/gobgp_route_reflector/README.md) in docker container. The lifecycle of plugins is controlled by [CN-Infra](https://github.com/ligato/cn-infra) Core component. The Example plugin will communicate with the `GoBGP plugin` and the `GoBGP plugin` will be communicating with Route reflector node(implemented by [GoBGP](https://github.com/osrg/gobgp)) using BGP protocol. Any new learned reachable routes from the Route reflector will be passed through the `GoBGP Plugin` to the Example plugin. The Example plugin will write received route to the console.

### Infrastructure setup
To be able to run this example you must setup the infrastructure first.
Expand Down
18 changes: 18 additions & 0 deletions scripts/check_links.sh
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

res=0

for i in `find . \( -path ./vendor -o -path ./vpp \) -prune -o -name "*.md"`
do
if [ -d "$i" ]; then
continue
fi

echo $i;
if ! markdown-link-check $i; then
res=1
fi
echo "";
done

exit $res

0 comments on commit 7fc98a9

Please sign in to comment.