Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vald-client-go]: Use vald-client-ci workflows for release and e2e #287

Merged
merged 9 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DO NOT EDIT
name: "Run E2E test"
on:
push:
branches:
- main
pull_request:

jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# TODO: change to the following before main merge.
# - uses: vdaas/vald-client-ci/.github/actions/e2e@main
- uses: vdaas/vald-client-ci/.github/actions/e2e@feat/add-common-workflows
with:
client_type: go

build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: debug for build
run: |
echo "Install dependencies"
make ci/deps/install

echo "Build proto"
export GOPATH=$HOME/go
export PATH=$HOME/grpc-java:$PATH
make proto
make vald/sha/update
make vald/client/version/update

echo "Update dependencies"
make ci/deps/update

git diff
git diff --name-only
- uses: vdaas/vald-client-ci/.github/actions/e2e@feat/add-common-workflows
with:
client_type: go
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DO NOT EDIT
name: "Run release"
on:
push:
tags:
- '*.*.*'
- 'v*.*.*'
- '*.*.*-*'
- 'v*.*.*-*'
jobs:
release:
# TODO: change to the following before main merge.
# uses: vdaas/vald-client-ci/.github/workflows/_release.yaml@main
uses: vdaas/vald-client-ci/.github/workflows/_release.yaml@feat/add-common-workflows
with:
client_type: go
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DO NOT EDIT
name: "Sync Vald"
on:
workflow_dispatch:
# schedule:
# - cron: "*/5 * * * *"
jobs:
sync:
# TODO: change to the following before main merge.
# uses: vdaas/vald-client-ci/.github/workflows/sync.yaml@main
uses: vdaas/vald-client-ci/.github/workflows/sync.yaml@feat/add-common-workflows
with:
client_type: go
secrets:
CI_USER: ${{ secrets.DISPATCH_USER }}
CI_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
72 changes: 60 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ PKGREPO = github.com/$(REPO)/$(PKGNAME)
VALD_SHA = VALD_SHA
VALD_VERSION = VALD_VERSION
VALD_DIR = vald-origin
VALD_CHECKOUT_REF ?= main

ROOTDIR = $(eval ROOTDIR := $(shell git rev-parse --show-toplevel))$(ROOTDIR)
GO_VERSION := $(eval GO_VERSION := $(shell cat GO_VERSION))$(GO_VERSION)
TEST_DATASET_PATH = wordvecs1000.json

MAKELISTS = Makefile

Expand All @@ -39,7 +41,7 @@ cyan = /bin/echo -e "\x1b[36m\#\# $1\x1b[0m"

.PHONY: all
## execute clean and proto
all: clean sync/v1 mod clean
all: clean proto mod clean

.PHONY: help
## print all available commands
Expand All @@ -62,12 +64,9 @@ help:
clean:
-@rm -rf $(VALD_DIR)

$(VALD_DIR):
git clone --depth 1 https://$(VALDREPO) $(VALD_DIR)

.PHONY: sync/v1
## sync/v1 synchronize VALD_DIR's generated v1 pbgo to v1 dir and patch it
sync/v1: $(VALD_DIR)
.PHONY: proto
## proto synchronize VALD_DIR's generated v1 pbgo to v1 dir and patch it
proto: $(VALD_DIR)
rm -rf $(ROOTDIR)/v1
cp -r $(VALD_DIR)/apis/grpc/v1 $(ROOTDIR)/v1
rm -rf $(ROOTDIR)/v1/discoverer \
Expand All @@ -77,10 +76,24 @@ sync/v1: $(VALD_DIR)
# $(ROOTDIR)/v1/mirror \
find $(ROOTDIR)/v1/* -name '*.go' | xargs sed -i -E "s%github.com/vdaas/vald/internal/net/grpc/codes%google.golang.org/grpc/codes%g"
find $(ROOTDIR)/v1/* -name '*.go' | xargs sed -i -E "s%github.com/vdaas/vald/internal/net/grpc/status%google.golang.org/grpc/status%g"
find $(ROOTDIR)/v1/* -name '*.go' | xargs sed -i -E "s%github.com/vdaas/vald/apis/grpc/v1%github.com/vdaas/vald-client-go/v1%g"
# find $(ROOTDIR)/v1/* -name '*.go' | xargs sed -i -E "s%github.com/vdaas/vald/apis/grpc/v1%github.com/vdaas/vald-client-go/v1%g"
# TODO: The following is for vald-ci-labs, so remove it when implementing in vald-client-go.
find $(ROOTDIR)/v1/* -name '*.go' | xargs sed -i -E "s%github.com/vdaas/vald/apis/grpc/v1%github.com/vdaas/vald-ci-labs/v1%g"
find $(ROOTDIR)/v1/* -name '*.go' | xargs sed -i -E "s%github.com/vdaas/vald/internal/io%io%g"
find $(ROOTDIR)/v1/* -name '*.go' | xargs sed -i -E "s%github.com/vdaas/vald/internal/sync%sync%g"
rm -rf $(VALD_DIR)

$(VALD_DIR):
git clone https://$(VALDREPO) $(VALD_DIR)

.PHONY: vald/checkout
## checkout vald repository
vald/checkout: $(VALD_DIR)
cd $(VALD_DIR) && git checkout $(VALD_CHECKOUT_REF)

.PHONY: vald/origin/sha/print
## print origin VALD_SHA value
vald/origin/sha/print: $(VALD_DIR)
@cd $(VALD_DIR) && git rev-parse HEAD | tr -d '\n'

.PHONY: vald/sha/print
## print VALD_SHA value
Expand All @@ -90,15 +103,50 @@ vald/sha/print:
.PHONY: vald/sha/update
## update VALD_SHA value
vald/sha/update: $(VALD_DIR)
(cd $(VALD_DIR); git rev-parse HEAD > ../$(VALD_SHA))
cp $(VALD_DIR)/versions/VALD_VERSION $(VALD_VERSION)
cp $(VALD_DIR)/versions/GO_VERSION $(ROOTDIR)/GO_VERSION
(cd $(VALD_DIR); git rev-parse HEAD | tr -d '\n' > ../$(VALD_SHA))

.PHONY: vald/version/print
## print VALD_VERSION value
vald/version/print:
@cat $(VALD_VERSION)

.PHONY: vald/client/version/print
## print VALD_CLIENT_JAVA_VERSION value
vald/client/version/print: vald/version/print

.PHONY: vald/client/version/update
## update VALD_CLIENT_JAVA_VERSION value
vald/client/version/update: $(VALD_DIR)
cp $(VALD_DIR)/versions/VALD_VERSION $(VALD_VERSION)
cp $(VALD_DIR)/versions/GO_VERSION $(ROOTDIR)/GO_VERSION

.PHONY: test
## Execute test
test: $(TEST_DATASET_PATH)
go test -v ./tests/v1/e2e_test.go

$(TEST_DATASET_PATH):
curl -L https://raw.githubusercontent.com/rinx/word2vecjson/master/data/wordvecs1000.json -o $(TEST_DATASET_PATH)

.PHONY: ci/deps/install
## install deps for CI environment
ci/deps/install:
@echo "Nothing do be done"

.PHONY: ci/deps/update
## update deps for CI environment
ci/deps/update: mod

.PHONY: ci/package/prepare
## prepare for publich
ci/package/prepare:
@echo "Nothing do be done"

.PHONY: ci/package/publish
## publich packages
ci/package/publish:
@echo "Nothing do be done"

.PHONY: mod
## update go.mod
mod:
Expand Down
Loading