Update postgres integration #1357
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: CLI CI | |
on: | |
pull_request: | |
paths: | |
- "grai-cli/**" | |
- "grai-client/**" | |
- "grai-server/**" | |
- ".github/workflows/cli-ci.yml" | |
concurrency: | |
group: ${{ github.ref }}-cli-ci | |
cancel-in-progress: true | |
env: | |
py_ver: "3.10" | |
poetry_ver: "1.5.1" | |
project_dir: "grai-cli" | |
jobs: | |
lint-cli: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ env.project_dir }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Install Python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "${{ env.py_ver }}" | |
- run: pip install black isort | |
- run: | | |
black . --check | |
isort . --profile black --check | |
build-server: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
image-digest: ${{ steps.docker-build.outputs.digest }} | |
defaults: | |
run: | |
working-directory: grai-server/app | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }}/grai-server-temp | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@master | |
- name: Build | |
id: docker-build | |
uses: docker/build-push-action@v4 | |
with: | |
context: grai-server/app | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ghcr.io/grai-io/grai-core/grai-server-temp:latest | |
target: grai-server | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tests-cli: | |
needs: | |
- lint-cli | |
- build-server | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ env.project_dir }} | |
env: | |
GRAI_CLI_CONFIG: ${{ github.workspace }}/grai-cli/tests/config/config.yaml | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: grai | |
POSTGRES_PASSWORD: grai | |
POSTGRES_DB: grai | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 15 | |
the_guide: | |
image: ghcr.io/grai-io/grai-core/grai-server-temp@${{ needs.build-server.outputs.image-digest }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GH_TOKEN }} | |
env: | |
DB_USER: grai | |
DB_PASSWORD: grai | |
DB_NAME: grai | |
DB_PORT: "5432" | |
DB_HOST: postgres | |
DJANGO_SUPERUSER_USERNAME: null@grai.io | |
DJANGO_SUPERUSER_PASSWORD: super_secret | |
CELERY_BROKER_URL: redis://redis:6379/0 | |
CELERY_RESULT_BACKEND: redis://redis:6379/0 | |
REDIS_GRAPH_CACHE_HOST: redis | |
DEBUG: true | |
ports: | |
- 8000:8000 | |
options: >- | |
--health-cmd "curl -f http://localhost:8000/health/ || exit 1" | |
--health-interval 2s | |
--health-retries 10 | |
--health-start-period 60s | |
redis: | |
image: redis/redis-stack-server:6.2.6-v9 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "${{ env.py_ver }}" | |
- run: | | |
pip install pytest | |
pip install . | |
- run: ls ${{ github.workspace }}/grai-cli/tests/config | |
- run: cat ${{ github.workspace }}/grai-cli/tests/config/config.yaml | |
- run: pytest -s |