Skip to content

270 sim contract methods #229

270 sim contract methods

270 sim contract methods #229

name: CI
on:
pull_request:
types:
- opened
- labeled
- synchronize
pull_request_review:
types:
- submitted
- edited
concurrency:
group: backend-e2e-${{ github.event.number }}
cancel-in-progress: true
jobs:
triggers:
name: Get Triggers
runs-on: ubuntu-latest
outputs:
is_pull_request_opened: ${{ github.event_name == 'pull_request' && github.event.action == 'opened'}}
is_pull_request_review_approved: ${{ github.event_name == 'pull_request_review' && github.event.review.state == 'APPROVED'}}
is_pull_request_labeled_with_run_tests: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-tests')}}
steps:
- run: true
test:
needs: triggers
if: ${{ needs.triggers.outputs.is_pull_request_opened == 'true' || needs.triggers.outputs.is_pull_request_review_approved == 'true' || needs.triggers.outputs.is_pull_request_labeled_with_run_tests == 'true' }}
runs-on: ubuntu-latest
env:
PYTHONPATH: ${{ github.workspace }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Copy .env file
run: cp .env.example .env
- name: Set OPENAIKEY in the .env file so it can be loaded from the environment
env:
OPENAIKEY: ${{ secrets.OPENAIKEY }}
run: sed -i "s/<add_your_openai_api_key_here>/${OPENAIKEY}/g" .env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker image
run: docker compose build
- name: Run Docker Compose
run: docker compose up -d
- name: Wait for services to be up
timeout-minutes: 5
run: |
while ! curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"ping","params":[],"id":1}' http://0.0.0.0:4000/api > /dev/null; do
echo "Waiting for rpc server..."
sleep 5
done
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12.2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.test.txt
- name: Run tests
run: pytest tests/integration/
- name: Dump Docker Compose logs
run: docker compose logs
if: failure()
- name: Shutdown Docker Compose
if: always()
run: docker compose down