Skip to content

Commit

Permalink
Spin up the full django service in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna committed Jan 3, 2024
1 parent c0da3fc commit 704b58c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
23 changes: 22 additions & 1 deletion .github/workflows/analytics_migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ on:

jobs:
check-migrations:
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: django
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
elasticsearch:
image: elasticsearch:7.14.0
env:
ES_JAVA_OPTS: "-Xms250m -Xmx750m"
discovery.type: single-node
xpack.security.enabled: "true"
ELASTIC_PASSWORD: elastic
ports:
- 9200:9200
redis:
image: redis:latest
ports:
- 6379:6379

runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -19,6 +41,5 @@ jobs:
run: cat ./analytics/dev/.env.docker-compose >> $GITHUB_ENV

# This runs on pull requests and blocks until any necessary migrations have been created
# *Note*: This will display a warning about not being able to connect to a database. This can be ignored.
- name: Check for Migrations
run: ./analytics/manage.py makemigrations --check --noinput
8 changes: 8 additions & 0 deletions analytics/dev/.env.docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ DB_USER=postgres
DB_PASS=postgres
DB_HOST=localhost
DB_PORT=5432
OPENSEARCH_ENDPOINT=http://localhost:9200
OPENSEARCH_USERNAME=elastic
OPENSEARCH_PASSWORD=elastic
CELERY_BROKER_URL=redis://localhost:6379/0
SECRET_KEY=deadbeef
# There isn't a gitlab service being spun up so these need to be mocked
GITLAB_ENDPOINT="http://fakeurl"
GITLAB_TOKEN="bar"
11 changes: 11 additions & 0 deletions analytics/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ services:
ports:
- ${DOCKER_POSTGRES_PORT-5432}:5432

elasticsearch:
image: elasticsearch:7.14.0
environment:
ES_JAVA_OPTS: "-Xms250m -Xmx750m"
discovery.type: single-node
xpack.security.enabled: "true"
ELASTIC_PASSWORD: elastic
ports:
- ${DOCKER_ELASTICSEARCH_PORT-9200}:9200
- ${DOCKER_ELASTICSEARCH_PORT-9300}:9300

redis:
image: redis:latest
ports:
Expand Down

0 comments on commit 704b58c

Please sign in to comment.