Skip to content

Commit

Permalink
feat: add pytest ci (#205)
Browse files Browse the repository at this point in the history
* feat: add pytest ci

* feat: add pytest docker build ci and refactor pytest ci

* refac: docker pull all necessary images and update ci
  • Loading branch information
nmjustinchan authored Jan 24, 2025
1 parent 64ae1d2 commit 287567e
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 0 deletions.
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
40 changes: 40 additions & 0 deletions .github/workflows/avs_stack_pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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
docker pull nethswitchboard/taiko-preconf-avs-dev:latest
docker pull nethswitchboard/taiko-preconf-avs-protocol-dev:latest
docker pull nethswitchboard/taiko-preconf-avs-pytest-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
EOF
- name: Summary
run: |
echo "## Pytest completed :green_circle:" >> $GITHUB_STEP_SUMMARY
2 changes: 2 additions & 0 deletions SmartContracts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ RUN git init && \
foundryup && \
forge install

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

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

ENTRYPOINT ["sh", "-c"]
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"]

0 comments on commit 287567e

Please sign in to comment.