mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
* chore: use pnpm to manage dependencies * Fix CI errors * Don't report Docker image size for external PRs * Fix pnpm-lock.yaml formatting * Fix module versions * Ignore pnpm-lock.yaml * Upgrade Cypress action for pnpm support * Set up node and pnpm before Cypress * Fix typescript issues * Include patches directory in Dockerfile * Fix Jest tests in CI * Update lockfile * Update lockfile * Clean up Dockerfile * Update pnpm-lock.yaml to reflect current package.json files * remove yarn-error.log from .gitignore * formatting * update data exploration readme * type jest.config.ts * fix @react-hook issues for jest * fix react-syntax-highlighter issues for jest * fix jest issues from query-selector-shadow-dom * fix transform ignore patterns and undo previous fixes * add missing storybook peer dependencies * fix nullish coalescing operator for storybook * reorder storybook plugins * update editor-update-tsd warning to new npm script * use legacy ssl for chromatic / node 18 compatibility * use pnpm for visual regression testing workflow * use node 16 for chromatic * add @babel/plugin-proposal-nullish-coalescing-operator as direct dependency * try fix for plugin-server * cleanup * fix comment and warning * update more comments * update playwright dockerfile * update plugin source types * conditional image size reporting * revert react-native instructions * less restrictive pnpm verions * use ref component name in line with style guide Co-authored-by: Jacob Gillespie <jacobwgillespie@gmail.com>
111 lines
3.8 KiB
YAML
111 lines
3.8 KiB
YAML
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
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
frontend-code-quality:
|
|
name: Code quality checks
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
|
|
- name: Set up Node 16
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: pnpm
|
|
|
|
- name: Install package.json dependencies with pnpm
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Check formatting with prettier
|
|
run: pnpm prettier:check
|
|
|
|
- name: Lint with ESLint
|
|
run: pnpm eslint
|
|
|
|
- name: Generate logic types and run typescript with strict
|
|
run: pnpm typegen:write && pnpm typescript:check
|
|
|
|
jest-setup:
|
|
# Split the tests into multiple chunks
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
|
|
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
- name: Set up Node 16
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- id: set-test-chunks
|
|
name: Set Chunks
|
|
# Looks at the output of 'pnpm test -- --listTests --json'
|
|
# Take the 5th line of the output (the first two are pnpm non-sense)
|
|
# Split the test into 3 parts. To increase the number split change the denominator in `length / 3`
|
|
run: echo "test-chunks=$(pnpm test -- --listTests --json | sed -n 5p | jq -cM '[_nwise(length / 3 | ceil)]')" >> $GITHUB_OUTPUT
|
|
- id: set-test-chunk-ids
|
|
name: Set Chunk IDs
|
|
run: echo "test-chunk-ids=$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')" >> $GITHUB_OUTPUT
|
|
env:
|
|
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
|
|
|
|
jest:
|
|
runs-on: ubuntu-20.04
|
|
name: Jest test (${{ matrix.chunk }})
|
|
needs: [jest-setup]
|
|
|
|
strategy:
|
|
# If one test fails, still run the others
|
|
fail-fast: false
|
|
matrix:
|
|
chunk: ${{fromJson(needs.jest-setup.outputs['test-chunk-ids'])}}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
|
|
- name: Set up Node 16
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: pnpm
|
|
|
|
- name: Install package.json dependencies with pnpm
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Test with Jest
|
|
# set maxWorkers or Jest only uses 1 CPU in GitHub Actions
|
|
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs pnpm test -- --maxWorkers=2
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=6144
|
|
CHUNKS: ${{ needs.jest-setup.outputs['test-chunks'] }}
|