265 sim gh action to run e2e tests on pr open and approval #42
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: | |
- staging | |
types: | |
- opened | |
- synchronize | |
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 |