Skip to content

Commit

Permalink
Merge branch 'master' into 1085-restructure-foundry-contract-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinThai committed Feb 16, 2024
2 parents 309742b + 1c4d022 commit 67ab720
Show file tree
Hide file tree
Showing 272 changed files with 7,487 additions and 5,099 deletions.
5 changes: 1 addition & 4 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
* @Bisonai/blockchain
admin/ @joeybisonai
monitor/ @Bisonai/infra
docker-compose.* @Bisonai/infra
* @Bisonai/orakl-team
27 changes: 26 additions & 1 deletion .github/workflows/api.image+upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
- name: Get package version
id: package
run: |
echo "version=$(node -p -e "require('./api/package.json').version")" >> $GITHUB_OUTPUT
version=$(cat "./api/.version")
echo "version=${version}" >> $GITHUB_OUTPUT
build:
name: Build
Expand All @@ -51,6 +52,30 @@ jobs:
steps:
- uses: actions/checkout@v3

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

- name: Run Vet
run: |
cd ./api
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
go vet
go vet -vettool=$(which shadow)
- name: Docker build orakl-api
run: SERVICE_NAME=orakl-api docker-compose -f docker-compose.build.yaml build

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: "api: test+build"
name: "api: test"

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

jobs:
core-build:
Expand Down Expand Up @@ -38,26 +39,36 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
node-version: "20.10.0"
go-version: "1.21.5"
check-latest: true
cache-dependency-path: |
./api/go.sum
- 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 ./api
migrate -database "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public&sslmode=disable" -verbose -path ./migrations up
- name: Install dependencies
run: yarn api install
- name: Run eslint
run: yarn api lint
run: |
cd ./api
go mod tidy
- name: Build
run: |
cd ./api
go build
- name: Run test
run: |
yarn api prisma-migrate dev --name init
yarn api test
cd ./api
go test ./tests -v
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl-test?schema=public"
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public"
ENCRYPT_PASSWORD: "abc123"
REDIS_HOST: "localhost"
REDIS_PORT: "6379"

- name: Run e2e2 test
run: yarn api test:e2e --forceExit
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl-test?schema=public"
- name: Build package
run: yarn api build
TEST_MODE: true
32 changes: 26 additions & 6 deletions .github/workflows/cli.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,36 @@ jobs:
with:
node-version: "20.10.0"

- name: Install dependencies
- name: Install yarn dependencies
run: yarn install

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21.5"
check-latest: true
cache-dependency-path: |
./api/go.sum
- 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: Install api dependencies
run: |
cd ./api
go mod tidy
- name: Delegator db migrate
run: yarn delegator prisma-migrate dev --name init-delegator
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/delegator?schema=public"

- name: Api db migrate
run: yarn api prisma-migrate dev --name init-api
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl?schema=public"
run: |
cd ./api
migrate -database "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public&sslmode=disable" -verbose -path ./migrations up
- name: Run delegator
run: yarn delegator build && yarn delegator start &
Expand All @@ -64,9 +82,11 @@ jobs:
APP_PORT: "3002"

- name: Run api
run: yarn api build && yarn api start &
run: |
cd ./api
go run main.go &
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl?schema=public"
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public"
ENCRYPT_PASSWORD: "abc123"
APP_PORT: "3000"
REDIS_HOST: "localhost"
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/vrf.integration.test.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: "vrf: integration-test"

on:
issue_comment:
types: [created, edited, deleted]
push:
branches-ignore:
- "master"
paths:
- "contracts-v0.1/**/VRFCoordinator.sol"
- "contracts-v0.1/**/VRFConsumerBase.sol"
- "contracts-v0.1/**/vrf/**"

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
contracts/scripts/**/tmp
yarn-error.log
dockerfiles/local-data-feed/tmp/**
.DS_Store
dockerfiles/local-data-feed/tmp/**
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "contracts-v0.2/lib/openzeppelin-contracts"]
path = contracts-v0.2/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "contracts-v0.2/lib/solidity-stringutils"]
path = contracts-v0.2/lib/solidity-stringutils
url = https://github.com/Arachnid/solidity-stringutils
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Bisonai
Copyright (c) 2023-2024 Bisonai

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 4 additions & 5 deletions api/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DATABASE_URL=
APP_PORT=
ENCRYPT_PASSWORD=

# Redis
DATABASE_URL=
REDIS_HOST=
REDIS_PORT=
REDIS_PORT=
TEST_MODE=
ENCRYPT_PASSWORD=
11 changes: 5 additions & 6 deletions api/.env.local
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DATABASE_URL=postgresql://${USER}@localhost:5432/orakl?schema=public
APP_PORT=3000
ENCRYPT_PASSWORD=anything

# Redis
APP_PORT=3111
DATABASE_URL=postgresql://${USER}@localhost:5432/orakl?search_path=public
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PORT=6379
TEST_MODE=true
ENCRYPT_PASSWORD=anything
25 changes: 0 additions & 25 deletions api/.eslintrc.js

This file was deleted.

50 changes: 18 additions & 32 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
# compiled output
dist
node_modules
.env
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Test binary, built with `go test -c`
*.test

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

# Tests
/coverage
/.nyc_output
# Dependency directories (remove the comment below to include it)
# vendor/

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# Go workspace file
go.work
.env
8 changes: 0 additions & 8 deletions api/.prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions api/.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
Loading

0 comments on commit 67ab720

Please sign in to comment.