Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run posthog-production CI in a way testing migration continuity #1863

Merged
merged 5 commits into from
Nov 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ jobs:
touch frontend/dist/shared_dashboard.html
python manage.py test ee --testrunner="ee.clickhouse.clickhouse_test_runner.ClickhouseTestRunner"

multitenancy:
name: Django tests – posthog-production
cloud:
name: Django tests – Cloud
runs-on: ubuntu-latest

services:
Expand All @@ -169,11 +169,13 @@ jobs:
curl -L https://github.com/posthog/posthog-production/tarball/master | tar --strip-components=1 -xz --
mkdir deploy/

- uses: actions/checkout@v2
- name: Checkout master
uses: actions/checkout@v2
with:
ref: 'master'
path: 'deploy/'

- name: Link posthog-production
- name: Link posthog-production at master
run: |
cp -r multi_tenancy deploy/
cp -r messaging deploy/
Expand All @@ -200,6 +202,29 @@ jobs:
python -m pip install freezegun
if: steps.cache.outputs.cache-hit != 'true'

# The 2-step migration process (first master, then current branch) verifies that it'll always
# be possible to migrate to the new version without problems in production
- name: Migrate initially at master, then remove master deploy code
env:
SECRET_KEY: '6b01eee4f945ca25045b5aab440b953461faf08693a9abbf1166dc7c6b9772da' # unsafe - for testing only
DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres'
REDIS_URL: 'redis://localhost'
run: |
python deploy/manage.py migrate
rm -rf deploy

- name: Checkout current branch
uses: actions/checkout@v2
with:
path: 'deploy/'
paolodamico marked this conversation as resolved.
Show resolved Hide resolved

- name: Link posthog-production at current branch
run: |
cp -r multi_tenancy deploy/
cp -r messaging deploy/
cat multi_tenancy_settings.py >> deploy/posthog/settings.py
cat requirements.txt >> deploy/requirements.txt

- name: Check migrations
env:
SECRET_KEY: '6b01eee4f945ca25045b5aab440b953461faf08693a9abbf1166dc7c6b9772da' # unsafe - for testing only
Expand All @@ -208,6 +233,7 @@ jobs:
run: |
cd deploy
python manage.py makemigrations --check --dry-run
python manage.py migrate

- name: Run posthog tests
env:
Expand Down Expand Up @@ -235,9 +261,22 @@ jobs:
run: |
cd deploy
python manage.py test multi_tenancy messaging --keepdb -v 2 --exclude-tag=skip_on_multitenancy
- name: Run EE tests
env:
SECRET_KEY: '6b01eee4f945ca25045b5aab440b953461faf08693a9abbf1166dc7c6b9772da' # unsafe - for testing only
DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres'
REDIS_URL: 'redis://localhost'
PRIMARY_DB: 'clickhouse'
CLICKHOUSE_HOST: 'localhost'
CLICKHOUSE_DATABASE: 'posthog_test'
CLICKHOUSE_SECURE: 'False'
CLICKHOUSE_VERIFY: 'False'
run: |
cd deploy
python manage.py test ee --keepdb

foss:
name: Django tests – posthog-foss
name: Django tests – FOSS
runs-on: ubuntu-latest

services:
Expand Down