Skip to content

265 sim gh action to run e2e tests on pr open and approval #46

265 sim gh action to run e2e tests on pr open and approval

265 sim gh action to run e2e tests on pr open and approval #46

name: CI
on:
pull_request:
types:
- opened
- synchronize
- edited
pull_request_review:
types:
- submitted
jobs:
test:
if: ${{ github.event.review.state == 'APPROVED' || github.event_name == 'pull_request' }}
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: Run Docker Compose
run: docker compose up -d
- name: Wait for services to be up
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: Shutdown Docker Compose
if: always()
run: docker compose down