Skip to content

Commit

Permalink
Merge pull request #443 from rsksmart/QA-Test
Browse files Browse the repository at this point in the history
[Qa test -> Stable-Test] - LPS v2.0.0-rc
  • Loading branch information
Luisfc68 authored Jul 25, 2024
2 parents 812e96d + a634019 commit 7978ac1
Show file tree
Hide file tree
Showing 421 changed files with 67,421 additions and 13,713 deletions.
12 changes: 12 additions & 0 deletions .commitlint/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

if ! type commitlint >/dev/null 2>/dev/null; then
echo ""
echo "commitlint could not be found"
echo "try again after installing commitlint or add commitlint to PATH"
echo ""
exit 2;
fi

commitlint lint --message $1

4 changes: 4 additions & 0 deletions .commitlint/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

make lint || exit 1
make test
34 changes: 34 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CD for flyover-api dev

on:
push:
branches:
- QA-Test

jobs:
execute-command:
runs-on: ubuntu-latest
environment: dev
permissions:
id-token: write
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.DEV_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Execute deployment command on EC2 instance
run: |
aws ssm send-command \
--document-name "deployBEDevDocument" \
--instance-ids "$INSTANCE_ID" \
--document-version '$LATEST'
echo "Deploy sent to EC2 instance"
env:
INSTANCE_ID: ${{ secrets.DEV_INSTANCE_ID }}
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
pwd.txt
/docker-compose/volumes
/docker-compose/.env.testnet
integration/integration-test.config.json
test/integration/integration-test.config.json
integration/geth_keystore

/docker-compose/lbc-deployer/liquidity-bridge-contract/
keystore/
build/
/**/.env.regtest
/**/gh_token.txt
!sample-config.env
/**/*.env
/**/.env*
15 changes: 15 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
run:
allow-parallel-runners: true
timeout: 3m
tests: true
skip-dirs:
- internal/adapters/dataproviders/rootstock/bindings
linters:
presets:
- bugs
- complexity
- unused
- performance
linters-settings:
exhaustive:
default-signifies-exhaustive: true
49 changes: 49 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
with-expecter: true
dir: test/mocks
filename: "{{ .InterfaceName | snakecase }}_mock.go"
mockname: "{{ .InterfaceName | firstUpper }}Mock"
outpkg: mocks
packages:
github.com/rsksmart/liquidity-provider-server/internal/configuration/bootstrap/wallet:
interfaces:
AbstractFactory:
github.com/rsksmart/liquidity-provider-server/internal/adapters/alerting:
interfaces:
sesClient:
github.com/rsksmart/liquidity-provider-server/internal/adapters/dataproviders/rootstock:
interfaces:
LbcBinding:
RskBridgeBinding:
TransactionSigner:
RpcClientBinding:
LbcCallerBinding:
LbcAdapter:
EventIteratorAdapter:
RskSignerWallet:
github.com/rsksmart/liquidity-provider-server/internal/adapters/dataproviders/database/mongo:
interfaces:
DbClientBinding:
DbBinding:
CollectionBinding:
SessionBinding:
github.com/rsksmart/liquidity-provider-server/internal/adapters/dataproviders/bitcoin/btcclient:
interfaces:
RpcClient:
ClientAdapter:
github.com/rsksmart/liquidity-provider-server/internal/usecases/liquidity_provider:
interfaces:
DefaultCredentialsProvider:
github.com/rsksmart/liquidity-provider-server/internal/entities/liquidity_provider:
interfaces:
LiquidityProviderRepository:
github.com/rsksmart/liquidity-provider-server/internal/entities/quote:
interfaces:
PeginQuoteRepository:
PegoutQuoteRepository:
github.com/rsksmart/liquidity-provider-server/internal/entities/blockchain:
interfaces:
BitcoinWallet:
RootstockRpcServer:
github.com/rsksmart/liquidity-provider-server/internal/adapters/dataproviders/utils:
interfaces:
HttpClient:
32 changes: 0 additions & 32 deletions Dockerfile

This file was deleted.

65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.PHONY: test

COVER_FILE = coverage/cover.out
TEMPORAL_COVER_FILE =$(shell pwd)/coverage/cover.out.temp

filter_coverage_file = grep -v "internal/adapters/dataproviders/rootstock/bindings" $(1) > coverage/temp.txt && mv coverage/temp.txt $(1)

tools: download
go install github.com/parvez3019/go-swagger3@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/conventionalcommit/commitlint@latest
go env GOPATH
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.55.2
# installation with brew is because mockery team doesnt recommend to install with go install,
# if you don't have brew feel free to comment this line and install mockery with other method
brew install mockery && brew upgrade mockery

download:
go mod download

lint:
test -z $(shell gofmt -l .)
golangci-lint run -v ./...

validation: lint
go mod verify
govulncheck ./... # should fail on non informational vulnerabilities

COMMIT_HASH ?= $(shell git rev-parse HEAD)
SOURCE_VERSION := $(COMMIT_HASH)
build: download
mkdir -p build && cd build
@echo "Building liquidity-provider-server $(SOURCE_VERSION)"
CGO_ENABLED=0 go build -v -installsuffix 'static' -ldflags="-s -X 'main.BuildVersion=$(SOURCE_VERSION)' -X 'main.BuildTime=$(shell date)'" -o ./build/liquidity-provider-server ./cmd/application/main.go

api:
go-swagger3 --module-path . \
--main-file-path ./cmd/application/main.go \
--handler-path ./internal/adapters/entrypoints/rest/handlers \
--output OpenApi.yml \
--schema-without-pkg \
--generate-yaml true

coverage: clean
mkdir -p coverage
go test -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(TEMPORAL_COVER_FILE) ./pkg/... ./internal/... ./cmd/...
$(call filter_coverage_file, $(TEMPORAL_COVER_FILE))
go tool cover -func "$(TEMPORAL_COVER_FILE)"
go tool cover -html="$(TEMPORAL_COVER_FILE)"
rm $(TEMPORAL_COVER_FILE)

coverage-report: clean
mkdir -p coverage
go test -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(COVER_FILE) ./pkg/... ./internal/... ./cmd/...
$(call filter_coverage_file, $(COVER_FILE))

test: clean
mkdir -p coverage
go test -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(TEMPORAL_COVER_FILE) ./pkg/... ./internal/... ./cmd/...
$(call filter_coverage_file, $(TEMPORAL_COVER_FILE))
go tool cover -func $(TEMPORAL_COVER_FILE)
rm $(TEMPORAL_COVER_FILE)

clean:
rm -rf build $(TEMPORAL_COVER_FILE)
Loading

0 comments on commit 7978ac1

Please sign in to comment.