Skip to content

Commit

Permalink
Merge branch 'master' into 14331-regular-job
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaevg authored Aug 13, 2024
2 parents 66f0c4a + 0c3d83d commit d274bea
Show file tree
Hide file tree
Showing 562 changed files with 8,473 additions and 3,152 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/container-images-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ jobs:
- name: Set up Depot CLI
uses: depot/setup-action@v1

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: posthog
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand All @@ -60,6 +54,12 @@ jobs:
id: aws-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: posthog
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push container image
id: build
uses: depot/build-push-action@v1
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Go Test (for livestream service)

on:
pull_request:
paths:
- 'livestream/**'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22

- name: Run tests
run: cd livestream && go test -v
35 changes: 35 additions & 0 deletions .github/workflows/replay-capture.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Vector Replay Capture Tests

on:
workflow_dispatch:
pull_request:
paths:
- vector/**
- .github/workflows/replay-capture.yml

workflow_call:

jobs:
vector-test:
name: Vector test
runs-on: ubuntu-20.04
env:
QUOTA_LIMITED_TEAMS_PATH: vector/replay-capture/tests/quota_limited_teams.csv
OVERFLOW_SESSIONS_PATH: vector/replay-capture/tests/overflow_sessions.csv
KAFKA_BOOSTRAP_SERVERS: dummy:9092
KAFKA_EVENTS_TOPIC: session_recording_snapshot_item_events
KAFKA_OVERFLOW_TOPIC: session_recording_snapshot_item_overflow
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Vector
run: |
wget https://github.com/vectordotdev/vector/releases/download/v0.40.0/vector-0.40.0-x86_64-unknown-linux-gnu.tar.gz
tar xzvf vector-0.40.0-x86_64-unknown-linux-gnu.tar.gz ./vector-x86_64-unknown-linux-gnu/bin/vector
sudo mv ./vector-x86_64-unknown-linux-gnu/bin/vector /usr/bin/vector
- name: Run vector tests
run: |
yq -i e 'explode(.)' vector/replay-capture/vector.yaml
vector test vector/replay-capture/*.yaml
15 changes: 6 additions & 9 deletions .github/workflows/rust-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,20 @@ jobs:
- name: Set up Depot CLI
uses: depot/setup-action@v1

- name: Login to DockerHub
uses: docker/login-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
username: posthog
password: ${{ secrets.DOCKERHUB_TOKEN }}
image: tonistiigi/binfmt:latest
platforms: all

- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand All @@ -84,7 +81,7 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64
platforms: linux/arm64,linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: BIN=${{ matrix.image }}
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/rust-hook-migrator-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ jobs:
- name: Set up Depot CLI
uses: depot/setup-action@v1

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: posthog
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to ghcr.io
uses: docker/login-action@v2
with:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ jobs:
- uses: actions/checkout@v3
if: needs.changes.outputs.rust == 'true' && matrix.package == 'feature-flags'

- name: Login to DockerHub
if: needs.changes.outputs.rust == 'true'
uses: docker/login-action@v2
continue-on-error: true
with:
username: posthog
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Setup main repo dependencies for flags
if: needs.changes.outputs.rust == 'true' && matrix.package == 'feature-flags'
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/storybook-chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- '.storybook/**'
- 'package.json'
- '.github/workflows/storybook-chromatic.yml'
- 'playwright.config.ts'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/vector-docker-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Build and deploy replay capture container images

on:
workflow_dispatch:
push:
paths:
- 'vector/**'
- '.github/workflows/vector-docker-build-deploy.yml'
branches:
- 'master'

jobs:
build:
name: Build and publish container image
runs-on: depot-ubuntu-22.04-4
permissions:
id-token: write # allow issuing OIDC tokens for this workflow run
contents: read # allow reading the repo contents
packages: write # allow push to ghcr.io

outputs:
digest: ${{ steps.docker_build.outputs.digest }}

defaults:
run:
working-directory: vector/

steps:
- name: Check Out Repo
# Checkout project code
# Use sparse checkout to only select files in vector directory
# Turning off cone mode ensures that files in the project root are not included during checkout
uses: actions/checkout@v4
with:
sparse-checkout: 'vector/'
sparse-checkout-cone-mode: false

- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/posthog/posthog/replay-capture
tags: |
type=ref,event=pr
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build and push image
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./vector/replay-capture/
file: ./vector/replay-capture/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64,linux/amd64

deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- name: get deployer token
id: deployer
uses: getsentry/action-github-app-token@v3
with:
app_id: ${{ secrets.DEPLOYER_APP_ID }}
private_key: ${{ secrets.DEPLOYER_APP_PRIVATE_KEY }}

- name: Trigger livestream deployment
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.deployer.outputs.token }}
repository: PostHog/charts
event-type: commit_state_update
client-payload: |
{
"values": {
"image": {
"sha": "${{ needs.build.outputs.digest }}"
}
},
"release": "replay-capture-vector",
"commit": ${{ toJson(github.event.head_commit) }},
"repository": ${{ toJson(github.repository) }},
"labels": []
}
4 changes: 2 additions & 2 deletions cypress/e2e/billing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ describe('Billing', () => {
expect(matchingEvent.properties.$survey_id).to.equal(UNSUBSCRIBE_SURVEY_ID)
expect(matchingEvent.properties.$survey_response).to.equal('Product analytics')
expect(matchingEvent.properties.$survey_response_1).to.equal('product_analytics')
expect(matchingEvent.properties.$survey_reasons.length).to.equal(1)
expect(matchingEvent.properties.$survey_reasons[0]).to.equal('Too expensive')
expect(matchingEvent.properties.$survey_response_2.length).to.equal(1)
expect(matchingEvent.properties.$survey_response_2[0]).to.equal('Too expensive')
})

cy.get('.LemonModal').should('not.exist')
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Dashboard', () => {
it('Dashboards loaded', () => {
cy.get('h1').should('contain', 'Dashboards')
// Breadcrumbs work
cy.get('[data-attr=breadcrumb-organization]').should('contain', 'Hogflix')
cy.get('[data-attr=breadcrumb-organization]').should('contain', 'H') // "H" as the lettermark of "Hogflix"
cy.get('[data-attr=breadcrumb-project]').should('contain', 'Hogflix Demo App')
cy.get('[data-attr=breadcrumb-Dashboards]').should('have.text', 'Dashboards')
})
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('Dashboard', () => {

cy.get('.InsightCard').its('length').should('be.gte', 2)
// Breadcrumbs work
cy.get('[data-attr=breadcrumb-organization]').should('contain', 'Hogflix')
cy.get('[data-attr=breadcrumb-organization]').should('contain', 'H') // "H" as the lettermark of "Hogflix"
cy.get('[data-attr=breadcrumb-project]').should('contain', 'Hogflix Demo App')
cy.get('[data-attr=breadcrumb-Dashboards]').should('have.text', 'Dashboards')
cy.get('[data-attr^="breadcrumb-Dashboard:"]').should('have.text', TEST_DASHBOARD_NAME + 'UnnamedCancelSave')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/insights-navigation-open-directly.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Insights', () => {
insight.newInsight('SQL')
insight.updateQueryEditorText(hogQLQuery, 'hogql-query-editor')
cy.get('[data-attr="hogql-query-editor"]').should('exist')
cy.get('tr.DataTable__row').should('have.length.gte', 2)
cy.get('tr.DataVizRow').should('have.length.gte', 2)
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/insights-navigation-open-sql-insight-first.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Insights', () => {
insight.newInsight('SQL')
insight.updateQueryEditorText(hogQLQuery, 'hogql-query-editor')
cy.get('[data-attr="hogql-query-editor"]').should('exist')
cy.get('tr.DataTable__row').should('have.length.gte', 2)
cy.get('tr.DataVizRow').should('have.length.gte', 2)
})

it('can open a new trends insight', () => {
Expand Down Expand Up @@ -68,7 +68,7 @@ describe('Insights', () => {
insight.clickTab('SQL')
insight.updateQueryEditorText(hogQLQuery, 'hogql-query-editor')
cy.get('[data-attr="hogql-query-editor"]').should('exist')
cy.get('tr.DataTable__row').should('have.length.gte', 2)
cy.get('tr.DataVizRow').should('have.length.gte', 2)
})
})
})
Expand Down
7 changes: 3 additions & 4 deletions cypress/e2e/insights-navigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Insights', () => {
cy.contains('.Link', insightName).click()

cy.get('[data-attr="hogql-query-editor"]').should('not.exist')
cy.get('tr.DataTable__row').should('have.length.gte', 2)
cy.get('tr.DataVizRow').should('have.length.gte', 2)

cy.get('[data-attr="insight-edit-button"]').click()
insight.clickTab('RETENTION')
Expand All @@ -50,7 +50,7 @@ describe('Insights', () => {
cy.get('[data-attr="hogql-query-editor"]').should('exist')
insight.updateQueryEditorText(hogQLQuery, 'hogql-query-editor')

cy.get('.DataTable tr').should('have.length.gte', 2)
cy.get('.DataVizRow').should('have.length.gte', 2)

insight.clickTab('TRENDS')
cy.get('.TrendsInsight canvas').should('exist')
Expand All @@ -61,7 +61,7 @@ describe('Insights', () => {
cy.get('[data-attr="hogql-query-editor"]').should('exist')
insight.updateQueryEditorText(hogQLQuery, 'hogql-query-editor')

cy.get('.DataTable tr').should('have.length.gte', 2)
cy.get('.DataVizRow').should('have.length.gte', 2)

insight.clickTab('TRENDS')
cy.get('.TrendsInsight canvas').should('exist')
Expand All @@ -71,7 +71,6 @@ describe('Insights', () => {

it('can open event explorer as an insight', () => {
cy.clickNavMenu('activity')
cy.get('[data-attr="data-table-export-menu"]').click()
cy.get('[data-attr="open-json-editor-button"]').click()
cy.get('[data-attr="insight-json-tab"]').should('exist')
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/insights.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Insights', () => {
it('Saving an insight sets breadcrumbs', () => {
createInsight('insight name')

cy.get('[data-attr=breadcrumb-organization]').should('contain', 'Hogflix')
cy.get('[data-attr=breadcrumb-organization]').should('contain', 'H') // "H" as the lettermark of "Hogflix"
cy.get('[data-attr=breadcrumb-project]').should('contain', 'Hogflix Demo App')
cy.get('[data-attr=breadcrumb-SavedInsights]').should('have.text', 'Product analytics')
cy.get('[data-attr^="breadcrumb-Insight:"]').should('have.text', 'insight name')
Expand Down
Loading

0 comments on commit d274bea

Please sign in to comment.