feature/gra-754-metabase-column-lineage #1228
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: "1.3.1" | |
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@v3 | |
- name: Install Python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
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: postgres: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:latest | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
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@v3 | |
with: | |
flags: grai-server | |
token: ${{ secrets.CODECOV_TOKEN }} |