Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into 21179-stop-survey
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaevg committed Apr 21, 2024
2 parents 4bd29e7 + 1df7232 commit 709ce86
Show file tree
Hide file tree
Showing 491 changed files with 17,409 additions and 5,652 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
!plugin-server/.prettierrc
!share/GeoLite2-City.mmdb
!hogvm/python
!unit.json
!unit.json.tpl
!plugin-transpiler/src
!plugin-transpiler/*.*
!test-runner-jest.config.js
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ module.exports = {
'error',
{
ignoreRestSiblings: true,
destructuredArrayIgnorePattern: '^_$',
},
],
'@typescript-eslint/prefer-ts-expect-error': 'error',
Expand Down
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Bug report
description: Something not working as expected? Let us look into it.
labels: ['bug']
body:
- type: textarea
id: bug-description
attributes:
label: Bug Description
value: "## Bug description\n\n*Please describe.*\n*If this affects the front-end, screenshots would be of great help.*\n\n*If you are on PostHog Cloud it would be really valuable if you can share any links where the problem occurs. This speeds up our ability to troubleshoot tremendously.*\n\n## How to reproduce\n\n1. \n2.\n3. \n\n## Additional context\n\n"

- type: textarea
id: debug-info
attributes:
label: Debug info
value: "- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]\n- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]\n- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]\n"
render: shell

- type: markdown
attributes:
value: '#### *Thank you* for your bug report – we love squashing them!'
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Feature request
description: 'Suggest a feature for PostHog'
labels: ['enhancement, feature']
body:
- type: textarea
id: feature_request
attributes:
label: Feature request
value:
"## Is your feature request related to a problem?\n\n*Please describe.*\n\n## Describe the solution you'd like\n\n\n## Describe alternatives you've considered\n\n\n## Additional context\n\n\n
"
- type: textarea
id: debug-info
attributes:
label: Debug info
value: "- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]\n- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]\n- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]\n"
render: shell

- type: markdown
attributes:
value: '#### *Thank you* for your bug report – we love squashing them!'
51 changes: 31 additions & 20 deletions .github/actions/run-backend-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
description: ClickHouse server image tag, e.g. clickhouse/clickhouse-server:latest
segment:
required: true
description: Either 'FOSS' or 'EE' segment
description: Either 'Core' or 'Temporal' segment
concurrency:
required: true
description: Count of concurrency groups
Expand Down Expand Up @@ -132,6 +132,7 @@ runs:
run: bin/check_kafka_clickhouse_up

- name: Wait for Temporal
if: ${{ inputs.segment == 'Temporal' }}
shell: bash
run: |
bin/check_temporal_up
Expand All @@ -144,36 +145,27 @@ runs:
run: echo "PYTEST_ARGS=--snapshot-update" >> $GITHUB_ENV # We can only update snapshots within the PostHog org

# Tests
- name: Run FOSS tests
if: ${{ inputs.segment == 'FOSS' }}
- name: Run Core tests
id: run-core-tests
if: ${{ inputs.segment == 'Core' }}
env:
PERSON_ON_EVENTS_V2_ENABLED: ${{ inputs.person-on-events }}
GROUPS_ON_EVENTS_ENABLED: ${{ inputs.person-on-events }}
shell: bash
run: | # async_migrations covered in ci-async-migrations.yml
pytest ${{
inputs.person-on-events == 'true'
&& './posthog/clickhouse/ ./posthog/hogql/ ./posthog/queries/ ./posthog/api/test/test_insight* ./posthog/api/test/dashboards/test_dashboard.py'
&& './posthog/clickhouse/ ./posthog/queries/ ./posthog/api/test/test_insight* ./posthog/api/test/dashboards/test_dashboard.py'
|| 'hogvm posthog'
}} -m "not async_migrations" \
}} ${{ inputs.person-on-events == 'true' && 'ee/clickhouse/' || 'ee/' }} -m "not async_migrations" \
--ignore=posthog/temporal \
--splits ${{ inputs.concurrency }} --group ${{ inputs.group }} \
--durations=100 --durations-min=1.0 \
$PYTEST_ARGS
- name: Run EE tests
if: ${{ inputs.segment == 'EE' }}
env:
PERSON_ON_EVENTS_V2_ENABLED: ${{ inputs.person-on-events }}
GROUPS_ON_EVENTS_ENABLED: ${{ inputs.person-on-events }}
shell: bash
run: | # async_migrations covered in ci-async-migrations.yml
pytest ${{ inputs.person-on-events == 'true' && 'ee/clickhouse/' || 'ee/' }} -m "not async_migrations" \
--splits ${{ inputs.concurrency }} --group ${{ inputs.group }} \
--durations=100 --durations-min=1.0 \
--durations=100 --durations-min=1.0 --store-durations \
$PYTEST_ARGS
- name: Run /decide read replica tests
if: ${{ inputs.segment == 'FOSS' && inputs.group == 1 && inputs.person-on-events != 'true' }}
id: run-decide-read-replica-tests
if: ${{ inputs.segment == 'Core' && inputs.group == 1 && inputs.person-on-events != 'true' }}
env:
POSTHOG_DB_NAME: posthog
READ_REPLICA_OPT_IN: 'decide,PersonalAPIKey, local_evaluation'
Expand All @@ -186,7 +178,26 @@ runs:
--durations=100 --durations-min=1.0 \
$PYTEST_ARGS
- name: Run Temporal tests
id: run-temporal-tests
if: ${{ inputs.segment == 'Temporal' }}
shell: bash
run: |
pytest posthog/temporal -m "not async_migrations" \
--splits ${{ inputs.concurrency }} --group ${{ inputs.group }} \
--durations=100 --durations-min=1.0 --store-durations \
$PYTEST_ARGS
# Post tests
- name: Show docker compose logs on failure
if: failure()
if: failure() && (steps.run-core-tests.outcome != 'failure' && steps.run-decide-read-replica-tests.outcome != 'failure' && steps.run-temporal-tests.outcome != 'failure')
shell: bash
run: docker compose -f docker-compose.dev.yml logs

- name: Upload updated timing data as artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.person-on-events != 'true' && inputs.clickhouse-server-image == 'clickhouse/clickhouse-server:23.12.5.81-alpine' }}
with:
name: timing_data-${{ inputs.segment }}-${{ inputs.group }}
path: .test_durations
retention-days: 2
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- name: Automerge
if: env.IS_POSTHOG_BOT_AVAILABLE == 'true'
uses: pascalgn/automerge-action@v0.15.5
uses: pascalgn/automerge-action@v0.16.3
env:
GITHUB_TOKEN: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
- run: echo
25 changes: 17 additions & 8 deletions .github/workflows/ci-backend-update-test-timing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,25 @@ jobs:

- uses: ./.github/actions/run-backend-tests
with:
# FIXME: These inputs are incomplete, but this workflow doesn't seem to be used currently,
# so fix this if you want to use this
concurrency: 1
group: 1
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
python-version: '3.10.10'
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.5.81-alpine'
segment: 'FOSS'
person-on-events: false

- name: Save test durations
uses: stefanzweifel/git-auto-commit-action@v5
- name: Upload updated timing data as artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.person-on-events != 'true' && inputs.clickhouse-server-image == 'clickhouse/clickhouse-server:23.12.5.81-alpine' }}
with:
commit_message: 'Save backend test durations'
commit_user_name: PostHog Bot
commit_user_email: [email protected]
commit_author: PostHog Bot <[email protected]>
name: timing_data-${{ inputs.segment }}-${{ inputs.group }}
path: .test_durations
retention-days: 2
# - name: Save test durations
# uses: stefanzweifel/git-auto-commit-action@v5
# with:
# commit_message: 'Save backend test durations'
# commit_user_name: PostHog Bot
# commit_user_email: [email protected]
# commit_author: PostHog Bot <[email protected]>
29 changes: 18 additions & 11 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
# Job to decide if we should run backend ci
# See https://github.com/dorny/paths-filter#conditional-execution for more details
changes:
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.repository == 'PostHog/posthog'
name: Determine need to run backend checks
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
timeout-minutes: 30

name: Python code quality checks
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest

steps:
# If this run wasn't initiated by the bot (meaning: snapshot update) and we've determined
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
- name: Check formatting
run: |
ruff format --exclude posthog/hogql/grammar --check --diff .
ruff format --check --diff .
- name: Add Problem Matcher
run: echo "::add-matcher::.github/mypy-problem-matcher.json"
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
timeout-minutes: 10

name: Validate Django and CH migrations
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -236,19 +236,26 @@ jobs:
timeout-minutes: 30

name: Django tests – ${{ matrix.segment }} (persons-on-events ${{ matrix.person-on-events && 'on' || 'off' }}), Py ${{ matrix.python-version }}, ${{ matrix.clickhouse-server-image }} (${{matrix.group}}/${{ matrix.concurrency }})
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ['3.10.10']
clickhouse-server-image:
['clickhouse/clickhouse-server:23.11.2.11-alpine', 'clickhouse/clickhouse-server:23.12.5.81-alpine']
segment: ['FOSS', 'EE']
segment: ['Core']
person-on-events: [false, true]
# :NOTE: Keep concurrency and groups in sync
concurrency: [5]
group: [1, 2, 3, 4, 5]
concurrency: [10]
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
include:
- segment: 'Temporal'
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.5.81-alpine'
python-version: '3.10.10'
concurrency: 1
group: 1

steps:
# The first step is the only one that should run if `needs.changes.outputs.backend == 'false'`.
Expand Down Expand Up @@ -304,7 +311,7 @@ jobs:
- name: Archive email renders
uses: actions/upload-artifact@v3
if: needs.changes.outputs.backend == 'true' && matrix.segment == 'FOSS' && matrix.person-on-events == false
if: needs.changes.outputs.backend == 'true' && matrix.segment == 'Core' && matrix.person-on-events == false
with:
name: email_renders
path: posthog/tasks/test/__emails__
Expand All @@ -319,7 +326,7 @@ jobs:
clickhouse-server-image:
['clickhouse/clickhouse-server:23.11.2.11-alpine', 'clickhouse/clickhouse-server:23.12.5.81-alpine']
if: needs.changes.outputs.backend == 'true'
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
steps:
- name: 'Checkout repo'
uses: actions/checkout@v3
Expand Down Expand Up @@ -373,7 +380,7 @@ jobs:
calculate-running-time:
name: Calculate running time
needs: [django, async-migrations]
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
if: needs.changes.outputs.backend == 'true'
steps:
- name: Calculate running time
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
changes:
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.repository == 'PostHog/posthog'
name: Determine need to run E2E checks
Expand Down Expand Up @@ -55,11 +55,10 @@ jobs:
chunks:
needs: changes
name: Cypress preparation
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
chunks: ${{ steps.chunk.outputs.chunks }}

steps:
- name: Check out
uses: actions/checkout@v3
Expand All @@ -70,7 +69,7 @@ jobs:

container:
name: Build and cache container image
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [changes]
permissions:
Expand All @@ -94,7 +93,7 @@ jobs:

cypress:
name: Cypress E2E tests (${{ strategy.job-index }})
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [chunks, changes, container]
permissions:
Expand Down Expand Up @@ -279,7 +278,7 @@ jobs:

calculate-running-time:
name: Calculate running time
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
needs: [cypress]
if: needs.changes.outputs.shouldTriggerCypress == 'true'
steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-plugin-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# Job to decide if we should run plugin server ci
# See https://github.com/dorny/paths-filter#conditional-execution for more details
changes:
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.repository == 'PostHog/posthog'
name: Determine need to run plugin server checks
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
name: Code quality
needs: changes
if: needs.changes.outputs.plugin-server == 'true'
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'plugin-server'
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
tests:
name: Plugin Server Tests (${{matrix.shard}})
needs: changes
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
name: Functional tests (POE=${{matrix.POE_EMBRACE_JOIN_FOR_TEAMS}},RDK=${{matrix.KAFKA_CONSUMPTION_USE_RDKAFKA}})
needs: changes
if: needs.changes.outputs.plugin-server == 'true'
runs-on: depot-ubuntu-latest-4
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/container-images-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ on:
- master
workflow_dispatch:

concurrency: ${{ github.workflow }} # ensure only one of this runs at a time

jobs:
posthog_build:
name: Build and push PostHog
Expand Down
Loading

0 comments on commit 709ce86

Please sign in to comment.