Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
cdd45c2707
|
|||
|
6f3d8b9b42
|
|||
|
01e0904fa6
|
|||
|
8d2bdaf352
|
|||
|
9f99f4203d
|
|||
|
96a0171bfd
|
|||
|
1b9e7a05d3
|
|||
|
3c7092fb9b
|
|||
|
fcfe74d80b
|
|||
|
13a75d52de
|
|||
|
8aa875b1d6
|
|||
|
a199324bcc
|
|||
|
3ebd28b9b8
|
|||
|
f2ba3c5340
|
|||
|
86d857e242
|
|||
|
d79187dfb4
|
|||
|
2325afaaf0
|
|||
|
9c92ab9d34
|
|||
|
5bcb6feeac
|
|||
|
8338a661f7
|
|||
|
db0bda6bae
|
|||
|
80ee3703f4
|
|||
|
bec347d871
|
@@ -1,48 +1,76 @@
|
||||
---
|
||||
name: Buf CI
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
buf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
echo ${{ gitea.action }}
|
||||
echo ${{ gitea.event_name }}
|
||||
echo ${{ gitea.ref }}
|
||||
echo ${{ gitea.base_ref }}
|
||||
echo ${{ gitea.ref_name }}
|
||||
echo ${{ gitea.repository }}
|
||||
echo ${{ gitea.server_url }}
|
||||
echo ${{ gitea.token }}
|
||||
echo ${{ gitea.api_url }}
|
||||
echo ${{ gitea }}
|
||||
echo ${{ gitea.repo }}
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ">=1.23.0"
|
||||
- uses: bufbuild/buf-setup-action@v1.47.2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ gitea.token }}
|
||||
path: ./
|
||||
|
||||
- name: install tea cli and init
|
||||
run: |
|
||||
mkdir tmp && cd tmp
|
||||
curl -SsOL https://dl.gitea.com/tea/main/tea-main-linux-amd64.xz
|
||||
apt install xz-utils -y
|
||||
xz -d tea-main-linux-amd64.xz
|
||||
ls -ahl
|
||||
mv tea-main-linux-amd64 /usr/bin/tea
|
||||
chmod +x /usr/bin/tea
|
||||
cd ..
|
||||
tea --version
|
||||
tea login \
|
||||
--name ${{ gitea.server_url }} \
|
||||
--token ${{ secrets.PROD_REG_TOKEN }} \
|
||||
--url ${{ gitea.server_url }}
|
||||
- run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
- run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
- run: go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest
|
||||
- run: npm install --save @bufbuild/protobuf @bufbuild/protoc-gen-es @bufbuild/buf
|
||||
- run: buf --version
|
||||
- run: "export PATH=$PATH:./node_modules/.bin\nbuf generate \n"
|
||||
- name: tar files
|
||||
run: |
|
||||
for out in go ts doc; do
|
||||
tar czf .res/${out}.tar.gz ./stub/${out}/
|
||||
done
|
||||
tar czf ./.res/src.tar.gz $(find -type f -name "*.proto")
|
||||
tea r c \
|
||||
--title "${{ gitea.ref_name }}" \
|
||||
--tag "${{ gitea.ref_name }}" \
|
||||
-a ./.res/src.tar.gz \
|
||||
-a ./.res/go.tar.gz \
|
||||
-a ./.res/doc.tar.gz \
|
||||
-a ./.res/ts.tar.gz \
|
||||
|
||||
# - uses: actions/setup-go@v5
|
||||
# with:
|
||||
# go-version: '>=1.18.0'
|
||||
# - uses: bufbuild/buf-setup-action@v1.47.2
|
||||
# - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
# - run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
# - run: npm install --save-dev
|
||||
# - run: buf --version
|
||||
# - uses: actions/checkout@v4
|
||||
# with:
|
||||
# token: ${{ secrets.PROD_REG_TOKEN }}
|
||||
# path: ./
|
||||
# - run: npx buf generate
|
||||
# - run: |
|
||||
# mkdir .res
|
||||
# for out in go ts docs; do
|
||||
# tar czf .res/${out}.tar.gz ./stub/${out}/ .
|
||||
# curl --user nfel:${{ secrets.PROD_REG_TOKEN }} \
|
||||
# --upload-file .res/${out}.tar.gz \
|
||||
# https://git.kahrobatoken.com/api/packages/kahroba/generic/proto/${{ gitea.event }}/${out}.tar.gz
|
||||
# done
|
||||
#
|
||||
#
|
||||
# if [ -n ${{ gitea.ref_name }} ]; then
|
||||
# mkdir .res
|
||||
# for out in go ts doc; do
|
||||
# echo releasing ${out} ...
|
||||
# tar czf .res/${out}.tar.gz ./stub/${out}/
|
||||
# curl -Ss --user nfel:${{ secrets.PROD_REG_TOKEN }}\
|
||||
# --upload-file .res/${out}.tar.gz \
|
||||
# ${{ gitea.server_url }}/api/packages/Kahroba/generic/proto/${{ gitea.ref_name }}/${out}.tar.gz
|
||||
# done
|
||||
# echo releasing proto ...
|
||||
# tar czf ./.res/src.tar.gz $(find -type f -name "*.proto")
|
||||
# curl -Ss --user nfel:${{ secrets.PROD_REG_TOKEN }}\
|
||||
# --upload-file ./.res/src.tar.gz \
|
||||
# ${{ gitea.server_url }}/api/packages/Kahroba/generic/proto/${{ gitea.ref_name }}/src.tar.gz
|
||||
# fi
|
||||
# - run: |
|
||||
|
||||
@@ -3,3 +3,4 @@ gen/go
|
||||
stub
|
||||
node_modules
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Protobuf with fangs
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package alert.v1;
|
||||
|
||||
enum Importance {
|
||||
LOW = 0;
|
||||
MEDIUM = 1;
|
||||
HIGH = 2;
|
||||
CRITICAL = 3;
|
||||
}
|
||||
|
||||
enum LogSource {
|
||||
UNKNOWN = 0;
|
||||
USER = 1;
|
||||
SYSTEM = 2;
|
||||
WALLET = 3;
|
||||
}
|
||||
|
||||
message Meta {
|
||||
uint32 created_at_ts = 1;
|
||||
uint32 updated_at_ts = 2;
|
||||
uint32 blamer_id = 3; // User ID of person who made the change
|
||||
}
|
||||
|
||||
message LogEvent {
|
||||
optional uint64 id = 1; // Record Id of Log stored in db
|
||||
string content = 2;
|
||||
string effective_user = 3;
|
||||
optional LogEvent prev_cause = 4;
|
||||
optional LogSource source = 5;
|
||||
Importance importance = 6;
|
||||
Meta meta = 7;
|
||||
}
|
||||
|
||||
message LogEventList {
|
||||
repeated LogEvent events = 1;
|
||||
}
|
||||
/*
|
||||
Internal Msg
|
||||
*/
|
||||
message SMS {
|
||||
string recipient = 1; //recipient
|
||||
string text = 2;
|
||||
optional string sender = 3;
|
||||
Meta meta = 4;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package alert.v1;
|
||||
|
||||
import "alert/v1/msg.proto";
|
||||
import "base/v1/msg.proto";
|
||||
|
||||
service AlertSrv {
|
||||
rpc Log(LogEvent) returns (base.v1.StatusRes) {}
|
||||
rpc LogHistory(base.v1.IdReq) returns(LogEventList) {}
|
||||
rpc StatusChange(LogEvent) returns (base.v1.StatusRes) {}
|
||||
}
|
||||
@@ -13,3 +13,12 @@ message IdRes {
|
||||
message IdReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
message Pagination{
|
||||
uint32 page = 1; // in query param it will be p
|
||||
uint32 page_size = 2; // in query param it will be pz
|
||||
}
|
||||
message Filter {
|
||||
string query = 1; // q
|
||||
string sort = 2; // s
|
||||
optional Pagination page = 3;
|
||||
}
|
||||
|
||||
+6
-3
@@ -20,9 +20,12 @@ plugins:
|
||||
# - remote: buf.build/protocolbuffers/go:v1.30.0
|
||||
out: stub/go
|
||||
# NOTE: doc
|
||||
# - local: protoc-gen-doc
|
||||
# opt: html,index.html,source_relative
|
||||
# out: stub/doc
|
||||
- local: protoc-gen-doc
|
||||
opt: html,index.html,source_relative
|
||||
out: stub/doc/html
|
||||
- local: protoc-gen-doc
|
||||
opt: markdown,index.md,source_relative
|
||||
out: stub/doc/md
|
||||
# # NOTE: Gateway
|
||||
# # - remote: buf.build/grpc-ecosystem/gateway:v2.16.2
|
||||
# - local: protoc-gen-grpc-gateway
|
||||
|
||||
Reference in New Issue
Block a user