Skip to content

Commit

Permalink
Merge branch 'main' into tests/block-conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
EvolveArt authored Oct 2, 2024
2 parents 8f7908a + 80038d5 commit 39b36eb
Show file tree
Hide file tree
Showing 44 changed files with 1,543 additions and 853 deletions.
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- name: Build and run tests
env:
ETH_FORK_URL: ${{ secrets.ETH_FORK_URL }}
GATEWAY_KEY: ${{ secrets.GITHUB_GATEWAY_KEY || '' }}
run: |
source <(cargo llvm-cov show-env --export-prefix)
cargo build --bin madara --profile dev
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Push Docker Image to GitHub Container Registry

on:
release:
types: [published]
workflow_dispatch:

jobs:
build:
runs-on: karnot-arc-runner-set

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
driver: docker-container

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image to GitHub Container Registry
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/madara:latest
ghcr.io/${{ github.repository_owner }}/madara:${{ github.event.release.tag_name }}
labels: |
org.opencontainers.image.source=${{ github.repository.html_url }}
org.opencontainers.image.version=${{ github.event.release.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Post successful message
run: echo "Docker image built and pushed successfully"
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Create Release

on:
push:
tags:
- "v*.*.*" # Triggers on version tags like v1.0.0

permissions:
contents: write

jobs:
create_release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.RELEASE_ACTION }}
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
commit: ${{ github.sha }}
draft: false
prerelease: false
generateReleaseNotes: true
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## Next release

- test: add block conversion task test
- fix(docs): updated readme and fixed launcher
- fix(ci): added gateway key to fix rate limit on tests
- feat(cli): launcher script and release workflows
- fix: cleaned cli settings for sequencer, devnet and full
- feat: move to karnot runner
- fix: docker file fixes for devnet
- fix(block-production): fix bouncer calculation and declared classes
Expand Down
34 changes: 20 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ num-traits = "0.2"
num-bigint = "0.4"
primitive-types = "0.12"
rand = "0.8"
reqwest = { version = "0.12", features = ["json"] }
reqwest = { version = "0.12", features = ["blocking", "json"] }
rstest = "0.18"
serde = { version = "1.0", default-features = false, features = ["std"] }
serde_json = { version = "1.0", default-features = false, features = ["std"] }
Expand Down
49 changes: 20 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,48 @@
# Stage 1: Build the application
FROM rust:1.78 AS builder

# Install build dependencies
RUN apt-get -y update && \
RUN apt-get -y update && \
apt-get install -y clang && \
apt-get autoremove -y; \
apt-get clean; \
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /usr/src/madara/

# Copy the source code
# Copy the source code into the container
COPY Cargo.toml Cargo.lock ./
COPY crates crates
COPY cairo cairo
COPY cairo_0 cairo_0


# Installing scarb, new since devnet integration
# Installation steps are taken from the scarb build script
# https://github.com/software-mansion/scarb/blob/main/install.sh
ENV SCARB_VERSION="v2.8.2"
ENV SCARB_REPO="https://github.com/software-mansion/scarb/releases/download"
ENV PLATFORM="x86_64-unknown-linux-gnu"
ENV SCARB_TARGET="/usr/src/scarb.tar.gz"
ENV SHELL="/bin/bash"
RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- ${SCARB_VERSION}
ENV PATH="/root/.local/bin:${PATH}"
RUN scarb --version

RUN curl -fLS -o $SCARB_TARGET \
$SCARB_REPO/$SCARB_VERSION/scarb-$SCARB_VERSION-$PLATFORM.tar.gz && \
tar -xz -C /usr/src/ --strip-components=1 -f $SCARB_TARGET && \
mv /usr/src/bin/scarb /bin
# Install runtime dependencies
RUN apt-get -y update && \
apt-get install -y openssl ca-certificates busybox && \
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Build the application in release mode
RUN cargo build --release

# Stage 2: Create the final runtime image
FROM debian:bookworm-slim

FROM debian:bookworm
# Install runtime dependencies
RUN apt-get -y update && \
apt-get install -y openssl ca-certificates && \
apt-get autoremove -y; \
apt-get clean; \
RUN apt-get -y update && \
apt-get install -y openssl ca-certificates &&\
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /usr/local/bin

# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/madara/target/release/madara .

# chain presets to be monted at startup
VOLUME crates/primitives/chain_config/presets
VOLUME crates/primitives/chain_config/resources

# Set the entrypoint
ENTRYPOINT ["./madara"]
Loading

0 comments on commit 39b36eb

Please sign in to comment.