diff --git a/.github/workflows/markdown-link-check-config.json b/.github/workflows/markdown-link-check-config.json new file mode 100644 index 00000000000..9068496a695 --- /dev/null +++ b/.github/workflows/markdown-link-check-config.json @@ -0,0 +1,6 @@ +{ + "ignorePatterns": [ + { "pattern": "^https://github.com/\\S+/\\S+/(issues|pull)/[0-9]+" }, + { "pattern": "^mailto:" } + ] +} diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml new file mode 100644 index 00000000000..3f90624e96a --- /dev/null +++ b/.github/workflows/markdown.yml @@ -0,0 +1,17 @@ +name: Check Markdown links + +on: + pull_request: + push: + branches: + - master + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@1.0.2 + with: + max-depth: 1 + config-file: '.github/workflows/markdown-link-check-config.json' diff --git a/.travis.yml b/.travis.yml index b34b29eac85..2c7e6c3a9d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -109,10 +109,9 @@ jobs: script: - make test-sanity - # Run website and markdown doc checks + # Run website checks - name: Doc Checks script: - - make test-markdown - make test-links ## Operator test stage jobs ## diff --git a/Makefile b/Makefile index d86aa2f9b2b..815ae437970 100644 --- a/Makefile +++ b/Makefile @@ -209,13 +209,10 @@ image-push-scorecard-test: ##@ Tests # Static tests. -.PHONY: test test-markdown test-sanity test-unit +.PHONY: test test-sanity test-unit test: test-unit ## Run the tests -test-markdown: - ./hack/check-markdown.sh - test-sanity: tidy build/operator-sdk lint ./hack/tests/sanity-check.sh @@ -228,7 +225,7 @@ test-links: # CI tests. .PHONY: test-ci -test-ci: test-markdown test-sanity test-unit install test-subcommand test-e2e ## Run the CI test suite +test-ci: test-sanity test-unit install test-subcommand test-e2e ## Run the CI test suite # Subcommand tests. .PHONY: test-subcommand test-subcommand-local test-subcommand-scorecard test-subcommand-olm-install diff --git a/hack/check-markdown.sh b/hack/check-markdown.sh deleted file mode 100755 index 74aa24238e4..00000000000 --- a/hack/check-markdown.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -set -e - -source ./hack/lib/common.sh - -header_text "Running markdown link checker against changed markdown files" - -COMMIT_RANGE="$TRAVIS_COMMIT_RANGE" -if [ -z "$COMMIT_RANGE" ] || ! git rev-list --quiet $COMMIT_RANGE; then - # Assume comparing current branch to master if we don't have $TRAVIS_COMMIT_RANGE - COMMIT_RANGE="master" -fi - -# todo: since the marker do not work with .website we will probably remove it -# However, if we decided to keep it then, -# - (by @joe): would be nice to be able to pass an explicit list of files to marker so we don't have to do these -# --exclude shenanigans. Also, note that we would need to fix the issue with the README. -# - The current version used of the marker is 0.8.0(latest) and it throws the error `received fatal alert: ProtocolVersion` -# becuase is not able supporting TLS 1.3 which is used in https://coreos.com/operators/. Then, it also need to be fixed. -find . -name '*.md' > .marker.tmp.all -git diff --name-only $COMMIT_RANGE | grep '\.md$' | sed -e 's/^/.\//' > .marker.tmp.changed -excludes=$(grep -vxF -f .marker.tmp.changed .marker.tmp.all | sed -e 's/^/--exclude /') -rm .marker.tmp.* - -./hack/ci/marker --exclude website $excludes diff --git a/hack/ci/marker b/hack/ci/marker deleted file mode 100755 index ce6029b8782..00000000000 Binary files a/hack/ci/marker and /dev/null differ diff --git a/website/content/en/docs/contribution-guidelines/testing/running-the-tests.md b/website/content/en/docs/contribution-guidelines/testing/running-the-tests.md index 031b1b0e571..c57a1201124 100644 --- a/website/content/en/docs/contribution-guidelines/testing/running-the-tests.md +++ b/website/content/en/docs/contribution-guidelines/testing/running-the-tests.md @@ -57,7 +57,7 @@ $ export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" All the tests are run through the [`Makefile`][makefile]. This is a brief description of all makefile test instructions: - `test` - Runs the unit tests (`test-unit`). -- `test-ci` - Runs markdown, sanity, and unit tests, installs the SDK binary, and runs the SDK subcommand and all E2E tests. +- `test-ci` - Runs sanity and unit tests, installs the SDK binary, and runs the SDK subcommand and all E2E tests. - `test-sanity` - Runs sanity checks. - `test-unit` - Runs unit tests. - `test-subcommand` - Runs subcommand tests. @@ -66,7 +66,6 @@ All the tests are run through the [`Makefile`][makefile]. This is a brief descri - `test-e2e-ansible` - Runs the ansible E2E test. - `test-e2e-ansible-molecule` - Runs the ansible molecule E2E test. - `test-e2e-helm` - Runs the helm E2E test. -- `test-markdown` - Runs the markdown checks For more info on what these tests actually do, please see the [Travis Build][travis] doc. diff --git a/website/content/en/docs/contribution-guidelines/testing/travis-build.md b/website/content/en/docs/contribution-guidelines/testing/travis-build.md index 136c99ba17a..1e6373cbde1 100644 --- a/website/content/en/docs/contribution-guidelines/testing/travis-build.md +++ b/website/content/en/docs/contribution-guidelines/testing/travis-build.md @@ -13,7 +13,6 @@ In Travis CI, 4 jobs are run to test the sdk: - [Go](#go-tests) - [Ansible](#ansible-tests) - [Helm](#helm-tests) -- [Markdown](#markdown) ### Before Install for Go, Ansible, and Helm @@ -104,12 +103,6 @@ The Go, Ansible, and Helm tests then differ in what tests they run. **NOTE**: All created resources, including the namespace, are deleted using a bash trap when the test finishes -### Markdown - -The markdown test does not create a new cluster and runs in a barebones Travis VM configured only for `bash`. This allows documentation PRs to pass quickly, as they don't require code tests. The markdown checker uses a precompiled version of [`marker`][marker-github] stored in [`hack/ci/marker`][marker-local] to check the validity and correctness of the links in all markdown files in the `website/content/en/docs` directory. - -**NOTE**: There is currently a bug in marker that causes link with underscores (`_`) to not be checked correctly. - [branches]: https://travis-ci.org/operator-framework/operator-sdk/branches [pr-builds]: https://travis-ci.org/operator-framework/operator-sdk/pull_requests [k8s-script]: https://github.com/operator-framework/operator-sdk/blob/master/hack/ci/setup-k8s.sh @@ -122,6 +115,4 @@ The markdown test does not create a new cluster and runs in a barebones Travis V [ansible-test]: https://github.com/operator-framework/operator-sdk/tree/master/test/ansible [helm-e2e]: https://github.com/operator-framework/operator-sdk/blob/master/hack/tests/e2e-helm.sh [helm-base]: https://github.com/operator-framework/operator-sdk/blob/master/hack/image/helm/scaffold-helm-image.go -[marker-github]: https://github.com/crawford/marker -[marker-local]: https://github.com/operator-framework/operator-sdk/blob/master/hack/ci/marker [deps_mgmt]: ../../../golang/quickstart#a-note-on-dependency-management