From 168fadf1de2045ffa3d710ffdafcec248b09416e Mon Sep 17 00:00:00 2001 From: Binbin Zhang Date: Tue, 14 Sep 2021 16:10:00 +0800 Subject: [PATCH] ci: Weekly check whether the docs url is alive Weekly check(at 23:00 every Sunday) whether the docs url is ALIVE, so that we can find the failed url in time Fixes #815 Signed-off-by: Binbin Zhang --- .github/workflows/docs-url-alive-check.yaml | 44 +++++++++++++++++++++ Makefile | 8 +++- ci/docs-url-alive-check.sh | 12 ++++++ ci/lib.sh | 9 +++++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs-url-alive-check.yaml create mode 100755 ci/docs-url-alive-check.sh diff --git a/.github/workflows/docs-url-alive-check.yaml b/.github/workflows/docs-url-alive-check.yaml new file mode 100644 index 0000000000..cf821abb21 --- /dev/null +++ b/.github/workflows/docs-url-alive-check.yaml @@ -0,0 +1,44 @@ +on: + schedule: + - cron: '0 23 * * 0' + +name: Docs URL Alive Check +jobs: + test: + strategy: + matrix: + go-version: [1.17.x] + os: [ubuntu-20.04] + runs-on: ${{ matrix.os }} + env: + target_branch: ${{ github.base_ref }} + steps: + - name: Install Go + if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + env: + GOPATH: ${{ runner.workspace }}/kata-containers + - name: Set env + if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} + run: | + echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + - name: Checkout code + if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} + uses: actions/checkout@v2 + with: + fetch-depth: 0 + path: ./src/github.com/${{ github.repository }} + - name: Setup + if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} + run: | + cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/setup.sh + env: + GOPATH: ${{ runner.workspace }}/kata-containers + # docs url alive check + - name: Docs URL Alive Check + if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} + run: | + cd ${GOPATH}/src/github.com/${{ github.repository }} && make docs-url-alive-check diff --git a/Makefile b/Makefile index 5e3695dd7e..6bb914271f 100644 --- a/Makefile +++ b/Makefile @@ -39,10 +39,16 @@ generate-protocols: static-checks: build bash ci/static-checks.sh +docs-url-alive-check: + bash ci/docs-url-alive-check.sh + .PHONY: \ all \ binary-tarball \ default \ install-binary-tarball \ logging-crate-tests \ - static-checks + static-checks \ + docs-url-alive-check + + diff --git a/ci/docs-url-alive-check.sh b/ci/docs-url-alive-check.sh new file mode 100755 index 0000000000..4b5371c34d --- /dev/null +++ b/ci/docs-url-alive-check.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Copyright (c) 2021 Easystack Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +run_docs_url_alive_check diff --git a/ci/lib.sh b/ci/lib.sh index 3c64db5952..5da391ca05 100644 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -44,3 +44,12 @@ run_go_test() clone_tests_repo bash "$tests_repo_dir/.ci/go-test.sh" } + +run_docs_url_alive_check() +{ + clone_tests_repo + # Make sure we have the targeting branch + git remote set-branches --add origin "${branch}" + git fetch -a + bash "$tests_repo_dir/.ci/static-checks.sh" --docs --all "github.com/kata-containers/kata-containers" +}