CI #38
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 | |
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: Changing URL for rpc server to localhost | |
run: sed -i "s/'jsonrpc'/'localhost'/g" .env | |
- name: Remove OPENAIKEY from the .env file so it can be loaded from the environment | |
run: sed -i "/^OPENAIKEY *= *'<add_your_api_key_here>'$/d" .env | |
- name: Adding OPENAIKEY to the .env file | |
env: | |
OPENAIKEY: ${{ secrets.OPENAIKEY }} | |
run: printf "\nOPENAIKEY='$OPENAIKEY'\n" >> .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 |