Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
154 changes: 57 additions & 97 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,100 +13,60 @@ jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

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

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: |
sixgpt-proof:${{ github.run_number }}
sixgpt-proof:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Clone and set up GSC
run: |
git clone https://github.com/gramineproject/gsc.git
cd gsc
python3 -m pip install --no-cache-dir 'docker>=7.1.0' 'jinja2>=3.1.4' 'tomli>=2.0.1' 'tomli-w>=1.0.0' 'pyyaml>=6.0.2'

- name: Create signing key
run: |
echo "${{ secrets.SIGNING_KEY }}" > signing_key.pem
chmod 600 signing_key.pem

- name: Build GSC image
run: |
cd gsc
./gsc build sixgpt-proof ../sixgpt-proof.manifest.template -c ../config.yaml

- name: Sign GSC image
run: |
cd gsc
./gsc sign-image sixgpt-proof ../signing_key.pem -c ../config.yaml

- name: Export GSC image to file
run: |
docker save gsc-sixgpt-proof:latest | gzip > gsc-sixgpt-proof-${{ github.run_number }}.tar.gz

- name: Generate verification data
run: |
cd gsc
./gsc info-image gsc-sixgpt-proof > ../sigstruct.txt

- name: Upload image
uses: actions/upload-artifact@v3
with:
name: gsc-sixgpt-proof-image
path: gsc-sixgpt-proof-${{ github.run_number }}.tar.gz

- name: Upload verification data
uses: actions/upload-artifact@v3
with:
name: gsc-sixgpt-proof-sigstruct
path: sigstruct.txt

- name: Generate release body
run: |
echo "MRSIGNER: $(grep -oP 'mr_signer = "\K[^"]*' sigstruct.txt)" >> release_body.txt
echo "MRENCLAVE: $(grep -oP 'mr_enclave = "\K[^"]*' sigstruct.txt)" >> release_body.txt
echo "Image SHA256: $(sha256sum gsc-sixgpt-proof-${{ github.run_number }}.tar.gz | cut -d' ' -f1)" >> release_body.txt

- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
name: Release v${{ github.run_number }}
body_path: release_body.txt
draft: false
prerelease: false
files: |
./gsc-sixgpt-proof-${{ github.run_number }}.tar.gz
./sigstruct.txt

- name: Cleanup signing key
if: always()
run: |
rm -f signing_key.pem

- name: Log build result
if: always()
run: |
if [ ${{ job.status }} == "success" ]; then
echo "Build and release completed successfully"
else
echo "Build and release failed"
fi
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

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

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: |
my-proof:${{ github.run_number }}
my-proof:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Export image to file
run: |
docker save my-proof:latest | gzip > my-proof-${{ github.run_number }}.tar.gz

- name: Generate release body
run: |
echo "Image SHA256: $(sha256sum my-proof-${{ github.run_number }}.tar.gz | cut -d' ' -f1)" >> release_body.txt

- name: Upload image
uses: actions/upload-artifact@v3
with:
name: my-proof-image
path: my-proof-${{ github.run_number }}.tar.gz

- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
name: Release v${{ github.run_number }}
body_path: release_body.txt
draft: false
prerelease: false
files: |
./my-proof-${{ github.run_number }}.tar.gz

- name: Log build result
if: always()
run: |
if [ ${{ job.status }} == "success" ]; then
echo "Build and release completed successfully"
else
echo "Build and release failed"
fi
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
FROM python:3.12-slim

# Install any Python dependencies your application needs, e.g.:
RUN pip install --no-cache-dir requests

RUN mkdir /sealed && chmod 777 /sealed

WORKDIR /app

COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

CMD ["python", "-m", "sixgpt_proof"]
CMD ["python", "-m", "my_proof"]
55 changes: 0 additions & 55 deletions config.yaml

This file was deleted.

File renamed without changes.
7 changes: 3 additions & 4 deletions sixgpt_proof/__main__.py → my_proof/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
import zipfile
from typing import Dict, Any

from sixgpt_proof.proof import Proof
from my_proof.proof import Proof

INPUT_DIR, OUTPUT_DIR, SEALED_DIR = '/input', '/output', '/sealed'
INPUT_DIR, OUTPUT_DIR = '/input', '/output'

logging.basicConfig(level=logging.INFO, format='%(message)s')


def load_config() -> Dict[str, Any]:
"""Load proof configuration from environment variables."""
config = {
'dlp_id': 202, # Set your own DLP ID here
'use_sealing': os.path.isdir(SEALED_DIR),
'dlp_id': 14, # Set your own DLP ID here
'input_dir': INPUT_DIR,
"sixgpt_api_key": os.environ.get("SIXGPT_API_KEY", None),
"miner_address": os.environ.get("MINER_ADDRESS", None),
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions sixgpt_proof/proof.py → my_proof/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import random

from sixgpt_proof.extract import extract_data, validate_json_structure
from sixgpt_proof.models.proof_response import ProofResponse
from sixgpt_proof.wikipedia.verify_content import WikipediaSummarization
from sixgpt_proof.sixgpt import evaluate_question, evaluate_answer, get_uniqueness_score
from my_proof.extract import extract_data, validate_json_structure
from my_proof.models.proof_response import ProofResponse
from my_proof.wikipedia.verify_content import WikipediaSummarization
from my_proof.sixgpt import evaluate_question, evaluate_answer, get_uniqueness_score

MIN_NUMBER_OF_EXAMPLES = 50

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pydantic
requests
33 changes: 0 additions & 33 deletions sixgpt-proof.manifest.template

This file was deleted.

Loading