fix(ci): Show docker compose logs only when tests don't run (#21613)

This commit is contained in:
Neil Kakkar
2024-04-17 22:50:09 +01:00
committed by GitHub
parent b2773cb011
commit b7c2d36f34
4 changed files with 43 additions and 21 deletions

View File

@@ -145,6 +145,7 @@ runs:
# Tests
- name: Run FOSS tests
id: run-foss-tests
if: ${{ inputs.segment == 'FOSS' }}
env:
PERSON_ON_EVENTS_V2_ENABLED: ${{ inputs.person-on-events }}
@@ -157,10 +158,11 @@ runs:
|| 'hogvm posthog'
}} -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 EE tests
id: run-ee-tests
if: ${{ inputs.segment == 'EE' }}
env:
PERSON_ON_EVENTS_V2_ENABLED: ${{ inputs.person-on-events }}
@@ -169,10 +171,11 @@ runs:
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
id: run-decide-read-replica-tests
if: ${{ inputs.segment == 'FOSS' && inputs.group == 1 && inputs.person-on-events != 'true' }}
env:
POSTHOG_DB_NAME: posthog
@@ -186,7 +189,16 @@ runs:
--durations=100 --durations-min=1.0 \
$PYTEST_ARGS
# Post tests
- name: Show docker compose logs on failure
if: failure()
if: failure() && (steps.run-foss-tests.outcome != 'failure' && steps.run-ee-tests.outcome != 'failure' && steps.run-decide-read-replica-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

View File

@@ -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: hey@posthog.com
commit_author: PostHog Bot <hey@posthog.com>
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: hey@posthog.com
# commit_author: PostHog Bot <hey@posthog.com>

1
.test_durations Normal file
View File

@@ -0,0 +1 @@
{}

View File

@@ -1320,8 +1320,8 @@
AND event = '$feature_flag_called'
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-06 00:00:00', 'UTC')
AND (has(['control', 'test_1', 'test_2', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', ''))
AND has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', '')))
AND ((has(['control', 'test_1', 'test_2', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', '')))
AND (has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', ''))))
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
@@ -1553,8 +1553,8 @@
AND event = '$feature_flag_called'
AND toTimeZone(timestamp, 'US/Pacific') >= toDateTime('2020-01-01 02:10:00', 'US/Pacific')
AND toTimeZone(timestamp, 'US/Pacific') <= toDateTime('2020-01-06 07:00:00', 'US/Pacific')
AND (has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', ''))
AND has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', '')))
AND ((has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', '')))
AND (has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', ''))))
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
@@ -1607,8 +1607,8 @@
HAVING argMax(is_deleted, version) = 0) as pdi ON events.distinct_id = pdi.distinct_id
WHERE e.team_id = 2
AND event = '$feature_flag_called'
AND (has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', ''))
AND has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', '')))
AND ((has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', '')))
AND (has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', ''))))
AND toTimeZone(timestamp, 'US/Pacific') >= toDateTime('2020-01-01 02:10:00', 'US/Pacific')
AND toTimeZone(timestamp, 'US/Pacific') <= toDateTime('2020-01-06 07:00:00', 'US/Pacific') )
GROUP BY person_id,
@@ -1843,8 +1843,8 @@
AND event = '$feature_flag_called'
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-06 00:00:00', 'UTC')
AND (has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', ''))
AND has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', '')))
AND ((has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', '')))
AND (has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', ''))))
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
@@ -1897,8 +1897,8 @@
HAVING argMax(is_deleted, version) = 0) as pdi ON events.distinct_id = pdi.distinct_id
WHERE e.team_id = 2
AND event = '$feature_flag_called'
AND (has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', ''))
AND has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', '')))
AND ((has(['control', 'test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag_response'), '^"|"$', '')))
AND (has(['a-b-test'], replaceRegexpAll(JSONExtractRaw(e.properties, '$feature_flag'), '^"|"$', ''))))
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-06 00:00:00', 'UTC') )
GROUP BY person_id,