-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from HerodotusDev/feat/dockerize
Feat/dockerize
- Loading branch information
Showing
17 changed files
with
285 additions
and
97 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,37 @@ | ||
# Python | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
__pycache__ | ||
*.swp | ||
*.swo | ||
.Python | ||
env/ | ||
venv/ | ||
ENV/ | ||
*.egg-info | ||
.eggs/ | ||
.dist-info | ||
*.egg | ||
*.whl | ||
.build/ | ||
.tox/ | ||
.coverage | ||
coverage.* | ||
.cache | ||
.pytest_cache/ | ||
|
||
# Rust | ||
target/ | ||
Cargo.lock | ||
|
||
# Docker files | ||
Dockerfile | ||
docker-compose.yml | ||
|
||
# Version control | ||
.git/ | ||
.gitignore | ||
|
||
hdp-test | ||
cairo-vm |
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
version: "lab:latest" | ||
driver: cloud | ||
endpoint: "dataprocessor/github" | ||
cleanup: true | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: environment.dockerfile | ||
tags: "dataprocessor/hdp-cairo:latest" | ||
platforms: linux/amd64,linux/arm64 | ||
push: 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,87 @@ | ||
name: CI Build and Test Workflow | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
version: "lab:latest" | ||
driver: cloud | ||
endpoint: "dataprocessor/github" | ||
cleanup: true | ||
- name: Build and cache Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: environment.dockerfile | ||
tags: "dataprocessor/hdp-cairo:latest" | ||
# | ||
- name: Setup Scarb | ||
uses: software-mansion/setup-scarb@v1 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Cache Python environment | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/pip | ||
venv | ||
key: ${{ runner.os }}-python-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('tools/make/setup.sh') }} | ||
restore-keys: | | ||
${{ runner.os }}-python-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('tools/make/setup.sh') }} | ||
${{ runner.os }}-python- | ||
# - name: Cache Cargo directories | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: | | ||
# ~/.cargo/bin/ | ||
# ~/.cargo/registry/index/ | ||
# ~/.cargo/registry/cache/ | ||
# ~/.cargo/git/db/ | ||
# cairo-vm/cargo-run/target | ||
# key: ${{ runner.os }}-cargo-${{ hashFiles('tools/make/install_cairo1_run.sh') }} | ||
# restore-keys: ${{ runner.os }}-cargo- | ||
|
||
- name: Install Dependencies | ||
run: make setup | ||
|
||
- name: Check Python formatting | ||
run: | | ||
source venv/bin/activate | ||
./tools/make/python_format_check.sh | ||
- name: Check Cairo formatting | ||
run: | | ||
source venv/bin/activate | ||
./tools/make/cairo_format_check.sh | ||
- name: Compile Cairo files | ||
run: | | ||
source venv/bin/activate | ||
make build | ||
- name: Run Unit Cairo tests | ||
env: | ||
RPC_URL_MAINNET: ${{ secrets.RPC_URL_MAINNET }} | ||
run: | | ||
source venv/bin/activate | ||
./tools/make/cairo_tests.sh | ||
- name: Run Full Flow tests | ||
run: | | ||
source venv/bin/activate | ||
./tools/make/full_flow_test.sh |
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
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,33 @@ | ||
# Use the official Python 3.9 image from the Docker Hub | ||
FROM python:3.9.0 | ||
|
||
# Set the default shell to bash and the working directory in the container | ||
SHELL ["/bin/bash", "-ci"] | ||
WORKDIR /hdp | ||
|
||
# Install Rust using Rustup | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ | ||
echo 'export PATH="/root/.cargo/bin:$PATH"' >> /root/.bashrc | ||
|
||
# Add Cargo executables to PATH | ||
RUN mkdir -p /root/.local/bin && \ | ||
echo 'export PATH="/root/.local/bin:$PATH"' >> /root/.bashrc | ||
|
||
# Install cairo1-run into PATH | ||
RUN git clone https://github.com/HerodotusDev/cairo-vm.git && \ | ||
cd cairo-vm && git checkout aecbb3f01dacb6d3f90256c808466c2c37606252 && \ | ||
cd cairo1-run && cargo install --path . | ||
|
||
# Copy project requirements and install them | ||
COPY tools/make/requirements.txt tools/make/requirements.txt | ||
RUN python -m pip install --upgrade pip && pip install -r tools/make/requirements.txt | ||
|
||
# Copy and install Contract bootloader SNOS dependencies | ||
COPY packages/cairo-lang-0.13.1.zip packages/cairo-lang-0.13.1.zip | ||
RUN pip install packages/cairo-lang-0.13.1.zip | ||
|
||
# Copy the entire project into the image | ||
COPY . . | ||
|
||
# Install Python package modules | ||
RUN pip install . |
Binary file not shown.
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
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
Oops, something went wrong.