Skip to content

Commit

Permalink
update main
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-bisonai committed May 27, 2024
2 parents d65c92a + 4e28a3c commit 929d5d2
Show file tree
Hide file tree
Showing 228 changed files with 32,278 additions and 316 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/boot-api.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "orakl boot api test"

on:
push:
branches-ignore:
- "master"
paths:
- "node/pkg/boot/**"
- "node/migrations/boot/**"
workflow_dispatch:

jobs:
core-build:
strategy:
fail-fast: false
runs-on: ubuntu-latest
timeout-minutes: 10

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: orakl-test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.22.3"
check-latest: true
cache-dependency-path: |
./node/go.sum
- name: Run lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
working-directory: node/pkg/boot
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=10m

- name: Run Vet
run: |
cd ./node/pkg/boot
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
go vet ./...
go vet -vettool=$(which shadow) ./...
- name: Install golang-migrate
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.17.0/migrate.linux-amd64.tar.gz | tar xvz
sudo mv ./migrate /usr/bin
- name: Migrate up
run: |
cd ./node
migrate -database "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public&sslmode=disable" -verbose -path ./migrations/boot up
- name: Install dependencies
run: |
cd ./node
go mod tidy
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run test
run: |
cd ./node
task local:test-boot
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public"
3 changes: 2 additions & 1 deletion .github/workflows/node.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Migrate up
run: |
cd ./node
migrate -database "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public&sslmode=disable" -verbose -path ./migrations up
migrate -database "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public&sslmode=disable" -verbose -path ./migrations/node up
- name: Install dependencies
run: |
Expand All @@ -94,6 +94,7 @@ jobs:
REDIS_HOST: "localhost"
REDIS_PORT: "6379"
ENCRYPT_PASSWORD: "anything"
FETCHER_CYPRESS_PROVIDER_URL: "https://klaytn-mainnet-rpc.allthatnode.com:8551"
KLAYTN_PROVIDER_URL: "https://api.baobab.klaytn.net:8651"
KLAYTN_REPORTER_PK: ${{ secrets.TEST_DELEGATOR_REPORTER_PK}}
ETH_PROVIDER_URL: "https://ethereum-sepolia-rpc.allthatnode.com"
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/sentinel.image+upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: sentinel deploy to Amazon ECR

on:
push:
branches:
- master
paths:
- "sentinel/**"
workflow_dispatch:

env:
ecr_url: public.ecr.aws/bisonai/orakl-sentinel

jobs:
prepare:
name: Prepare Build
runs-on: ubuntu-latest

outputs:
tag_date: ${{ steps.tag.outputs.date }}
tag_git_hash: ${{ steps.tag.outputs.git_hash }}

steps:
- uses: actions/checkout@v3
- name: Get time TAG
id: tag
run: |
echo "date=$(date -u +'%Y%m%d.%H%M')" >> $GITHUB_OUTPUT
echo "git_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
build:
name: Build
runs-on: ubuntu-latest
needs: prepare

permissions:
id-token: write
contents: read

outputs:
tag_date: ${{ steps.tag.outputs.date }}
tag_git_hash: ${{ steps.tag.outputs.git_hash }}

steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.22.3"
check-latest: true
cache-dependency-path: |
./sentinel/go.sum
./sentinel/go.mod
- name: Docker build orakl-sentinel
run: SERVICE_NAME=orakl-sentinel docker compose -f docker-compose.build.yaml build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.ROLE_ARN }}

- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public

- name: Publish Image to ECR(sentinel)
run: |
docker tag orakl-sentinel ${{ env.ecr_url }}:latest
docker push ${{ env.ecr_url }}:latest
docker tag ${{ env.ecr_url }}:latest ${{ env.ecr_url }}:v0.0.1.${{ needs.prepare.outputs.tag_date }}.${{ needs.prepare.outputs.tag_git_hash }}
docker push ${{ env.ecr_url }}:v0.0.1.${{ needs.prepare.outputs.tag_date }}.${{ needs.prepare.outputs.tag_git_hash }}
71 changes: 71 additions & 0 deletions .github/workflows/sentinel.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "orakl sentinel test"

on:
push:
branches-ignore:
- "master"
paths:
- "sentinel/**"
workflow_dispatch:

jobs:
core-build:
strategy:
fail-fast: false
runs-on: ubuntu-latest
timeout-minutes: 10

services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.22.3"
check-latest: true
cache-dependency-path: |
./sentinel/go.sum
- name: Run lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
working-directory: sentinel
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=10m

- name: Run Vet
run: |
cd ./sentinel
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
go vet ./...
go vet -vettool=$(which shadow) ./...
- name: Install dependencies
run: |
cd ./sentinel
go mod tidy
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run test
run: |
cd ./sentinel
task test
env:
CHAIN: "baobab"
JSON_RPC_URL: "https://klaytn-baobab-rpc.allthatnode.com:8551"
1 change: 1 addition & 0 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/jackc/pgx/v5 v5.5.2
github.com/joho/godotenv v1.5.1
github.com/redis/go-redis/v9 v9.3.1
github.com/rs/zerolog v1.32.0
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.19.0
)
Expand Down
8 changes: 8 additions & 0 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -43,6 +44,7 @@ github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqR
github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofiber/fiber/v2 v2.52.0 h1:S+qXi7y+/Pgvqq4DrSmREGiFwtB7Bu6+QFLuIHYw/UE=
github.com/gofiber/fiber/v2 v2.52.0/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
Expand Down Expand Up @@ -112,6 +114,7 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
Expand All @@ -123,6 +126,7 @@ github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUb
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
Expand All @@ -132,6 +136,9 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
Expand Down Expand Up @@ -192,6 +199,7 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
Expand Down
Loading

0 comments on commit 929d5d2

Please sign in to comment.