Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pytest ci #205

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/avs_pytest_docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: "[Nethermind] Taiko Preconf AVS Pytest - Docker build and push"

on:
workflow_dispatch:
push:
branches: [master]
tags:
- "taiko-preconf-avs-v*"
paths:
- "e2e_tests/**"

env:
DOCKER_REGISTRY: docker.io
DOCKER_USERNAME: nethswitchboard
DOCKER_REPOSITORY_DEV: taiko-preconf-avs-pytest-dev

jobs:
build:
name: Build and push docker image
runs-on: ubuntu-latest
if: github.repository == 'NethermindEth/Taiko-Preconf-AVS'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_USERNAME }}/${{ env.DOCKER_REPOSITORY_DEV }}
tags: |
type=raw,value=latest
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=sha

- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: ./e2e_tests
file: ./e2e_tests/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Summary
run: |
echo "## Docker build completed :green_circle:" >> $GITHUB_STEP_SUMMARY
echo "### Tags" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" | while IFS= read -r TAG; do
echo "- $TAG" >> $GITHUB_STEP_SUMMARY
done
echo "### Notes" >> $GITHUB_STEP_SUMMARY
43 changes: 43 additions & 0 deletions .github/workflows/avs_stack_pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "[Nethermind] Taiko Preconf AVS Stack - Pytest"

on:
workflow_dispatch:
push:
branches: [master]

env:
TARGET_MACHINE_IP: 178.79.141.170
jobs:
build:
name: Set and run pytest
runs-on: ubuntu-latest
steps:
- name: Setup SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ env.TARGET_MACHINE_IP }} >> ~/.ssh/known_hosts

- name: SSH into target machine
run: |
ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=30 root@${{ env.TARGET_MACHINE_IP }} << 'EOF'
docker pull nethswitchboard/taiko-protocol-dev:latest
docker pull nethswitchboard/taiko-client-dev:latest

kurtosis enclave rm taiko-preconf-devnet --force
kurtosis clean -a
cd ~/preconfirm-devnet-package
git pull
kurtosis run --enclave taiko-preconf-devnet . --args-file network_params.yaml

cd ~/Taiko-Preconf-AVS/e2e_tests
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pytest
EOF

- name: Summary
run: |
echo "## Pytest completed :green_circle:" >> $GITHUB_STEP_SUMMARY
6 changes: 3 additions & 3 deletions SmartContracts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ RUN apt-get update && apt-get install -y jq

RUN git init && \
curl -L https://foundry.paradigm.xyz | bash && \
npm install -g pnpm && \
. ~/.bashrc && \
foundryup && \
forge install && \
pnpm install
forge install

RUN chmod +x /app/scripts/deployment/*.sh

ENV PATH="/root/.foundry/bin:$PATH"

Expand Down
15 changes: 15 additions & 0 deletions e2e_tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Use Python base image
FROM python:3.9-slim

# Set working directory
WORKDIR /app

# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy test files
COPY . .

# Command to run tests
CMD ["sleep", "infinity"]
Loading