Skip to content

Commit

Permalink
add CI; fix module name
Browse files Browse the repository at this point in the history
  • Loading branch information
freigeistig committed Nov 13, 2023
1 parent 7a52991 commit 7d43e9c
Show file tree
Hide file tree
Showing 25 changed files with 154 additions and 54 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build verify proxy docker image
on:
workflow_dispatch:

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_SHA
- name: Run Build
run: |
. $(werf ci-env github --as-file)
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
37 changes: 37 additions & 0 deletions .github/workflows/actions_onlymain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build verify proxy docker image
on:
push:
branches:
- 'main'
- 'master'
- 'chains/mainnet'
- 'chains/mainnet-beta'

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_SHA
- name: Run Build
run: |
. $(werf ci-env github --as-file)
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
34 changes: 34 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build verify proxy docker image
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_REF_NAME
- name: Run Build
run: |
. $(werf ci-env github --as-file)
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM golang:1.19 as buildbase

WORKDIR /go/src/gitlab.com/rarimo/identity/verify-proxy
WORKDIR /go/src/github.com/rarimo/verify-proxy
COPY . .

RUN CGO_ENABLED=1 GOOS=linux go build -o /usr/local/bin/verify-proxy /go/src/gitlab.com/rarimo/identity/verify-proxy
RUN CGO_ENABLED=1 GOOS=linux go build -o /usr/local/bin/verify-proxy /go/src/github.com/rarimo/verify-proxy

FROM alpine:3.18.2

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The service is designed to receive callbacks from PolygonID Wallet application.
## Install

