-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdb952e
commit 863a5c9
Showing
245 changed files
with
34,321 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
POSTGRES_HOST=127.0.0.1 | ||
POSTGRES_PORT=5432 | ||
POSTGRES_DB=astria | ||
POSTGRES_USER=<TODO_INSERT> | ||
POSTGRES_PASSWORD=<TODO_INSERT> | ||
LOG_LEVEL=info | ||
API_HOST=127.0.0.1 | ||
API_PORT=9876 | ||
API_RATE_LIMIT=20 | ||
API_PROMETHEUS_ENABLED=true | ||
API_REQUEST_TIMEOUT=10 | ||
SEQUENCER_RPC_URL=https://rpc.sequencer.dusk-2.devnet.astria.org/ | ||
SEQUENCER_RPC_RPS=10 | ||
SEQUENCER_RPC_TIMEOUT=10 | ||
INDEXER_THREADS_COUNT=5 | ||
INDEXER_BLOCK_PERIOD=12 | ||
INDEXER_VIEWS_DIR=../../database/views | ||
INDEXER_SCRIPTS_DIR=../../database | ||
PROFILER_SERVER=http://localhost:4040 | ||
ASTRIA_ENV=development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
go.sum merge=union | ||
cmd/api/docs/* linguist-generated=true | ||
**/mock/* linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'v*.*.*' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
DOCKER_REGISTRY: ghcr.io | ||
DOCKER_IMAGE_BASE: ${{ github.repository }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Indexer | ||
|
||
- name: Indexer image tags & labels | ||
id: meta-indexer | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }} | ||
|
||
- name: Indexer image build & push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: build/indexer/Dockerfile | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: ${{ steps.meta-indexer.outputs.tags }} | ||
labels: ${{ steps.meta-indexer.outputs.labels }} | ||
|
||
# API | ||
|
||
- name: API image tags & labels | ||
id: meta-api | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-api | ||
|
||
- name: API image build & push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: build/api/Dockerfile | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: ${{ steps.meta-api.outputs.tags }} | ||
labels: ${{ steps.meta-api.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#on: pull_request | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
license-check: | ||
runs-on: ubuntu-latest | ||
name: License Check | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: LavyshAlexander/go-licenses-action@46ff6dea75572b9eb60f6ccb7b600e959b79047c | ||
with: | ||
allowed-licenses: MIT,Apache-1.0,Apache-1.1,Apache-2.0,BSD-2-Clause-FreeBSD,BSD-2-Clause-NetBSD,BSD-2-Clause,BSD-3-Clause-Attribution,BSD-3-Clause-Clear,BSD-3-Clause-LBNL,BSD-3-Clause,BSD-4-Clause,BSD-4-Clause-UC,BSD-Protection,ISC,LGPL-2.0,LGPL-2.1,LGPL-3.0,LGPLLR,MPL-1.0,MPL-1.1,MPL-2.0,Unlicense | ||
ignore: github.com/ethereum/go-ethereum,github.com/regen-network/cosmos-proto,github.com/modern-go/reflect2,golang.org/x/sys/unix,mellium.im/sasl,github.com/klauspost/compress/zstd/internal/xxhash,github.com/mattn/go-sqlite3,github.com/cespare/xxhash/v2,github.com/klauspost/reedsolomon,github.com/klauspost/cpuid/v2,filippo.io/edwards25519/field,github.com/golang/snappy,golang.org/x/crypto/chacha20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Pre-release | ||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' | ||
|
||
jobs: | ||
pre-release: | ||
name: Pre-release | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} | ||
|
||
- name: Publish GitHub release | ||
uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: true | ||
|
||
sentry: | ||
name: Sentry release | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} | ||
|
||
- name: Create Sentry release | ||
uses: getsentry/action-release@v1 | ||
env: | ||
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" | ||
SENTRY_ORG: "${{ secrets.SENTRY_ORG }}" | ||
SENTRY_PROJECT: "${{ secrets.SENTRY_PROJECT }}" | ||
SENTRY_URL: "${{ secrets.SENTRY_URL }}" | ||
with: | ||
environment: production | ||
version: "${{ env.RELEASE_VERSION }}" | ||
ignore_empty: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} | ||
|
||
- name: Publish GitHub release | ||
uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
|
||
sentry: | ||
name: Sentry release | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} | ||
|
||
- name: Create Sentry release | ||
uses: getsentry/action-release@v1 | ||
env: | ||
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" | ||
SENTRY_ORG: "${{ secrets.SENTRY_ORG }}" | ||
SENTRY_PROJECT: "${{ secrets.SENTRY_PROJECT }}" | ||
SENTRY_URL: "${{ secrets.SENTRY_URL }}" | ||
with: | ||
environment: production | ||
version: "${{ env.RELEASE_VERSION }}" | ||
ignore_empty: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
on: | ||
push: | ||
|
||
name: Tests | ||
jobs: | ||
golangci: | ||
name: Linter | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.2' | ||
cache: false | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.54.1 | ||
args: --timeout=5m | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21.x | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Golang tests | ||
env: | ||
GO111MODULE: on | ||
run: | | ||
go mod download | ||
go test -p 8 ./... | ||
- name: Update coverage report | ||
uses: ncruces/[email protected] | ||
with: | ||
report: 'true' | ||
chart: 'true' | ||
amend: 'true' | ||
reuse-go: 'true' | ||
continue-on-error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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 | ||
bin | ||
.DS_Store | ||
|
||
# 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/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
*.env | ||
|
||
# IDE and other 3rd party tools | ||
.idea | ||
*.private.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
linters: | ||
enable: | ||
- goconst | ||
- gocritic | ||
- gofmt | ||
- govet | ||
- prealloc | ||
- unconvert | ||
- unused | ||
- errcheck | ||
- ineffassign | ||
- containedctx | ||
- tenv | ||
- musttag | ||
- mirror | ||
- tagalign | ||
- zerologlint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SPDX-FileCopyrightText: 2024 PK Lab AG <[email protected]> | ||
SPDX-License-Identifier: MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-include .env | ||
export $(shell sed 's/=.*//' .env) | ||
|
||
|
||
indexer: | ||
cd cmd/indexer && go run . -c ../../configs/dipdup.yml | ||
|
||
api: | ||
cd cmd/api && go run . -c ../../configs/dipdup.yml | ||
|
||
generate: | ||
go generate -v ./internal/storage ./internal/storage/types ./pkg/node | ||
|
||
lint: | ||
golangci-lint run | ||
|
||
test: | ||
go test -p 8 -timeout 60s ./... | ||
|
||
cover: | ||
go test ./... -coverpkg=./... -coverprofile ./coverage.out | ||
go tool cover -func ./coverage.out | ||
|
||
api-docs: | ||
cd cmd/api && swag init --md markdown -parseDependency --parseInternal --parseDepth 1 | ||
|
||
ga: | ||
go generate -v ./internal/storage ./internal/storage/types ./pkg/node | ||
cd cmd/api && swag init --md markdown -parseDependency --parseInternal --parseDepth 1 | ||
|
||
license-header: | ||
update-license -path=./ -license=./HEADER | ||
|
||
.PHONY: indexer api generate test lint cover api-docs ga license-header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Astria Indexer |
Oops, something went wrong.