Skip to content

Commit

Permalink
Merge branch 'master' into column-expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Nov 22, 2023
2 parents e944e91 + bcff0ea commit 5f8e01a
Show file tree
Hide file tree
Showing 572 changed files with 10,060 additions and 4,223 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const globals = {
}

module.exports = {
ignorePatterns: ['node_modules', 'plugin-server'],
ignorePatterns: ['node_modules', 'plugin-server', 'cypress'],
env,
settings: {
react: {
Expand Down
64 changes: 58 additions & 6 deletions .github/workflows/ci-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Frontend CI

on:
pull_request:
# NOTE: by running on master, aside from highlight issues on master it also
# ensures we have e.g. node modules cached for master, which can then be
# used for branches. See https://github.com/actions/cache#cache-scopes for
# scope details.
push:
branches:
- master
Expand All @@ -15,53 +11,103 @@ concurrency:
cancel-in-progress: true

jobs:
# Job to decide if we should run frontend ci
# See https://github.com/dorny/paths-filter#conditional-execution for more details
# we skip each step individually, so they are still reported as success
# because many of them are required for CI checks to be green
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
name: Determine need to run frontend checks
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
steps:
# For pull requests it's not necessary to check out the code, but we
# also want this to run on master, so we need to check out
- uses: actions/checkout@v3

- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
frontend:
# Avoid running frontend tests for irrelevant changes
# NOTE: we are at risk of missing a dependency here.
- 'bin/**'
- 'frontend/**'
# Make sure we run if someone is explicitly change the workflow
- .github/workflows/ci-frontend.yml
# various JS config files
- .eslintrc.js
- .prettier*
- babel.config.js
- jest.*.ts
- tsconfig.json
- tsconfig.*.json
- webpack.config.js
- postcss.config.js
- stylelint*
frontend-code-quality:
name: Code quality checks
needs: changes
# kea typegen and typescript:check need some more oomph
runs-on: ubuntu-latest
steps:
# we need at least one thing to run to make sure we include everything for required jobs
- uses: actions/checkout@v3

- name: Install pnpm
if: needs.changes.outputs.frontend == 'true'
uses: pnpm/action-setup@v2
with:
version: 8.x.x

- name: Set up Node.js
uses: buildjet/setup-node@v3
if: needs.changes.outputs.frontend == 'true'
uses: actions/setup-node@v3
with:
node-version: 18

- name: Get pnpm cache directory path
if: needs.changes.outputs.frontend == 'true'
id: pnpm-cache-dir
run: echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
if: needs.changes.outputs.frontend == 'true'
id: pnpm-cache
with:
path: ${{ steps.pnpm-cache-dir.outputs.PNPM_STORE_PATH }}
key: ${{ runner.os }}-pnpm-cypress-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-cypress-

- name: Install package.json dependencies with pnpm
if: needs.changes.outputs.frontend == 'true'
run: pnpm install --frozen-lockfile

- name: Check formatting with prettier
if: needs.changes.outputs.frontend == 'true'
run: pnpm prettier:check

- name: Lint with Stylelint
if: needs.changes.outputs.frontend == 'true'
run: pnpm lint:css

- name: Generate logic types and run typescript with strict
if: needs.changes.outputs.frontend == 'true'
run: pnpm typegen:write && pnpm typescript:check

- name: Lint with ESLint
if: needs.changes.outputs.frontend == 'true'
run: pnpm lint:js

- name: Check if "schema.json" is up to date
if: needs.changes.outputs.frontend == 'true'
run: pnpm schema:build:json && git diff --exit-code

- name: Check toolbar bundle size
if: needs.changes.outputs.frontend == 'true'
uses: preactjs/compressed-size-action@v2
with:
build-script: 'build'
Expand All @@ -70,6 +116,7 @@ jobs:

jest:
runs-on: ubuntu-latest
needs: changes
name: Jest test (${{ matrix.chunk }})

strategy:
Expand All @@ -79,24 +126,29 @@ jobs:
chunk: [1, 2, 3]

steps:
# we need at least one thing to run to make sure we include everything for required jobs
- uses: actions/checkout@v3

- name: Install pnpm
if: needs.changes.outputs.frontend == 'true'
uses: pnpm/action-setup@v2
with:
version: 8.x.x

- name: Set up Node.js
uses: buildjet/setup-node@v3
if: needs.changes.outputs.frontend == 'true'
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Install package.json dependencies with pnpm
if: needs.changes.outputs.frontend == 'true'
run: pnpm install --frozen-lockfile

- name: Test with Jest
# set maxWorkers or Jest only uses 1 CPU in GitHub Actions
run: pnpm test:unit --maxWorkers=2 --shard=${{ matrix.chunk }}/3
if: needs.changes.outputs.frontend == 'true'
env:
NODE_OPTIONS: --max-old-space-size=6144
9 changes: 9 additions & 0 deletions .run/Dev.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev" type="CompoundRunConfigurationType">
<toRun name="PostHog" type="Python.DjangoServer" />
<toRun name="Frontend" type="js.build_tools.npm" />
<toRun name="Plugin Server" type="js.build_tools.npm" />
<toRun name="Celery" type="PythonConfigurationType" />
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changelog

Updates to the PostHog project can be found on [https://posthog.com/changelog](our changelog).
Updates to the PostHog project can be found on [our changelog](https://posthog.com/changelog).
2 changes: 1 addition & 1 deletion cypress/e2e/early-access-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Early Access Management', () => {
it('Early access feature new and list', () => {
// load an empty early access feature page
cy.get('h1').should('contain', 'Early Access Management')
cy.title().should('equal', 'Early Access Management • PostHog')
cy.title().should('equal', 'Early access features • PostHog')
cy.get('h2').should('contain', 'Create your first feature')
cy.get('[data-attr="product-introduction-docs-link"]').should(
'contain',
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 @@ -24,7 +24,7 @@ describe('Insights', () => {

cy.get('[data-attr=breadcrumb-0]').should('contain', 'Hogflix')
cy.get('[data-attr=breadcrumb-1]').should('contain', 'Hogflix Demo App')
cy.get('[data-attr=breadcrumb-2]').should('have.text', 'Insights')
cy.get('[data-attr=breadcrumb-2]').should('have.text', 'Product analytics')
cy.get('[data-attr=breadcrumb-3]').should('have.text', 'insight name')
})

Expand Down
Loading

0 comments on commit 5f8e01a

Please sign in to comment.