chore: improve api-doc #20152
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CICD-PUSH | |
on: | |
push: | |
branches: | |
- '*' | |
- '*/*' | |
tags-ignore: | |
- '*' | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
BASE_BRANCH: origin/main | |
GO_VERSION: "1.21" | |
jobs: | |
trigger-mode: | |
runs-on: ubuntu-latest | |
outputs: | |
trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }} | |
base-commitid: ${{ steps.get_trigger_mode.outputs.base_commitid }} | |
steps: | |
- name: Cancel Previous Runs | |
if: github.ref_name != 'main' | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
all_but_latest: true | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get trigger mode | |
id: get_trigger_mode | |
run: | | |
TRIGGER_MODE=`bash .github/utils/utils.sh --type 6 \ | |
--branch-name "${{ github.ref_name }}" \ | |
--base-branch "${{ env.BASE_BRANCH }}"` | |
BASE_COMMITID=`bash .github/utils/utils.sh --type 19 \ | |
--branch-name "${{ github.ref_name }}" \ | |
--base-branch "${{ env.BASE_BRANCH }}"` | |
echo "TRIGGER_MODE:$TRIGGER_MODE" | |
echo "BASE_COMMITID:$BASE_COMMITID" | |
echo trigger_mode=$TRIGGER_MODE >> $GITHUB_OUTPUT | |
echo base_commitid=$BASE_COMMITID >> $GITHUB_OUTPUT | |
- name: merge releasing to release | |
if: ${{ startsWith(github.ref_name, 'releasing-') }} | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
bash .github/utils/merge_releasing_branch.sh | |
pre-push: | |
needs: trigger-mode | |
runs-on: ubuntu-latest | |
name: Push Pre-Check | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install pcregrep | |
run: | | |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list | |
sudo apt-get update | |
sudo apt-get install pcregrep | |
- name: pcregrep Chinese | |
run: | | |
FILE_PATH=`git diff --name-only HEAD ${{ needs.trigger-mode.outputs.base-commitid }}` | |
echo "FILE_PATH: $FILE_PATH" | |
for filePath in $(echo "$FILE_PATH"); do | |
filePath="${filePath%/*}" | |
if [[ -d $filePath && "$filePath" != *"i18n/zh-cn"* ]]; then | |
echo $(pcregrep -r -n -I '[^\x00-\x7f]' $filePath >> pcregrep.out) | |
fi | |
done | |
python ${{ github.workspace }}/.github/utils/pcregrep.py \ | |
--source="${{ github.workspace }}/pcregrep.out" \ | |
--filter="$FILE_PATH" | |
- name: Spell Check with Typos | |
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docs]') | |
uses: crate-ci/typos@v1.13.14 | |
with: | |
files: docs/ | |
config: .github/utils/typos.toml | |
make-test: | |
needs: trigger-mode | |
runs-on: [self-hosted, gke-runner-go1.21] | |
if: contains(needs.trigger-mode.outputs.trigger-mode, '[test]') | |
outputs: | |
runner-name: ${{ steps.get_runner_name.outputs.runner_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: make manifests check | |
run: | | |
make manifests | |
FILE_CHANGES=`git diff --name-only ${{ github.sha }}` | |
if [[ ! -z "$FILE_CHANGES" ]]; then | |
echo $FILE_CHANGES | |
echo "make manifests causes inconsistent files" | |
exit 1 | |
fi | |
- name: make generate check | |
run: | | |
make generate | |
FILE_CHANGES=`git diff --name-only ${{ github.sha }}` | |
if [[ ! -z "$FILE_CHANGES" ]]; then | |
echo $FILE_CHANGES | |
echo "make generate causes inconsistent files" | |
exit 1 | |
fi | |
- name: make mod-vendor | |
run: | | |
make mod-vendor | |
- name: make staticcheck | |
run: | | |
make staticcheck | |
- name: make lint | |
run: | | |
make lint | |
- name: make test | |
run: | | |
make test | |
- name: ignore cover pkgs | |
run: | | |
bash .github/utils/utils.sh --type 14 \ | |
--file cover.out \ | |
--ignore-pkgs "${{ vars.IGNORE_COVERAGE_PKG }}" | |
- name: upload coverage report | |
uses: codecov/codecov-action@v3 | |
continue-on-error: true | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./cover_new.out | |
flags: unittests | |
name: codecov-report | |
verbose: true | |
- name: kill kube-apiserver and etcd | |
id: get_runner_name | |
if: ${{ always() }} | |
run: | | |
echo runner_name=${RUNNER_NAME} >> $GITHUB_OUTPUT | |
bash .github/utils/utils.sh --type 8 | |
remove-runner: | |
needs: [ trigger-mode, make-test ] | |
runs-on: ubuntu-latest | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[test]') && always() }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: remove runner | |
run: | | |
bash .github/utils/utils.sh --type 9 \ | |
--github-token "${{ env.GITHUB_TOKEN }}" \ | |
--runner-name ${{ needs.make-test.outputs.runner-name }} | |
check-image: | |
needs: trigger-mode | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docker]') }} | |
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.24 | |
with: | |
MAKE_OPS_PRE: "generate" | |
IMG: "apecloud/kubeblocks" | |
GO_VERSION: "1.21" | |
BUILDX_PLATFORMS: "linux/amd64" | |
DOCKERFILE_PATH: "./docker/Dockerfile" | |
secrets: inherit | |
check-tools-image: | |
needs: trigger-mode | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docker]') }} | |
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.24 | |
with: | |
MAKE_OPS_PRE: "module generate test-go-generate" | |
IMG: "apecloud/kubeblocks-tools" | |
GO_VERSION: "1.21" | |
BUILDX_PLATFORMS: "linux/amd64" | |
DOCKERFILE_PATH: "./docker/Dockerfile-tools" | |
secrets: inherit | |
check-datascript-image: | |
needs: trigger-mode | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docker]') }} | |
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.24 | |
with: | |
IMG: "apecloud/kubeblocks-datascript" | |
BUILDX_PLATFORMS: "linux/amd64" | |
DOCKERFILE_PATH: "./docker/Dockerfile-datascript" | |
secrets: inherit | |
check-dataprotection-image: | |
needs: trigger-mode | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docker]') }} | |
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.24 | |
with: | |
IMG: "apecloud/kubeblocks-dataprotection" | |
BUILDX_PLATFORMS: "linux/amd64" | |
DOCKERFILE_PATH: "./docker/Dockerfile-dataprotection" | |
secrets: inherit | |
check-helm: | |
needs: trigger-mode | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[deploy]') }} | |
uses: apecloud/apecloud-cd/.github/workflows/release-charts-check.yml@v0.1.43 | |
with: | |
MAKE_OPS: "bump-chart-ver" | |
VERSION: "v0.8.0-check" | |
CHART_NAME: "kubeblocks" | |
CHART_DIR: "deploy/helm" | |
APECD_REF: "v0.1.43" | |
MAKE_OPS_POST: "install" | |
GO_VERSION: "1.21" | |
secrets: inherit | |
deploy-kubeblocks-io: | |
needs: trigger-mode | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docs]') && (github.ref_name == 'main' || startsWith(github.ref_name, 'release')) }} | |
uses: apecloud/apecloud-cd/.github/workflows/trigger-workflow.yml@v0.1.0 | |
with: | |
GITHUB_REPO: "apecloud/kubeblocks.io" | |
BRANCH_NAME: "master" | |
WORKFLOW_ID: "deploy.yml" | |
APECD_REF: "v0.1.0" | |
secrets: inherit | |
deploy-cn-kubeblocks-io: | |
needs: trigger-mode | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docs_cn]') && (github.ref_name == 'main' || startsWith(github.ref_name, 'release')) }} | |
uses: apecloud/apecloud-cd/.github/workflows/trigger-workflow.yml@v0.1.43 | |
with: | |
GITHUB_REPO: "apecloud/cn.kubeblocks.io" | |
BRANCH_NAME: "master" | |
WORKFLOW_ID: "deploy.yml" | |
APECD_REF: "v0.1.43" | |
secrets: inherit | |
apis-doc: | |
needs: [ trigger-mode ] | |
runs-on: ubuntu-latest | |
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[apis]') || contains(needs.trigger-mode.outputs.trigger-mode, '[lorry]') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install lib | |
run: | | |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
libbtrfs-dev \ | |
libdevmapper-dev | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "${{ env.GO_VERSION }}" | |
- name: Check apis doc | |
run: | | |
make doc | |
FILE_CHANGES=`git diff --name-only ${{ github.sha }}` | |
if [[ ! -z "$FILE_CHANGES" ]]; then | |
echo $FILE_CHANGES | |
echo "make doc causes apis doc changes" | |
exit 1 | |
fi | |
check-license-header: | |
needs: [ trigger-mode ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: check license-header | |
run: | | |
check_lh_ret=$(make check-license-header | (grep 'FAIL' || true) ) | |
if [[ -n "$check_lh_ret" ]]; then | |
echo "$check_lh_ret" | |
echo "check license-header FAIL" | |
exit 1 | |
fi |