Skip to content

Commit

Permalink
Refactor github actions (#2773) (#2779)
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
Co-authored-by: Yusuke Kato <[email protected]>
Co-authored-by: Kiichiro YUKAWA <[email protected]>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 7c25316 commit 8537f27
Show file tree
Hide file tree
Showing 24 changed files with 85 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/actions/deploy-chaos-mesh/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Deploy Chaos Mesh"
description: "A action to deploy Chaos Mesh"
description: "An action to deploy Chaos Mesh"
inputs:
chaos_mesh_version:
description: "The Chaos Mesh version to use. The default version is `versions/CHAOS_MESH_VERSION`"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/detect-docker-image-tags/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Detect Docker image tags"
description: "A action to detect Docker image tags"
description: "An action to detect Docker image tags"
inputs:
tags:
description: "Tag name to check whether exists or not"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/determine-docker-image-tag/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Determine Docker image tag"
description: "A action to determine Docker image tag"
description: "An action to determine Docker image tag"
outputs:
TAGS:
description: "docker image tag list"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/docker-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Build Docker images"
description: "A action to build Docker images and publish them"
description: "An action to build Docker images and publish them"
inputs:
target:
description: "Build target"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/dump-context/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Dump context to log"
description: "A action to dump context to log"
description: "An action to dump context to log"
runs:
using: "composite"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/e2e-deploy-vald-helm-operator/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Deploy Vald using vald-helm-operator for E2E test"
description: "A action to deploy vald using vald-helm-operator for E2E test"
description: "An action to deploy vald using vald-helm-operator for E2E test"
inputs:
require_minio:
description: "If Minio is required, set this to true."
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/e2e-deploy-vald-readreplica/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Deploy Vald Read Replica for E2E test"
description: "A action to deploy vald read replica for E2E test"
description: "An action to deploy vald read replica for E2E test"
inputs:
require_minio:
description: "If Minio is required, set this to true."
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/e2e-deploy-vald/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Deploy Vald for E2E test"
description: "A action to deploy vald for E2E test"
description: "An action to deploy vald for E2E test"
inputs:
require_minio:
description: "If Minio is required, set this to true."
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/notify-slack/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Notify Slack"
description: "A action to notify Slack"
description: "An action to notify Slack"
inputs:
author_name:
description: "User name for slack notification"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/scan-docker-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Scan the Docker image"
description: "A action to scan the Docker image"
description: "An action to scan the Docker image"
inputs:
image_ref:
description: "Docker image reference"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Setup E2E environment"
description: "A action to set up the environment for executing E2E test"
description: "An action to set up the environment for executing E2E test"
inputs:
require_libhdf5:
description: "If libhdf5 is not required, set this to false"
Expand Down
19 changes: 15 additions & 4 deletions .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Setup Go environment"
description: "A action to set up Go environment"
description: "An action to set up Go environment"
inputs:
go_version:
description: "The Go version to use. The default version is `versions/GO_VERSION`"
Expand All @@ -28,14 +28,25 @@ runs:
shell: bash
run: |
GO_VERSION=${GO_VERSION:-`make version/go`}
echo "version=${GO_VERSION}" >> $GITHUB_OUTPUT
env:
GO_VERSION: ${{ inputs.go_version }}
- uses: actions/setup-go@v5
- name: Check if Go is installed
id: check_go
shell: bash
run: |
if command -v go &> /dev/null; then
echo "go_installed=true" >> $GITHUB_OUTPUT
echo "installed_version=$(go version | awk '{print $3}')" >> $GITHUB_OUTPUT
else
echo "go_installed=false" >> $GITHUB_OUTPUT
fi
- name: Setup Go (if not installed or version mismatch)
if: steps.check_go.outputs.go_installed == 'false' || steps.check_go.outputs.installed_version != steps.go_version.outputs.version
uses: actions/setup-go@v5
with:
go-version: ${{ steps.go_version.outputs.version }}
- name: Check Go version
- name: Verify Go version
shell: bash
run: |
go version
21 changes: 16 additions & 5 deletions .github/actions/setup-helm/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Setup Helm environment"
description: "A action to set up Helm environment"
description: "An action to set up Helm environment"
inputs:
helm_version:
description: "The Helm version to use. The default version is `versions/HELM_VERSION`"
Expand All @@ -28,14 +28,25 @@ runs:
shell: bash
run: |
HELM_VERSION=${HELM_VERSION:-`make version/helm`}
echo "version=${HELM_VERSION}" >> $GITHUB_OUTPUT
env:
HELM_VERSION: ${{ inputs.helm_version }}
- uses: azure/setup-helm@v4
- name: Check if Helm is installed
id: check_helm
shell: bash
run: |
if command -v helm &> /dev/null; then
echo "helm_installed=true" >> $GITHUB_OUTPUT
echo "installed_version=$(helm version --short --client | awk '{print $2}' | sed 's/^v//')" >> $GITHUB_OUTPUT
else
echo "helm_installed=false" >> $GITHUB_OUTPUT
fi
- name: Setup Helm (if not installed or version mismatch)
if: steps.check_helm.outputs.helm_installed == 'false' || steps.check_helm.outputs.installed_version != steps.helm_version.outputs.version
uses: azure/setup-helm@v4
with:
version: ${{ steps.helm_version.outputs.version }}
- name: Check Helm version
- name: Verify Helm version
shell: bash
run: |
helm version
helm version --short --client
19 changes: 14 additions & 5 deletions .github/actions/setup-k3d/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Setup k3d environment"
description: "A action to set up k3d (k3s in Docker)"
description: "An action to set up k3d (k3s in Docker)"
inputs:
version:
description: "k3d version"
Expand Down Expand Up @@ -67,12 +67,21 @@ runs:
echo "tag=${K3S_VERSION}" >> $GITHUB_OUTPUT
env:
K3S_VERSION: ${{ inputs.k3s_version }}
- name: Install k3d
- name: Check if k3d is installed
id: check_k3d
shell: bash
run: |
curl -s ${REPO_URL} | ${{ steps.k3d_version.outputs.tag }} bash
env:
REPO_URL: "https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh"
if command -v k3d &> /dev/null; then
echo "k3d_installed=true" >> $GITHUB_OUTPUT
echo "installed_version=$(k3d version --short | sed 's/^v//')" >> $GITHUB_OUTPUT
else
echo "k3d_installed=false" >> $GITHUB_OUTPUT
fi
- name: Install k3d (if not installed or version mismatch)
if: steps.check_k3d.outputs.k3d_installed == 'false' || steps.check_k3d.outputs.installed_version != steps.k3d_version.outputs.tag
shell: bash
run: |
make k3d/install
- name: Check k3d version
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-yq/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Setup yq environment"
description: "A action to set up yq"
description: "An action to set up yq"
inputs:
yq_version:
description: "The yq version to use. The default version is `versions/YQ_VERSION`"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/wait-for-docker-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
name: "Wait for Docker Images"
description: "A action to wait for Docker images to be published"
description: "An action to wait for Docker images to be published"
inputs:
images:
description: "image names"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
- name: Set Git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- uses: ./.github/actions/setup-go
- name: Build and zip
run: |
make binary/build/zip
Expand Down
34 changes: 15 additions & 19 deletions .github/workflows/chatops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/dump-context
label:
if: github.event.comment.user.login != 'vdaas-ci'
name: Add labels
runs-on: ubuntu-latest
if: github.event.comment.user.login != 'vdaas-ci'
container:
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
steps:
- name: Check PR Comments
id: check_comments_label
Expand All @@ -35,8 +37,6 @@ jobs:
TRIGGER_PHRASE: "/label"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-yq
if: steps.check_comments_label.outputs.BOOL_TRIGGERED == 'true'
- name: Check permissions
if: steps.check_comments_label.outputs.BOOL_TRIGGERED == 'true'
id: check_permissions
Expand Down Expand Up @@ -74,9 +74,11 @@ jobs:
USERNAME: ${{ steps.check_comments_label.outputs.COMMENTER_USERNAME }}
TRAILING_LINE: ${{ steps.check_comments_label.outputs.TRAILING_LINE }}
rebase:
if: github.event.comment.user.login != 'vdaas-ci'
name: Rebase
runs-on: ubuntu-latest
if: github.event.comment.user.login != 'vdaas-ci'
container:
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
steps:
- name: Check PR Comments
id: check_comments_rebase
Expand All @@ -85,8 +87,6 @@ jobs:
TRIGGER_PHRASE: "/rebase"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-yq
if: steps.check_comments_rebase.outputs.BOOL_TRIGGERED == 'true'
- name: Check permissions
if: steps.check_comments_rebase.outputs.BOOL_TRIGGERED == 'true'
id: check_permissions
Expand Down Expand Up @@ -149,11 +149,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
API_URL: ${{ github.event.issue.comments_url }}
gentest:
if: github.event.comment.user.login != 'vdaas-ci'
name: Add tests
needs:
- rebase
runs-on: ubuntu-latest
if: github.event.comment.user.login != 'vdaas-ci'
container:
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
steps:
- name: check PR Comments
id: check_comments_gen_test
Expand All @@ -162,8 +164,6 @@ jobs:
TRIGGER_PHRASE: "/gen-test"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-yq
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true'
- name: check permissions
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true'
id: check_permissions
Expand Down Expand Up @@ -212,8 +212,6 @@ jobs:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
- uses: ./.github/actions/setup-go
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
- name: Generate tests and push
id: gen_test
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
Expand Down Expand Up @@ -263,12 +261,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
API_URL: ${{ github.event.issue.comments_url }}
format:
if: github.event.comment.user.login != 'vdaas-ci'
name: Add license and run golines + gofumpt + goimports
needs:
- rebase
- gentest
runs-on: ubuntu-latest
if: github.event.comment.user.login != 'vdaas-ci'
container:
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
steps:
- name: check PR Comments
id: check_comments_format
Expand All @@ -277,8 +277,6 @@ jobs:
TRIGGER_PHRASE: "/format"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-yq
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true'
- name: check permissions
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true'
id: check_permissions
Expand Down Expand Up @@ -327,8 +325,6 @@ jobs:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
- uses: ./.github/actions/setup-go
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
- name: update and push
id: format_push
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
Expand Down Expand Up @@ -397,12 +393,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
API_URL: ${{ github.event.issue.comments_url }}
approve:
if: github.event.comment.user.login != 'vdaas-ci'
name: Approve
needs:
- rebase
- format
runs-on: ubuntu-latest
if: github.event.comment.user.login != 'vdaas-ci'
container:
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
steps:
- name: check PR Comments
id: check_comments_approve
Expand All @@ -411,8 +409,6 @@ jobs:
TRIGGER_PHRASE: "/approve"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-yq
if: steps.check_comments_approve.outputs.BOOL_TRIGGERED == 'true'
- name: check permissions
if: steps.check_comments_approve.outputs.BOOL_TRIGGERED == 'true'
id: check_permissions
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-code-bench-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
- name: Set Git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- uses: ./.github/actions/setup-go
- name: Run grpc-sequential
run: |
make hack/benchmark/assets/dataset/${{ env.DATASET }}
Expand Down Expand Up @@ -92,7 +91,6 @@ jobs:
- name: Set Git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- uses: ./.github/actions/setup-go
- name: Run grpc-stream
run: |
make hack/benchmark/assets/dataset/${{ env.DATASET }}
Expand Down
Loading

0 comments on commit 8537f27

Please sign in to comment.