Skip to content

Commit ee6f064

Browse files
authored
feat: Blob Syncer (#1)
1 parent 3f26f32 commit ee6f064

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6809
-1
lines changed

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Report a bug
3+
about: Something with blob-syncer is not working as expected
4+
title: ''
5+
labels: 'type:bug'
6+
assignees: ''
7+
---
8+
9+
#### System information
10+
11+
Blob syncer version: (if getting from release page)
12+
OS & Version: Windows/Linux/OSX
13+
Commit hash : (if `develop`)
14+
15+
#### Expected behaviour
16+
17+
18+
#### Actual behaviour
19+
20+
21+
#### Steps to reproduce the behaviour
22+
23+
24+
#### Backtrace
25+
26+
````
27+
[backtrace]
28+
````
29+
30+
When submitting logs: please submit them as text and not screenshots.

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Request a feature
3+
about: Report a missing feature - e.g. as a step before submitting a PR
4+
title: ''
5+
labels: 'type:feature'
6+
assignees: ''
7+
---
8+
9+
# Rationale
10+
11+
Why should this feature exist?
12+
What are the use-cases?
13+
14+
# Implementation
15+
16+
Do you have ideas regarding the implementation of this feature?
17+
Are you willing to implement this feature?

.github/ISSUE_TEMPLATE/question.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: Ask a question
3+
about: Something is unclear
4+
title: ''
5+
labels: 'type:docs'
6+
assignees: ''
7+
---
8+
9+
This should only be used in very rare cases e.g. if you are not 100% sure if something is a bug or asking a question that leads to improving the documentation. For general questions please use [discord](https://discord.gg/bnbchain).

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### Description
2+
3+
add a description of your changes here...
4+
5+
### Rationale
6+
7+
tell us why we need these changes...
8+
9+
### Example
10+
11+
add an example CLI or API response...
12+
13+
### Changes
14+
15+
Notable changes:
16+
* add each change in a bullet point here
17+
* ...

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
9+
pull_request:
10+
branches:
11+
- master
12+
- develop
13+
14+
jobs:
15+
build-test:
16+
strategy:
17+
matrix:
18+
go-version: [1.20.x]
19+
os: [ubuntu-latest]
20+
runs-on: ${{ matrix.os }}
21+
env:
22+
GOPRIVATE: github.com/bnb-chain
23+
GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }}
24+
steps:
25+
- name: Install Go
26+
uses: actions/setup-go@v3
27+
with:
28+
go-version: ${{ matrix.go-version }}
29+
30+
- name: Checkout code
31+
uses: actions/checkout@v3
32+
33+
- uses: actions/cache@v3
34+
with:
35+
# In order:
36+
# * Module download cache
37+
# * Build cache (Linux)
38+
# * Build cache (Mac)
39+
# * Build cache (Windows)
40+
path: |
41+
~/go/pkg/mod
42+
~/.cache/go-build
43+
~/Library/Caches/go-build
44+
%LocalAppData%\go-build
45+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
46+
restore-keys: |
47+
${{ runner.os }}-go-
48+
49+
- name: Setup GitHub Token
50+
run: git config --global url.https://[email protected]/.insteadOf https://github.com/
51+
52+
- name: Test Build
53+
run: |
54+
make build

.github/workflows/docker-release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
# Publish `v1.2.3` tags as releases.
6+
tags:
7+
- v*
8+
9+
env:
10+
IMAGE_NAME: ghcr.io/${{ github.repository }}
11+
IMAGE_SOURCE: https://github.com/${{ github.repository }}
12+
13+
jobs:
14+
# Push image to GitHub Packages.
15+
push:
16+
runs-on: ubuntu-latest
17+
if: github.event_name == 'push'
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Build image
23+
run: |
24+
docker build . \
25+
--label "org.opencontainers.image.source=${IMAGE_SOURCE}" \
26+
--label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
27+
--label "org.opencontainers.image.version=$(git describe --tags --abbrev=0)" \
28+
-f ./server-distroless.dockerfile -t "${IMAGE_NAME}:server-distroless"
29+
30+
docker build . \
31+
--label "org.opencontainers.image.source=${IMAGE_SOURCE}" \
32+
--label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
33+
--label "org.opencontainers.image.version=$(git describe --tags --abbrev=0)" \
34+
-f ./syncer-distroless.dockerfile -t "${IMAGE_NAME}:syncer-distroless"
35+
36+
- name: Login to GHCR
37+
uses: docker/login-action@v2
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.repository_owner }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Push image
44+
run: |
45+
# Strip git ref prefix from version
46+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
47+
# Strip "v" prefix from tag name
48+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
49+
# Use Docker `latest` tag convention
50+
[ "$VERSION" == "master" ] && VERSION=latest
51+
echo IMAGE_NAME=$IMAGE_NAME
52+
echo VERSION=$VERSION
53+
docker tag ${IMAGE_NAME}:server-distroless $IMAGE_NAME:$VERSION-server-distroless
54+
docker tag ${IMAGE_NAME}:syncer-distroless $IMAGE_NAME:$VERSION-syncer-distroless
55+
docker push $IMAGE_NAME:$VERSION-server-distroless
56+
docker push $IMAGE_NAME:$VERSION-syncer-distroless

