Skip to content

Commit

Permalink
migrate repo
Browse files Browse the repository at this point in the history
  • Loading branch information
mempirate committed Oct 25, 2024
0 parents commit ba13151
Show file tree
Hide file tree
Showing 62 changed files with 8,588 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
reviewers:
- "metachris"
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## 📝 Summary

<!--- A general summary of your changes -->

## ⛱ Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## 📚 References

<!-- Any interesting external links to documentation, articles, tweets which add value to the PR -->

---

## ✅ I have run these commands

* [ ] `make lint`
* [ ] `make test-race`
* [ ] `go mod tidy`
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Linting

on:
push:
branches:
- develop
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21.0
id: go

- name: Ensure go mod tidy runs without changes
run: |
go mod tidy
git diff-index HEAD
git diff-index --quiet HEAD
- name: Install gofumpt
run: go install mvdan.cc/[email protected]

- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/[email protected]

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/[email protected]

- name: Lint
run: make lint
123 changes: 123 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
docker-image:
name: Publish Docker Image
runs-on: ubuntu-latest

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

- name: Get tag version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Print version
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Extract metadata (tags, labels) for Docker images
id: meta
uses: docker/metadata-action@v4
with:
images: flashbots/mev-boost
tags: |
type=sha
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ !contains(env.RELEASE_VERSION, '-') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
build-args: |
VERSION=${{ env.RELEASE_VERSION }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-all:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --skip-publish --config .goreleaser-build.yaml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: mev-boost-build
path: |
dist/mev-boost*.tar.gz
dist/mev-boost*.txt
release:
needs: build-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
- name: Make directories
run: |
mkdir -p ./build
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: mev-boost-build
path: ./build
- name: Merge checksum file
run: |
cd ./build
cat ./mev-boost*checksums.txt >> checksums.txt
rm ./mev-boost*checksums.txt
- name: Release
uses: goreleaser/goreleaser-action@v3
with:
args: release --config .goreleaser-release.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests

on:
push:
branches:
- develop
pull_request:

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
id: go

- name: Checkout sources
uses: actions/checkout@v2

- name: Run unit tests and generate the coverage report
run: make test-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.out
verbose: false
flags: unittests
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# 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/

# Ignore VI/Vim swapfiles
.*.sw?

# IntelliJ
.idea
.ijwb
/mev-boost
/test-cli
/tmp
/dist
.vscode/
/README.internal.md
/validator_data.json
/build/
67 changes: 67 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
linters:
enable-all: true
disable:
- exhaustruct
- funlen
- gochecknoglobals
- gochecknoinits
- gocritic
- godot
- godox
- gomnd
- lll
- nlreturn
- nonamedreturns
- nosnakecase
- paralleltest
- testpackage
- varnamelen
- wrapcheck
- wsl
- musttag
- depguard

#
# Maybe fix later:
#
- cyclop
- gocognit
- goconst
- gosec
- ireturn
- noctx
- tagliatelle

#
# Disabled because of generics:
#
- contextcheck
- rowserrcheck
- sqlclosecheck
- structcheck
- wastedassign

#
# Disabled because deprecated:
#
- deadcode
- exhaustivestruct
- golint
- ifshort
- interfacer
- maligned
- scopelint
- varcheck

linters-settings:
gofumpt:
extra-rules: true
govet:
enable-all: true
disable:
- fieldalignment
- shadow

output:
print-issued-lines: true
sort-results: true
24 changes: 24 additions & 0 deletions .goreleaser-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# https://goreleaser.com/customization/builds/
project_name: mev-boost
builds:
- id: mev-boost
env:
# Force build to be all Go.
- CGO_ENABLED=0
flags:
# Remove all file system paths from the executable.
- -trimpath
ldflags:
# Disables DWARF debugging information.
- -w
# Disables symbol table information.
- -s
# Sets the value of the symbol.
- -X github.com/flashbots/mev-boost/config.Version={{.Version}}
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
12 changes: 12 additions & 0 deletions .goreleaser-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://goreleaser.com/customization/release/
builds:
- skip: true
release:
draft: true
extra_files:
- glob: ./build/*
header: |
# 🚀 Features
# 🎄 Enhancements
# 🐞 Notable bug fixes
# 🎠 Community
Loading

0 comments on commit ba13151

Please sign in to comment.