-
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
Showing
41 changed files
with
16,926 additions
and
0 deletions.
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,29 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.rs] | ||
max_line_length = 100 | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
# double whitespace at end of line | ||
# denotes a line break in Markdown | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[] |
Validating CODEOWNERS rules …
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,5 @@ | ||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# they will be requested for review when someone opens a pull request. | ||
* @dvush @ZanCorDX @metachris @jakubhruby7 | ||
/crates/ @dvush @ZanCorDX |
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,14 @@ | ||
# 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: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
# ignore: | ||
# # These are peer deps of Cargo and should not be automatically bumped | ||
# - dependency-name: "semver" | ||
# - dependency-name: "crates-io" | ||
# rebase-strategy: "disabled" |
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,73 @@ | ||
name: Checks | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
merge_group: | ||
push: | ||
branches: [main] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
lint_and_test: | ||
name: Lint and test | ||
runs-on: warp-ubuntu-latest-x64-16x | ||
strategy: | ||
matrix: | ||
toolchain: | ||
- stable | ||
#- beta | ||
#- nightly | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
# https://github.com/dtolnay/rust-toolchain | ||
- name: Setup rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v3 | ||
|
||
# https://github.com/WarpBuilds/rust-cache | ||
- name: Run WarpBuilds/rust-cache | ||
uses: WarpBuilds/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
|
||
# https://github.com/Mozilla-Actions/sccache-action | ||
- name: Run sccache-action | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Set sccache env vars | ||
run: | | ||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
- name: Install native dependencies | ||
run: sudo apt-get install -y libsqlite3-dev | ||
|
||
####################################################### | ||
### This is required while rbuilder repo is private ### | ||
####################################################### | ||
|
||
# https://github.com/webfactory/ssh-agent | ||
- name: Give GitHub Actions access to rbuilder-private | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.RBUILDER_PRIVATE_DEPLOY_KEY }} | ||
|
||
- name: Configure Git to use deploy key | ||
run: | | ||
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV | ||
git config --global url."ssh://[email protected]".insteadOf "https://github.com" | ||
####################################################### | ||
|
||
# lint and test | ||
- run: make lint | ||
- run: make test |
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,253 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
inputs: | ||
# build-docker: | ||
# description: 'Build Docker' | ||
# required: false | ||
# type: boolean | ||
# default: false | ||
build-binary: | ||
description: 'Build Binary' | ||
required: false | ||
type: boolean | ||
default: true | ||
draft-release: | ||
description: 'Draft Release' | ||
required: false | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
# | ||
# extract-version extracts the version from the tag or the branch name, | ||
# for reuse in later jobs | ||
# | ||
extract-version: | ||
name: Extract version | ||
runs-on: warp-ubuntu-latest-x64-16x | ||
outputs: | ||
VERSION: ${{ steps.extract_version.outputs.VERSION }} | ||
steps: | ||
- name: Extract version | ||
id: extract_version | ||
run: | | ||
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | ||
VERSION="${GITHUB_REF#refs/tags/}" | ||
else | ||
SHA_SHORT="$(echo ${GITHUB_SHA} | cut -c1-7)" | ||
BRANCH_NAME_SAFE="${GITHUB_REF_NAME//\//-}" # replaces "/" in branch name with "-" | ||
VERSION="${BRANCH_NAME_SAFE}-${SHA_SHORT}" | ||
fi | ||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
echo "${VERSION}" | ||
echo "### Version: \`${VERSION}\`" >> $GITHUB_STEP_SUMMARY | ||
echo "| | |" >> $GITHUB_STEP_SUMMARY | ||
echo "| ------------------- | ---------------------- |" >> $GITHUB_STEP_SUMMARY | ||
echo "| \`GITHUB_REF_TYPE\` | \`${GITHUB_REF_TYPE}\` |" >> $GITHUB_STEP_SUMMARY | ||
echo "| \`GITHUB_REF_NAME\` | \`${GITHUB_REF_NAME}\` |" >> $GITHUB_STEP_SUMMARY | ||
echo "| \`GITHUB_REF\` | \`${GITHUB_REF}\` |" >> $GITHUB_STEP_SUMMARY | ||
echo "| \`GITHUB_SHA\` | \`${GITHUB_SHA}\` |" >> $GITHUB_STEP_SUMMARY | ||
echo "| \`VERSION\` | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY | ||
# | ||
# build-binary builds a release binary for a variety of platforms | ||
# | ||
build-binary: | ||
name: Build binary | ||
needs: extract-version | ||
if: ${{ github.event.inputs.build-binary == 'true' || github.event_name == 'push'}} # when manually triggered or version tagged | ||
runs-on: ${{ matrix.configs.runner }} | ||
env: | ||
VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
permissions: | ||
contents: write | ||
packages: write | ||
strategy: | ||
matrix: | ||
configs: | ||
- target: x86_64-unknown-linux-gnu | ||
runner: warp-ubuntu-latest-x64-16x | ||
- target: aarch64-apple-darwin | ||
runner: warp-macos-14-arm64-6x | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
# https://github.com/dtolnay/rust-toolchain | ||
- name: Setup rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
target: ${{ matrix.configs.target }} | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v3 | ||
|
||
# https://github.com/WarpBuilds/rust-cache | ||
- name: Run WarpBuilds/rust-cache | ||
uses: WarpBuilds/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
|
||
# https://github.com/Mozilla-Actions/sccache-action | ||
- name: Setup sccache-action | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Set env vars | ||
run: | | ||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
- name: Prepare output filename | ||
run: | | ||
OUTPUT_FILENAME="rbuilder-${VERSION}-${{ matrix.configs.target }}.tar.gz" | ||
echo "OUTPUT_FILENAME=$OUTPUT_FILENAME" >> $GITHUB_ENV | ||
echo "Filename: ${OUTPUT_FILENAME}" | ||
####################################################### | ||
### This is required while rbuilder repo is private ### | ||
####################################################### | ||
|
||
# https://github.com/webfactory/ssh-agent | ||
- name: Give GitHub Actions access to rbuilder-private | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.RBUILDER_PRIVATE_DEPLOY_KEY }} | ||
|
||
- name: Configure Git to use deploy key | ||
run: | | ||
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV | ||
git config --global url."ssh://[email protected]".insteadOf "https://github.com" | ||
####################################################### | ||
|
||
- name: Build rbuilder binary | ||
run: cargo build --release | ||
|
||
- name: Prepare artifacts | ||
run: | | ||
mkdir -p artifacts | ||
tar -czf "artifacts/${OUTPUT_FILENAME}" -C target/release rbuilder | ||
# https://github.com/actions/upload-artifact | ||
- name: Upload artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ env.OUTPUT_FILENAME }} | ||
path: artifacts/${{ env.OUTPUT_FILENAME }} | ||
|
||
# | ||
# draft-release runs after building for various targets, collects artifacts and prepares a draft release | ||
# (only when running against a tag!) | ||
# | ||
draft-release: | ||
name: Draft release | ||
if: ${{ github.event.inputs.draft-release == 'true' || github.event_name == 'push'}} # when manually triggered or version tagged | ||
needs: [extract-version, build-binary] | ||
runs-on: warp-ubuntu-latest-x64-16x | ||
env: | ||
VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# https://github.com/actions/download-artifact | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
merge-multiple: true | ||
path: artifacts | ||
|
||
- name: Record artifacts checksums | ||
working-directory: artifacts | ||
run: | | ||
find ./ || true | ||
for file in *; do sha256sum "$file" >> sha256sums.txt; done; | ||
cat sha256sums.txt | ||
# https://github.com/softprops/action-gh-release | ||
- name: Create release draft | ||
uses: softprops/[email protected] | ||
id: create-release-draft | ||
with: | ||
draft: true | ||
files: artifacts/* | ||
generate_release_notes: true | ||
name: ${{ env.VERSION }} | ||
tag_name: ${{ env.VERSION }} | ||
|
||
- name: Write Github Step Summary | ||
run: | | ||
echo "---" | ||
echo "### Release Draft: ${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY | ||
echo "${{ steps.create-release-draft.outputs.url }}" >> $GITHUB_STEP_SUMMARY | ||
# | ||
# build-docker builds a Docker image and pushes it to the GitHub Container Registry at ghcr.io | ||
# | ||
# See also | ||
# - https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry | ||
# - https://github.com/flashbots/rbuilder-private/issues/18 | ||
# | ||
build-docker: | ||
if: ${{ github.event.inputs.build-docker == 'true' }} | ||
name: Build and publish Docker image | ||
needs: extract-version | ||
runs-on: warp-ubuntu-latest-x64-16x | ||
env: | ||
VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: docker qemu | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# https://github.com/docker/metadata-action | ||
- name: docker metadata | ||
uses: docker/metadata-action@v5 | ||
id: meta | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
labels: org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
tags: | | ||
type=sha | ||
type=semver,pattern={{version}},value=${{ env.VERSION }} | ||
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }} | ||
type=semver,pattern={{major}},value=${{ env.VERSION }} | ||
# Push latest tag for full version only, not for prerelease versions (i.e. not for v1.2.3-rc1) | ||
type=raw,value=latest,enable=${{ !contains(env.VERSION, '-') }} | ||
- name: docker login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: docker build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
context: . | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} |
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 @@ | ||
/cargo | ||
/data | ||
/target |
Oops, something went wrong.