```
git clone gitlab.com/rarimo/polygonid/verify-proxy
git clone github.com/rarimo/verify-proxy
cd verify-proxy
go build main.go
export KV_VIPER_FILE=./config.yaml
Expand Down Expand Up @@ -39,8 +39,8 @@ Make sure that docker installed.
use `docker run ` with `-p 8080:80` to expose port 80 to 8080

```
docker build -t gitlab.com/rarimo/polygonid/verify-proxy .
docker run -e KV_VIPER_FILE=/config.yaml gitlab.com/rarimo/polygonid/verify-proxy
docker build -t github.com/rarimo/verify-proxy .
docker run -e KV_VIPER_FILE=/config.yaml github.com/rarimo/verify-proxy
```

## Running from Source
Expand Down
4 changes: 2 additions & 2 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
GENERATOR_IMAGE=registry.gitlab.com/tokend/openapi-go-generator:69f004b58152c83f007b593cc13e94b81d7200da


GENERATED="${GOPATH}/src/gitlab.com/rarimo/polygonid/verify-proxy/resources"
OPENAPI_DIR="${GOPATH}/src/gitlab.com/rarimo/polygonid/verify-proxy/docs/web_deploy"
GENERATED="${GOPATH}/src/github.com/rarimo/verify-proxy/resources"
OPENAPI_DIR="${GOPATH}/src/github.com/rarimo/verify-proxy/docs/web_deploy"
PACKAGE_NAME=resources

function printHelp {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module gitlab.com/rarimo/polygonid/verify-proxy
module github.com/rarimo/verify-proxy

go 1.19

Expand All @@ -17,6 +17,7 @@ require (
gitlab.com/distributed_lab/figure v2.1.0+incompatible
gitlab.com/distributed_lab/kit v1.11.2
gitlab.com/distributed_lab/logan v3.8.1+incompatible
gitlab.com/distributed_lab/running v0.0.0-20200706131153-4af0e83eb96c
)

require (
Expand Down Expand Up @@ -55,7 +56,6 @@ require (
github.com/spf13/viper v1.3.2 // indirect
github.com/stretchr/testify v1.8.4 // indirect
gitlab.com/distributed_lab/lorem v0.2.0 // indirect
gitlab.com/distributed_lab/running v0.0.0-20200706131153-4af0e83eb96c // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.9.0 // indirect
Expand Down
7 changes: 3 additions & 4 deletions internal/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ package cli

import (
"context"
"gitlab.com/distributed_lab/logan/v3"
"os"
"os/signal"
"sync"
"syscall"

"github.com/alecthomas/kingpin"
"github.com/rarimo/verify-proxy/internal/config"
"github.com/rarimo/verify-proxy/internal/service/api"
"gitlab.com/distributed_lab/kit/kv"
"gitlab.com/distributed_lab/logan/v3"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/config"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api"
)

func Run(args []string) bool {
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
migrate "github.com/rubenv/sql-migrate"
"gitlab.com/distributed_lab/logan/v3/errors"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/assets"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/config"
"github.com/rarimo/verify-proxy/internal/assets"
"github.com/rarimo/verify-proxy/internal/config"
)

var migrations = &migrate.EmbedFileSystemMigrationSource{
Expand Down
2 changes: 1 addition & 1 deletion internal/data/pg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pg
import (
"gitlab.com/distributed_lab/kit/pgdb"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/data"
"github.com/rarimo/verify-proxy/internal/data"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/data/pg/verify_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

sq "github.com/Masterminds/squirrel"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/data"
"github.com/rarimo/verify-proxy/internal/data"
)

type verifyRequestsQ struct {
Expand Down
5 changes: 2 additions & 3 deletions internal/service/api/handlers/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package handlers

import (
"context"
"net/http"

"gitlab.com/distributed_lab/logan/v3"
"net/http"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/core"
"github.com/rarimo/verify-proxy/internal/service/core"
)

type ctxKey int
Expand Down
4 changes: 2 additions & 2 deletions internal/service/api/handlers/verification_callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"gitlab.com/distributed_lab/ape"
"gitlab.com/distributed_lab/ape/problems"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/requests"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/core"
"github.com/rarimo/verify-proxy/internal/service/api/requests"
"github.com/rarimo/verify-proxy/internal/service/core"
)

func VerificationCallback(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/api/handlers/verification_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"gitlab.com/distributed_lab/ape"
"gitlab.com/distributed_lab/ape/problems"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/responses"
"github.com/rarimo/verify-proxy/internal/service/api/responses"
)

func VerificationRequest(w http.ResponseWriter, r *http.Request) {
Expand Down
4 changes: 2 additions & 2 deletions internal/service/api/handlers/verification_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"gitlab.com/distributed_lab/ape"
"gitlab.com/distributed_lab/ape/problems"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/responses"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/core"
"github.com/rarimo/verify-proxy/internal/service/api/responses"
"github.com/rarimo/verify-proxy/internal/service/core"
)

func VerificationResponse(w http.ResponseWriter, r *http.Request) {
Expand Down
9 changes: 4 additions & 5 deletions internal/service/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package api

import (
"context"
"gitlab.com/distributed_lab/logan/v3"
"net"

"github.com/rarimo/verify-proxy/internal/config"
"github.com/rarimo/verify-proxy/internal/service/core"
dbcleaner "github.com/rarimo/verify-proxy/internal/service/core/db_cleaner"
"gitlab.com/distributed_lab/ape"
"gitlab.com/distributed_lab/kit/copus/types"
"gitlab.com/distributed_lab/logan/v3"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/config"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/core"
dbcleaner "gitlab.com/rarimo/polygonid/verify-proxy/internal/service/core/db_cleaner"
)

type service struct {
Expand Down
8 changes: 4 additions & 4 deletions internal/service/api/middleware/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package middleware
import (
"context"
"encoding/json"
"github.com/golang-jwt/jwt/v4"
"net/http"
"strings"
"time"

"github.com/fatih/structs"
"github.com/golang-jwt/jwt/v4"
"github.com/pkg/errors"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/config"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/handlers"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/core"
"github.com/rarimo/verify-proxy/internal/config"
"github.com/rarimo/verify-proxy/internal/service/api/handlers"
"github.com/rarimo/verify-proxy/internal/service/core"
)

func AuthMiddleware(cfg *config.JWT) func(http.Handler) http.Handler {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/api/responses/jwz.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package responses

import "gitlab.com/rarimo/polygonid/verify-proxy/resources"
import "github.com/rarimo/verify-proxy/resources"

func NewJWZ(jwz string) *resources.JwzResponse {
return &resources.JwzResponse{
Expand Down
4 changes: 2 additions & 2 deletions internal/service/api/responses/verification_request.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package responses

import (
//"gitlab.com/rarimo/polygonid/verify-proxy/resources"
//"github.com/rarimo/verify-proxy/resources"

"github.com/google/uuid"

"gitlab.com/rarimo/polygonid/verify-proxy/resources"
"github.com/rarimo/verify-proxy/resources"
)

func NewVerificationID(requestID *uuid.UUID, jwt string) *resources.VerifyIdResponse {
Expand Down
6 changes: 3 additions & 3 deletions internal/service/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/go-chi/chi"
"gitlab.com/distributed_lab/ape"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/handlers"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/middleware"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/requests"
"github.com/rarimo/verify-proxy/internal/service/api/handlers"
"github.com/rarimo/verify-proxy/internal/service/api/middleware"
"github.com/rarimo/verify-proxy/internal/service/api/requests"
)

func (s *service) router() chi.Router {
Expand Down
6 changes: 3 additions & 3 deletions internal/service/core/db_cleaner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"gitlab.com/distributed_lab/logan/v3"
"gitlab.com/distributed_lab/running"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/config"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/data"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/data/pg"
"github.com/rarimo/verify-proxy/internal/config"
"github.com/rarimo/verify-proxy/internal/data"
"github.com/rarimo/verify-proxy/internal/data/pg"
)

type Cleaner interface {
Expand Down
4 changes: 2 additions & 2 deletions internal/service/core/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/google/uuid"
"github.com/pkg/errors"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/data"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/requests"
"github.com/rarimo/verify-proxy/internal/data"
"github.com/rarimo/verify-proxy/internal/service/api/requests"
)

func (v *verifyProxy) NewVerificationRequest() (*uuid.UUID, string, error) {
Expand Down
8 changes: 4 additions & 4 deletions internal/service/core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (

"github.com/google/uuid"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/config"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/data"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/data/pg"
"gitlab.com/rarimo/polygonid/verify-proxy/internal/service/api/requests"
"github.com/rarimo/verify-proxy/internal/config"
"github.com/rarimo/verify-proxy/internal/data"
"github.com/rarimo/verify-proxy/internal/data/pg"
"github.com/rarimo/verify-proxy/internal/service/api/requests"
)

type VerifyProxy interface {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"os"

"gitlab.com/rarimo/polygonid/verify-proxy/internal/cli"
"github.com/rarimo/verify-proxy/internal/cli"
)

func main() {
Expand Down
Loading

0 comments on commit 7d43e9c

Please sign in to comment.