Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Dec 5, 2024
0 parents commit f8f74f0
Show file tree
Hide file tree
Showing 66 changed files with 3,847 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
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 }}

- 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
69 changes: 69 additions & 0 deletions .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Staging

on:
push:
branches:
- "mistress"

env:
COMPONENT: metrics
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}
helm package helm/${COMPONENT}
- 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} ${COMPONENT}-0.0.0.tgz \
--values helm/metrics/values-awakari-com.yaml \
--set-string podAnnotations.commit=$(git rev-parse --short HEAD) \
--set limits.db.tls.enabled=true \
--set limits.db.tls.insecure=true \
--set permits.db.tls.enabled=true \
--set permits.db.tls.insecure=true
51 changes: 51 additions & 0 deletions .github/workflows/testing.yaml
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@v2

- name: Set up Go
uses: actions/setup-go@v3
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@v2

- name: Set up Go
uses: actions/setup-go@v3
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 }}
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
./metrics
cover.tmp

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
vendor/
**/*.pb.go

ghcr_io_pat.txt
*.key
*.crt
*.srl
*.csr
*.p12
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.23.4-alpine3.20 AS builder
WORKDIR /go/src/metrics
COPY . .
RUN \
apk add -U --no-cache \
protoc \
protobuf-dev \
make \
git \
ca-certificates && \
make build

FROM scratch
COPY --from=builder /go/src/metrics/metrics /bin/metrics
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/bin/metrics"]
Loading

0 comments on commit f8f74f0

Please sign in to comment.