.github/workflows/gosec.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: gosec
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
branches:
10+
- master
11+
- develop
12+
jobs:
13+
gosec:
14+
name: gosec
15+
strategy:
16+
matrix:
17+
go-version: [1.20.x]
18+
os: [ubuntu-latest]
19+
runs-on: ${{ matrix.os }}
20+
env:
21+
GOPRIVATE: github.com/bnb-chain
22+
GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }}
23+
steps:
24+
- uses: actions/setup-go@v3
25+
with:
26+
go-version: ${{ matrix.go-version }}
27+
- uses: actions/checkout@v3
28+
- name: Setup GitHub Token
29+
run: git config --global url.https://[email protected]/.insteadOf https://github.com/
30+
- uses: actions/cache@v3
31+
with:
32+
# In order:
33+
# * Module download cache
34+
# * Build cache (Linux)
35+
# * Build cache (Mac)
36+
# * Build cache (Windows)
37+
path: |
38+
~/go/pkg/mod
39+
~/.cache/go-build
40+
~/Library/Caches/go-build
41+
%LocalAppData%\go-build
42+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
43+
restore-keys: |
44+
${{ runner.os }}-go-
45+
- run: |
46+
go mod tidy
47+
go mod download
48+
- name: Run Gosec Security Scanner
49+
uses: securego/gosec@master
50+
with:
51+
args: -quiet -confidence high -severity high ./...

.github/workflows/lint-pr.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Lint PR"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/action-semantic-pull-request@v5
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
17+
with:
18+
types: |
19+
feat
20+
fix
21+
docs
22+
style
23+
refactor
24+
perf
25+
test
26+
build
27+
ci
28+
chore
29+
revert
30+
release

.github/workflows/lint.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Lint
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- develop
7+
pull_request:
8+
permissions:
9+
contents: read
10+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
11+
# pull-requests: read
12+
jobs:
13+
golangci:
14+
name: golangci-lint
15+
strategy:
16+
matrix:
17+
go-version: [1.20.x]
18+
os: [ubuntu-latest]
19+
runs-on: ${{ matrix.os }}
20+
env:
21+
GOPRIVATE: github.com/bnb-chain
22+
steps:
23+
- uses: actions/setup-go@v3
24+
with:
25+
go-version: ${{ matrix.go-version }}
26+
- uses: actions/checkout@v3
27+
28+
- run: go env -w GOPRIVATE="github.com/bnb-chain/*"
29+
- run: git config --global url."https://${{ secrets.GH_TOKEN }}@github.com".insteadOf "https://github.com"
30+
31+
- uses: actions/cache@v3
32+
with:
33+
# In order:
34+
# * Module download cache
35+
# * Build cache (Linux)
36+
# * Build cache (Mac)
37+
# * Build cache (Windows)
38+
path: |
39+
~/go/pkg/mod
40+
~/.cache/go-build
41+
~/Library/Caches/go-build
42+
%LocalAppData%\go-build
43+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
44+
restore-keys: |
45+
${{ runner.os }}-go-
46+
- run: |
47+
go mod tidy
48+
go mod download
49+
- name: golangci-lint
50+
uses: golangci/golangci-lint-action@v3
51+
with:
52+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
53+
version: latest
54+
skip-pkg-cache: true
55+
args: --timeout=99m

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
.idea/*
3+
build/*
4+
.local
5+
/temp/
6+
/config/local/

0 commit comments

Comments
 (0)