From c26525a515fa566be42c7b77db2273af92d5ff8f Mon Sep 17 00:00:00 2001 From: rk <68526782+runkecheng@users.noreply.github.com> Date: Fri, 22 Jul 2022 15:35:57 +0800 Subject: [PATCH] ci: update the codecheck items and the build items. (#613) * feat(ci): update codecheck items * feat(ci): build xenon --- .github/workflows/build_xenon_image.yml | 39 +++++++++++++++++++++++++ .github/workflows/code_check.yml | 34 +++++++++++++++++---- .github/workflows/publish_images.yml | 18 ++++++++++-- 3 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build_xenon_image.yml diff --git a/.github/workflows/build_xenon_image.yml b/.github/workflows/build_xenon_image.yml new file mode 100644 index 00000000..6d73c7a4 --- /dev/null +++ b/.github/workflows/build_xenon_image.yml @@ -0,0 +1,39 @@ +name: Build xenon + +on: + workflow_call: + inputs: + image_tag: + required: true + type: string + secrets: + DOCKERHUB_USERNAME: + description: 'username of dockerhub' + required: true + DOCKERHUB_TOKEN: + description: 'password of dockerhub' + required: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + file: build/xenon/Dockerfile + tags: radondb/xenon:${{ inputs.image_tag }} diff --git a/.github/workflows/code_check.yml b/.github/workflows/code_check.yml index a6b737a9..36d3abc9 100644 --- a/.github/workflows/code_check.yml +++ b/.github/workflows/code_check.yml @@ -1,6 +1,7 @@ name: Code check on: + workflow_dispatch: push: branches: [ main ] paths-ignore: @@ -20,7 +21,7 @@ on: jobs: - gofmt: + fmtvet: runs-on: ubuntu-latest steps: - name: Set up Go @@ -31,10 +32,15 @@ jobs: - name: Check out source code uses: actions/checkout@v1 - - name: Run go fmt - run: d="$(gofmt -d ../../)" && if [ -n "$d" ]; then echo "format error:" ; echo "$d"; exit 1; fi + - name: Run go fmt/vet + run: | + make fmt + make vet - check-crd: + - name: Check + run: d="$(git status -s)" && if [ -n "$d" ]; then echo "check-crd error:" ; echo "$d"; exit 1; fi + + checkcrd: runs-on: ubuntu-latest steps: - name: Set up Go @@ -46,10 +52,12 @@ jobs: uses: actions/checkout@v1 - name: Recreate crd - run: make manifests + run: | + make manifests + make generate - name: Check crd - run: diff charts/mysql-operator/crds config/crd/bases + run: d="$(git status -s)" && if [ -n "$d" ]; then echo "check-crd error:" ; echo "$d"; exit 1; fi staticcheck: runs-on: ubuntu-latest @@ -67,3 +75,17 @@ jobs: - name: Run staticcheck run: staticcheck -f stylish ./... + + build: + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: Check out source code + uses: actions/checkout@v1 + + - name: Make build + run: make build diff --git a/.github/workflows/publish_images.yml b/.github/workflows/publish_images.yml index 14f3e5d0..0682c40a 100644 --- a/.github/workflows/publish_images.yml +++ b/.github/workflows/publish_images.yml @@ -17,11 +17,16 @@ on: required: true default: true type: boolean + build_xenon: + description: "" + required: true + default: true + type: boolean jobs: build_operator: uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_operator_image.yml@main - if: ${{ github.event.inputs.build_operator }} + if: ${{ github.event.inputs.build_operator == 'true' }} with: image_tag: ${{ github.event.inputs.tag }} secrets: @@ -30,7 +35,16 @@ jobs: build_sidecar: uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_sidecar_image.yml@main - if: ${{ github.event.inputs.build_sidecar }} + if: ${{ github.event.inputs.build_sidecar == 'true' }} + with: + image_tag: ${{ github.event.inputs.tag }} + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + build_xenon: + uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_xenon_image.yml@main + if: ${{ github.event.inputs.build_xenon == 'true' }} with: image_tag: ${{ github.event.inputs.tag }} secrets: