-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
3,054 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.23 | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
with: | ||
version: '3.x' | ||
|
||
- name: Test | ||
run: make test | ||
|
||
- name: Registry login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.REGISTRY_USER }} | ||
password: ${{ secrets.REGISTRY_ACCESS_TOKEN }} | ||
|
||
- name: Release | ||
run: make release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Staging | ||
|
||
on: | ||
push: | ||
branches: | ||
- "mistress" | ||
|
||
env: | ||
COMPONENT: source-websocket | ||
VERSION: latest | ||
CHART_VERSION: 0.0.0 | ||
|
||
jobs: | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Registry login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.REGISTRY_USER }} | ||
password: ${{ secrets.REGISTRY_ACCESS_TOKEN }} | ||
|
||
- name: Staging | ||
run: make staging | ||
|
||
- name: Set up Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.12.0 | ||
|
||
- name: Helm Lint | ||
run: | | ||
helm lint helm/${COMPONENT} | ||
- name: Helm Package | ||
run: | | ||
helm dependency update helm/${COMPONENT} | ||
mkdir helm/package | ||
helm package helm/${COMPONENT} --destination helm/package | ||
cd helm/package | ||
helm repo index . | ||
- name: Publish Helm Chart | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: helm/package/ | ||
|
||
- name: Google Cloud Auth | ||
uses: 'google-github-actions/auth@v1' | ||
with: | ||
credentials_json: '${{ secrets.GKE_SA_KEY }}' | ||
|
||
- uses: google-github-actions/setup-gcloud@v1 | ||
with: | ||
project_id: ${{ secrets.GKE_RPOJECT_ID }} | ||
|
||
- name: Kubeconfig | ||
run: | | ||
gcloud components install gke-gcloud-auth-plugin | ||
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER_NAME_DEMO }} \ | ||
--region ${{ secrets.GKE_CLUSTER_REGION }} \ | ||
--project ${{ secrets.GKE_PROJECT_ID }} | ||
- name: Helm Upgrade | ||
run: | | ||
helm upgrade --install ${COMPONENT} helm/package/${COMPONENT}-0.0.0.tgz \ | ||
--set replicaCount=2 \ | ||
--set-string podAnnotations.commit=$(git rev-parse --short HEAD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
- "!mistress" | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.23 | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
with: | ||
# repo-token is necessary to avoid the rate limit issue | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
version: "3.x" | ||
|
||
- name: Build | ||
run: make build | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.23 | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
with: | ||
version: "3.x" | ||
|
||
- name: Test | ||
run: make test | ||
env: | ||
DB_URI_TEST_MONGO: ${{ secrets.DB_URI_TEST_MONGO }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM golang:1.23.2-alpine3.20 AS builder | ||
WORKDIR /go/src/source-websocket | ||
COPY . . | ||
RUN \ | ||
apk add protoc protobuf-dev make git && \ | ||
make build | ||
|
||
FROM alpine:3.20 | ||
RUN apk --no-cache add ca-certificates \ | ||
&& update-ca-certificates | ||
COPY --from=builder /go/src/source-websocket/source-websocket /bin/source-websocket | ||
ENTRYPOINT ["/bin/source-websocket"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
.PHONY: test clean | ||
default: build | ||
|
||
BINARY_FILE_NAME=source-websocket | ||
COVERAGE_FILE_NAME=cover.out | ||
COVERAGE_TMP_FILE_NAME=cover.tmp | ||
|
||
proto: | ||
go install github.com/golang/protobuf/protoc-gen-go@latest | ||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1 | ||
PATH=${PATH}:~/go/bin protoc --go_out=plugins=grpc:. --go_opt=paths=source_relative \ | ||
api/grpc/*.proto | ||
|
||
vet: proto | ||
go vet | ||
|
||
test: vet | ||
go test -race -cover -coverprofile=${COVERAGE_FILE_NAME} ./... | ||
cat ${COVERAGE_FILE_NAME} | grep -v _mock.go | grep -v logging.go | grep -v .pb.go > ${COVERAGE_FILE_NAME}.tmp | ||
mv -f ${COVERAGE_FILE_NAME}.tmp ${COVERAGE_FILE_NAME} | ||
go tool cover -func=${COVERAGE_FILE_NAME} | grep -Po '^total\:\h+\(statements\)\h+\K.+(?=\.\d+%)' > ${COVERAGE_TMP_FILE_NAME} | ||
./scripts/cover.sh | ||
rm -f ${COVERAGE_TMP_FILE_NAME} | ||
|
||
build: proto | ||
CGO_ENABLED=0 GOOS=linux GOARCH= GOARM= go build -o ${BINARY_FILE_NAME} main.go | ||
chmod ugo+x ${BINARY_FILE_NAME} | ||
|
||
docker: | ||
docker build -t awakari/source-websocket . | ||
|
||
|
||
staging: docker | ||
./scripts/staging.sh | ||
|
||
release: docker | ||
./scripts/release.sh | ||
|
||
clean: | ||
go clean | ||
rm -f ${BINARY_FILE_NAME} ${COVERAGE_FILE_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
# source-websocket | ||
WebSocket source implementation for Awakari | ||
Server-sent events source type | ||
|
||
```shell | ||
grpcurl \ | ||
-plaintext \ | ||
-proto api/grpc/service.proto \ | ||
-d @ \ | ||
localhost:50051 \ | ||
awakari.source.websocket.Service/Create | ||
``` | ||
|
||
```json | ||
{ | ||
"url": "wss://www.seismicportal.eu/standing_order/websocket", | ||
"groupId": "default" | ||
} | ||
``` |
Oops, something went wrong.