Server Version Bump #1639
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: Grai Server CI | |
on: | |
pull_request: | |
paths: | |
- ".github/workflows/server-ci.yml" | |
- "grai-server/**" | |
concurrency: | |
group: ${{ github.ref }}-server-ci | |
cancel-in-progress: true | |
env: | |
py_ver: "3.11" | |
poetry_ver: "${{ vars.POETRY_VER }}" | |
SECRET_KEY: "fixed-test-key-that-doesnt-matter" | |
DB_USER: "grai" | |
DB_PASSWORD: "grai" | |
DB_NAME: "grai" | |
DEBUG: "False" | |
DB_HOST: "127.0.0.1" | |
DB_PORT: "5432" | |
jobs: | |
lint-server: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Install Python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ env.py_ver }}" | |
- run: pip install black isort | |
- working-directory: "grai-server/app" | |
run: | | |
black . --check --exclude /migrations/ | |
# isort . --profile black --check | |
tests-server: | |
needs: lint-server | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./grai-server/app | |
services: | |
postgres: | |
image: ankane/pgvector:latest | |
env: | |
POSTGRES_USER: ${{ env.DB_USER }} | |
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} | |
POSTGRES_DB: ${{ env.DB_NAME }} | |
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 | |
redis: | |
image: redis/redis-stack-server:6.2.6-v9 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ env.py_ver }}" | |
- uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: "${{ env.poetry_ver }}" | |
- run: poetry install | |
- name: Run Migrations | |
run: poetry run python manage.py migrate --noinput | |
- name: Run Coverage Tests | |
env: | |
GITHUB_PRIVATE_KEY: installations/tests/sample.private-key.pem | |
run: | | |
poetry run coverage run -m pytest | |
poetry run coverage xml | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: grai-server | |
token: ${{ secrets.CODECOV_TOKEN }} |