From e743d03e01a50de1f21fc159dbb958800e2b36ab Mon Sep 17 00:00:00 2001 From: hlts2 Date: Wed, 8 May 2024 12:29:10 +0900 Subject: [PATCH] fix: copy workflow from vald-client-clj Signed-off-by: hlts2 --- .github/assets/k8s/mysql/configmap.yaml | 29 +++ .github/assets/k8s/mysql/deployment.yaml | 72 ++++++++ .github/assets/k8s/mysql/pv.yaml | 29 +++ .github/assets/k8s/mysql/pvc.yaml | 26 +++ .github/assets/k8s/mysql/secret.yaml | 22 +++ .github/assets/k8s/mysql/svc.yaml | 25 +++ .github/assets/k8s/redis/deployment.yaml | 65 +++++++ .github/assets/k8s/redis/secret.yaml | 22 +++ .github/assets/k8s/redis/svc.yaml | 28 +++ .github/workflows/build.yml | 222 +++++++++++++++++++++++ .github/workflows/deploy.yml | 85 +++++++++ .github/workflows/update.yml | 67 +++++++ 12 files changed, 692 insertions(+) create mode 100644 .github/assets/k8s/mysql/configmap.yaml create mode 100644 .github/assets/k8s/mysql/deployment.yaml create mode 100644 .github/assets/k8s/mysql/pv.yaml create mode 100644 .github/assets/k8s/mysql/pvc.yaml create mode 100644 .github/assets/k8s/mysql/secret.yaml create mode 100644 .github/assets/k8s/mysql/svc.yaml create mode 100644 .github/assets/k8s/redis/deployment.yaml create mode 100644 .github/assets/k8s/redis/secret.yaml create mode 100644 .github/assets/k8s/redis/svc.yaml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/update.yml diff --git a/.github/assets/k8s/mysql/configmap.yaml b/.github/assets/k8s/mysql/configmap.yaml new file mode 100644 index 00000000..fc1f6576 --- /dev/null +++ b/.github/assets/k8s/mysql/configmap.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: mysql-config +data: + ddl.sql: | + DROP SCHEMA IF EXISTS `vald` ; + CREATE SCHEMA IF NOT EXISTS `vald` DEFAULT CHARACTER SET utf8 ; + + USE `vald` ; + + CREATE TABLE IF NOT EXISTS `vald`.`meta_vector` ( + `uuid` VARCHAR(255) NOT NULL, + `vector` BLOB NOT NULL, + `meta` VARCHAR(1024) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`uuid`), + UNIQUE INDEX `id_unique` (`id` ASC), + UNIQUE INDEX `meta_unique` (`meta` ASC) + ) + ENGINE = InnoDB; + + CREATE TABLE IF NOT EXISTS `vald`.`pod_ip` ( + `id` int NOT NULL, + `ip` VARCHAR(64) NOT NULL, + PRIMARY KEY (`id`, `ip`), + INDEX `ip_index` (`ip` ASC) + ) + ENGINE = InnoDB; diff --git a/.github/assets/k8s/mysql/deployment.yaml b/.github/assets/k8s/mysql/deployment.yaml new file mode 100644 index 00000000..81b3cef5 --- /dev/null +++ b/.github/assets/k8s/mysql/deployment.yaml @@ -0,0 +1,72 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: mysql + name: mysql +spec: + progressDeadlineSeconds: 600 + replicas: 1 + selector: + matchLabels: + app: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: mysql + spec: + containers: + # - image: mariadb:latest + - image: mysql:latest + imagePullPolicy: Always + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-secret + key: password + name: mysql + ports: + - containerPort: 3306 + name: mysql + protocol: TCP + resources: + requests: + cpu: 100m + memory: 100Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql/ + - name: mysql-initdb + mountPath: /docker-entrypoint-initdb.d/ + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-pv-claim + - name: mysql-initdb + configMap: + name: mysql-config + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 diff --git a/.github/assets/k8s/mysql/pv.yaml b/.github/assets/k8s/mysql/pv.yaml new file mode 100644 index 00000000..eddfdea0 --- /dev/null +++ b/.github/assets/k8s/mysql/pv.yaml @@ -0,0 +1,29 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: v1 +kind: PersistentVolume +metadata: + name: mysql-pv-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 20Mi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" diff --git a/.github/assets/k8s/mysql/pvc.yaml b/.github/assets/k8s/mysql/pvc.yaml new file mode 100644 index 00000000..2add4695 --- /dev/null +++ b/.github/assets/k8s/mysql/pvc.yaml @@ -0,0 +1,26 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Mi diff --git a/.github/assets/k8s/mysql/secret.yaml b/.github/assets/k8s/mysql/secret.yaml new file mode 100644 index 00000000..d660024c --- /dev/null +++ b/.github/assets/k8s/mysql/secret.yaml @@ -0,0 +1,22 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: v1 +data: + password: cGFzc3dvcmQ= +kind: Secret +metadata: + name: mysql-secret +type: Opaque diff --git a/.github/assets/k8s/mysql/svc.yaml b/.github/assets/k8s/mysql/svc.yaml new file mode 100644 index 00000000..1e337261 --- /dev/null +++ b/.github/assets/k8s/mysql/svc.yaml @@ -0,0 +1,25 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: v1 +kind: Service +metadata: + name: mysql +spec: + ports: + - port: 3306 + selector: + app: mysql + clusterIP: None diff --git a/.github/assets/k8s/redis/deployment.yaml b/.github/assets/k8s/redis/deployment.yaml new file mode 100644 index 00000000..0ee8c78c --- /dev/null +++ b/.github/assets/k8s/redis/deployment.yaml @@ -0,0 +1,65 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: redis + name: redis +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 2 + selector: + matchLabels: + app: redis + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app: redis + spec: + containers: + - image: redis:latest + imagePullPolicy: Always + name: redis + args: + - "--requirepass $(REDIS_PASSWORD)" + ports: + - containerPort: 6379 + name: redis + protocol: TCP + resources: + requests: + cpu: 100m + memory: 100Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + env: + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: password + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 diff --git a/.github/assets/k8s/redis/secret.yaml b/.github/assets/k8s/redis/secret.yaml new file mode 100644 index 00000000..882e8b2c --- /dev/null +++ b/.github/assets/k8s/redis/secret.yaml @@ -0,0 +1,22 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: v1 +data: + password: cGFzc3dvcmQ= +kind: Secret +metadata: + name: redis-secret +type: Opaque diff --git a/.github/assets/k8s/redis/svc.yaml b/.github/assets/k8s/redis/svc.yaml new file mode 100644 index 00000000..57615463 --- /dev/null +++ b/.github/assets/k8s/redis/svc.yaml @@ -0,0 +1,28 @@ +# +# Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt ) +# +# 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. +# +apiVersion: v1 +kind: Service +metadata: + name: redis + labels: + app: redis +spec: + ports: + - port: 6379 + targetPort: 6379 + selector: + app: redis + clusterIP: None diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..7996b428 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,222 @@ +# name: Build native image +# on: +# push: +# branches: +# - main +# tags: +# - '*.*.*' +# - 'v*.*.*' +# - '*.*.*-*' +# - 'v*.*.*-*' +# pull_request: +# paths: +# - .github/** +# - src/** +# - cmd/** +# - project.clj +# - Makefile +# - VALD_CLIENT_CLJ_VERSION +# +# jobs: +# build-linux: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Install GraalVM +# run: | +# TMP_GRAALVM_HOME=/tmp/graalvm +# GRAALVM_HOME=/tmp/graalvm +# GRAALVM_TGZ_URI="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${GRAALVM_VERSION}/graalvm-ce-${JAVA_VERSION}-linux-amd64-${GRAALVM_VERSION}.tar.gz" +# curl -sL $GRAALVM_TGZ_URI --output graalvm.tar.gz +# mkdir -p $TMP_GRAALVM_HOME +# tar -xf graalvm.tar.gz -C $TMP_GRAALVM_HOME --strip-components=1 +# chmod -R a+rwx $TMP_GRAALVM_HOME +# echo "PATH=$GRAALVM_HOME/bin:$PATH" >> $GITHUB_ENV +# echo "GRAALVM_HOME=$GRAALVM_HOME" >> $GITHUB_ENV +# echo "JAVA_HOME=$GRAALVM_HOME" >> $GITHUB_ENV +# env: +# GRAALVM_VERSION: 21.0.0 +# JAVA_VERSION: java11 +# - name: Install dependencies +# run: | +# gu install native-image +# curl -o lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein +# chmod a+x lein +# sudo ./lein version +# sudo apt-get update && sudo apt-get install -y upx +# - name: Build native-image +# run: | +# make valdcli +# # upx --lzma --best valdcli +# chmod a+x valdcli +# - name: Upload artifact +# uses: actions/upload-artifact@v3 +# with: +# name: valdcli-linux +# path: ./valdcli +# build-linux-static: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Install GraalVM +# run: | +# TMP_GRAALVM_HOME=/tmp/graalvm +# GRAALVM_HOME=/tmp/graalvm +# GRAALVM_TGZ_URI="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${GRAALVM_VERSION}/graalvm-ce-${JAVA_VERSION}-linux-amd64-${GRAALVM_VERSION}.tar.gz" +# curl -sL $GRAALVM_TGZ_URI --output graalvm.tar.gz +# mkdir -p $TMP_GRAALVM_HOME +# tar -xf graalvm.tar.gz -C $TMP_GRAALVM_HOME --strip-components=1 +# chmod -R a+rwx $TMP_GRAALVM_HOME +# echo "PATH=$GRAALVM_HOME/bin:$PATH" >> $GITHUB_ENV +# echo "GRAALVM_HOME=$GRAALVM_HOME" >> $GITHUB_ENV +# echo "JAVA_HOME=$GRAALVM_HOME" >> $GITHUB_ENV +# env: +# GRAALVM_VERSION: 21.0.0 +# JAVA_VERSION: java11 +# - name: Install dependencies +# run: | +# gu install native-image +# curl -o lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein +# chmod a+x lein +# sudo ./lein version +# sudo apt-get update && sudo apt-get install -y upx +# - name: Fetch bundle +# run: | +# curl -L -o musl.tar.gz https://github.com/gradinac/musl-bundle-example/releases/download/v1.0/musl.tar.gz +# tar xvzf musl.tar.gz +# mv bundle /tmp/musl +# - name: Build musl-gcc +# run: | +# curl -o musl-${MUSL_VERSION}.tar.gz https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz +# tar xzvf musl-${MUSL_VERSION}.tar.gz +# cd musl-${MUSL_VERSION} +# ./configure --disable-shared --prefix=/tmp/musl +# make +# make install +# export PATH=$PATH:/tmp/musl/bin +# echo "PATH=/tmp/musl/bin:$PATH" >> $GITHUB_ENV +# env: +# MUSL_VERSION: 1.2.1 +# - name: Build static native-image +# run: | +# make OPTS="--static --libc=musl" valdcli +# # upx --lzma --best valdcli +# chmod a+x valdcli +# - name: Upload artifact +# uses: actions/upload-artifact@v3 +# with: +# name: valdcli-linux-static +# path: ./valdcli +# build-macos: +# runs-on: macos-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Install GraalVM +# run: | +# TMP_GRAALVM_HOME=/tmp/graalvm +# GRAALVM_HOME=/tmp/graalvm/Contents/Home +# GRAALVM_TGZ_URI="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${GRAALVM_VERSION}/graalvm-ce-${JAVA_VERSION}-darwin-amd64-${GRAALVM_VERSION}.tar.gz" +# curl -sL $GRAALVM_TGZ_URI --output graalvm.tar.gz +# mkdir -p $TMP_GRAALVM_HOME +# tar -xf graalvm.tar.gz -C $TMP_GRAALVM_HOME --strip-components=1 +# chmod -R a+rwx $TMP_GRAALVM_HOME +# echo "PATH=$GRAALVM_HOME/bin:$PATH" >> $GITHUB_ENV +# echo "GRAALVM_HOME=$GRAALVM_HOME" >> $GITHUB_ENV +# echo "JAVA_HOME=$GRAALVM_HOME" >> $GITHUB_ENV +# env: +# GRAALVM_VERSION: 21.0.0 +# JAVA_VERSION: java11 +# - name: Install dependencies +# run: | +# brew install leiningen +# gu install native-image +# brew install upx +# - name: Build native-image +# run: | +# make valdcli +# # upx --lzma --best valdcli +# chmod a+x valdcli +# - name: Upload artifact +# uses: actions/upload-artifact@v3 +# with: +# name: valdcli-macos +# path: ./valdcli +# release: +# runs-on: ubuntu-latest +# needs: +# - build-linux +# - build-linux-static +# - build-macos +# steps: +# - uses: actions/checkout@v3 +# - name: Create release +# if: startsWith( github.ref, 'refs/tags/') +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: ${{ github.ref }} +# release_name: Release ${{ github.ref }} +# draft: false +# prerelease: false +# - name: mkdir +# if: startsWith( github.ref, 'refs/tags/') +# run: | +# mkdir -p tmp/linux +# mkdir -p tmp/linux-static +# mkdir -p tmp/macos +# - uses: actions/download-artifact@v3 +# if: startsWith( github.ref, 'refs/tags/') +# with: +# name: valdcli-linux +# path: tmp/linux +# - uses: actions/download-artifact@v3 +# if: startsWith( github.ref, 'refs/tags/') +# with: +# name: valdcli-linux-static +# path: tmp/linux-static +# - uses: actions/download-artifact@v3 +# if: startsWith( github.ref, 'refs/tags/') +# with: +# name: valdcli-macos +# path: tmp/macos +# - name: zip +# if: startsWith( github.ref, 'refs/tags/') +# run: | +# chmod a+x tmp/linux/valdcli +# chmod a+x tmp/linux-static/valdcli +# chmod a+x tmp/macos/valdcli +# zip --junk-paths valdcli-linux tmp/linux/valdcli +# zip --junk-paths valdcli-linux-static tmp/linux-static/valdcli +# zip --junk-paths valdcli-macos tmp/macos/valdcli +# - name: Upload Release Asset (linux) +# if: startsWith( github.ref, 'refs/tags/') +# uses: actions/upload-release-asset@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ./valdcli-linux.zip +# asset_name: valdcli-linux.zip +# asset_content_type: application/zip +# - name: Upload Release Asset (linux-static) +# if: startsWith( github.ref, 'refs/tags/') +# uses: actions/upload-release-asset@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ./valdcli-linux-static.zip +# asset_name: valdcli-linux-static.zip +# asset_content_type: application/zip +# - name: Upload Release Asset (macos) +# if: startsWith( github.ref, 'refs/tags/') +# uses: actions/upload-release-asset@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ./valdcli-macos.zip +# asset_name: valdcli-macos.zip +# asset_content_type: application/zip diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..95adfdf8 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,85 @@ +# name: E2E test and Deploy to Clojars +# on: +# push: +# branches: +# - main +# tags: +# - '*.*.*' +# - 'v*.*.*' +# - '*.*.*-*' +# - 'v*.*.*-*' +# pull_request: +# +# jobs: +# e2e: +# name: Run E2E Tests +# runs-on: ubuntu-latest +# steps: +# - name: Check out code. +# uses: actions/checkout@v3 +# - name: Install dependencies +# run: | +# curl -o lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein +# chmod a+x lein +# sudo ./lein version +# - uses: rinx/setup-k3d@v0.0.4 +# with: +# version: latest +# name: vald +# agents: 1 +# - name: check k3d +# run: | +# kubectl cluster-info +# - uses: azure/setup-helm@v3 +# - name: Helm version +# run: | +# helm version +# - name: deploy Vald +# run: | +# helm repo add vald https://vald.vdaas.org/charts +# helm install \ +# --values ${VALUES} \ +# --set defaults.image.tag=nightly \ +# --set agent.ngt.dimension=300 \ +# --set agent.ngt.auto_index_length=2 \ +# --set agent.minReplicas=1 \ +# --set gateway.lb.enabled=false \ +# --set discoverer.enabled=false \ +# --set manager.index.enabled=false \ +# --generate-name vald/vald +# sleep 3 +# kubectl wait --for=condition=ready pod -l app=vald-agent --timeout=3m +# kubectl get pods +# env: +# VALUES: https://raw.githubusercontent.com/vdaas/vald/main/.github/helm/values/values-lb.yaml +# - name: Download data +# run: | +# curl -OL https://raw.githubusercontent.com/rinx/word2vecjson/master/data/wordvecs1000.json +# - name: run tests +# run: | +# kubectl port-forward statefulset/vald-agent 8081:8081 & +# pid=$! +# +# ./lein test +# +# kill $pid +# deploy: +# if: startsWith( github.ref, 'refs/tags/') +# needs: +# - e2e +# name: Deploy to Clojars +# runs-on: ubuntu-latest +# steps: +# - name: Check out code. +# uses: actions/checkout@v3 +# - name: Install dependencies +# run: | +# curl -o lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein +# chmod a+x lein +# sudo ./lein version +# - name: Deploy +# run: | +# ./lein deploy clojars +# env: +# CLOJARS_USER: ${{ secrets.CLOJARS_USER }} +# CLOJARS_PASS: ${{ secrets.CLOJARS_PASS }} diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 00000000..9d5e37ba --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,67 @@ +# name: Update version +# on: +# schedule: +# - cron: 0 * * * * +# workflow_dispatch: +# +# jobs: +# update-version: +# name: update-version +# runs-on: ubuntu-latest +# steps: +# - name: Check out code. +# uses: actions/checkout@v3 +# with: +# fetch-depth: 0 +# persist-credentials: false +# - uses: crazy-max/ghaction-import-gpg@v4 +# with: +# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} +# git_user_signingkey: true +# git_commit_gpgsign: true +# - name: Run gitwerk semver-auto +# run: | +# CURRENT_VERSION=`cat VALD_CLIENT_CLJ_VERSION` +# GITHUB_LATEST_VERSION=`curl -s https://api.github.com/repos/vdaas/vald-client-java/releases/latest | jq -r '.tag_name'` +# if [ "" = "${GITHUB_LATEST_VERSION}" ]; then +# echo "the version is empty" +# exit 0 +# fi +# +# if [ "${CURRENT_VERSION}" = "v${GITHUB_LATEST_VERSION}" ]; then +# echo "vald-client-java latest version in GitHub is ${GITHUB_LATEST_VERSION}. GitHub is not updated" +# exit 0 +# fi +# +# STATUS_CODE=`curl -fsSLI https://repo1.maven.org/maven2/org/vdaas/vald/vald-client-java/${GITHUB_LATEST_VERSION} -o /dev/null -w '%{http_code}' 2> /dev/null` +# if [ "${STATUS_CODE}" != "200" ]; then +# echo "vald-client-java has not been uploaded to maven repository yet" +# exit 0 +# fi +# +# VERSION="v${GITHUB_LATEST_VERSION}" +# +# echo "${VERSION}" > VALD_CLIENT_CLJ_VERSION +# +# curl -o lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein +# chmod a+x lein +# ./lein pom +# rm lein +# +# git config --global user.name "vdaas-ci" +# git config --global user.email "vald@vdaas.org" +# git remote set-url origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" +# +# git checkout main +# git add VALD_CLIENT_CLJ_VERSION +# git add pom.xml +# git commit --signoff -m ":bookmark: Release ${VERSION}" +# +# git tag ${VERSION} +# git remote set-url origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" +# +# git push origin main +# git push origin ${VERSION} +# env: +# GITHUB_USER: ${{ secrets.VALDCLI_USER }} +# GITHUB_TOKEN: ${{ secrets.VALDCLI_TOKEN }}