Skip to content

[Interactive Graph] Vector graph description polish. #20978

[Interactive Graph] Vector graph description polish.

[Interactive Graph] Vector graph description polish. #20978

Workflow file for this run

name: Node CI
on:
workflow_dispatch:
pull_request:
# edited is needed because that's the trigger when the base branch is
# changed on a PR
# The rest are the defaults.
types: [edited, opened, synchronize, reopened]
# Although our GITHUB_TOKEN has enough permissions for standard PRs, when these
# actions are run for Dependabot PRs, we need to explicitly increase access.
permissions:
contents: read
pull-requests: write
issues: write
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changeset:
name: Check for .changeset entries for all changed files
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
runs-on: ${{ vars.USE_GITHUB_RUNNERS == 'true' && '${{ matrix.os }}' || 'ephemeral-runner' }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [24.x]
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Secure Network
uses: Khan/actions@secure-network-v1
timeout-minutes: 5
with:
conf-files: .github/npm-extra-domains.conf
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
name: Install pnpm
with:
run_install: false
- name: Force Node version
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.node-version }}
# Note that we don't specify 'cache: pnpm' here because we
# don't install node_modules in this workflow/job!
- name: Get changed files
uses: Khan/actions@30cadf1146cce2e3cdd2510dc8378063e9b08b58 # get-changed-files-v3
id: changed
- name: Filter out files that don't need a changeset
uses: Khan/actions@069171ef7dea82ab80a8e499c4217d9b812f6af4 # filter-files-v3
id: match
with:
changed-files: ${{ steps.changed.outputs.files }}
files: "packages/, config/build/" # Only look for changes in packages, build
globs: "!(**/__tests__/*), !(**/__testdata__/*), !(**/__stories__/*), !(**/__docs__/*), !(**/dist/*), !(**/*.test.ts), !(**/*.test.tsx)" # Ignore test files
matchAllGlobs: true # Default is to match any of the globs, which ends up matching all files
conjunctive: true # Only match files that match all of the above
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
with:
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}
- name: Verify changeset entries
uses: Khan/actions@4c5c5cbcfcdb1c059c9601b41bb686e75cc52544 # check-for-changeset-v2
with:
exclude: .github/,.storybook/
exclude_extensions: .test.ts, .test.tsx, .stories.ts, .stories.tsx, .mdx
exclude_globs: "**/__tests__/*, **/__docs__/*"
lint:
name: Lint, Typecheck, Format, and Test
runs-on: ${{ vars.USE_GITHUB_RUNNERS == 'true' && '${{ matrix.os }}' || 'ephemeral-runner' }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [24.x]
steps:
- name: Checking out latest commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Secure Network
uses: Khan/actions@secure-network-v1
timeout-minutes: 5
with:
conf-files: .github/npm-extra-domains.conf
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
- name: Get All Changed Files
uses: Khan/actions@30cadf1146cce2e3cdd2510dc8378063e9b08b58 # get-changed-files-v3
id: changed
- name: Check formatting
run: |
pnpm prettier --check .
- name: Check for dead code
run: |
pnpm knip
- id: js-files
name: Find .js(x)/.ts(x) changed files
uses: Khan/actions@069171ef7dea82ab80a8e499c4217d9b812f6af4 # filter-files-v3
with:
changed-files: ${{ steps.changed.outputs.files }}
extensions: ".js,.jsx,.ts,.tsx"
files: "pnpm-lock.yaml,tsconfig-build.json,tsconfig-common.json,tsconfig.json,packages/tsconfig-shared.json"
- id: eslint-reset
uses: Khan/actions@069171ef7dea82ab80a8e499c4217d9b812f6af4 # filter-files-v3
name: Files that would trigger a full eslint run
with:
changed-files: ${{ steps.changed.outputs.files }}
files: ".eslintrc.js,package.json,pnpm-lock.yaml,.eslintignore"
# Linting / type checking
- name: Eslint
uses: Khan/actions@8b8506a789a5c2a4a90bd8da8b6801db6931ee2d # full-or-limited-v0
with:
full-trigger: ${{ steps.eslint-reset.outputs.filtered }}
full: pnpm lint packages
limited-trigger: ${{ steps.js-files.outputs.filtered }}
limited: pnpm lint {}
- name: Typecheck
if: (success() || failure()) && steps.js-files.outputs.filtered != '[]'
run: pnpm typecheck
- name: Typetest
if: (success() || failure()) && steps.js-files.outputs.filtered != '[]'
run: pnpm tstyche
- name: Build types
if: (success() || failure()) && steps.js-files.outputs.filtered != '[]'
run: pnpm build:types
# We build the docs in this job so that typedoc can check any
# comment changes to ensure they are valid.
- name: Build docs
run: pnpm build:docs
# Run tests for our target matrix
- id: jest-reset
uses: Khan/actions@069171ef7dea82ab80a8e499c4217d9b812f6af4 # filter-files-v3
name: Files that would trigger a full jest run
with:
changed-files: ${{ steps.changed.outputs.files }}
files: "jest.config.js,package.json,pnpm-lock.yaml,test.config.js,test.transform.js"
- name: Jest
uses: Khan/actions@8b8506a789a5c2a4a90bd8da8b6801db6931ee2d # full-or-limited-v0
with:
full-trigger: ${{ steps.jest-reset.outputs.filtered }}
full: pnpm jest
limited-trigger: ${{ steps.js-files.outputs.filtered }}
limited: pnpm jest --passWithNoTests --findRelatedTests {}
# We use STOPSHIP internally to mark code that's not safe to go live yet.
# We use an if block because we want to return the exact inverse of what
# `git grep` returns (0 on none found, 1 on some found).
- name: Checks that STOPSHIP is not used in any files.
run: ./utils/stopship-check.sh
cypress:
name: Cypress
runs-on: ${{ vars.USE_GITHUB_RUNNERS == 'true' && '${{ matrix.os }}' || 'ephemeral-runner' }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [24.x]
steps:
- name: Checking out latest commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Secure Network
uses: Khan/actions@secure-network-v1
timeout-minutes: 5
with:
conf-files: .github/npm-extra-domains.conf
# ka-perseus-graphie.s3.amazonaws.com: some tests load images from here
extra-domains: ka-perseus-graphie.s3.amazonaws.com
# MUST be before we install node_modules as that depends on finding
# Cypress binaries in this cache!
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ~/.cache/Cypress
# Generate a new cache whenever the lock file changes
key: ${{ runner.os }}-cypress-${{ hashFiles('**/pnpm-lock.yaml') }}
# If source files changed, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-cypress-
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
# We _should_ have a valid Cypress binary in place at this point,
# but we _could_ have had a cache miss on `~/.cache/Cypress` but a
# cache hit on `node_modules` leaving us in a state where the
# Cypress binary isn't available. This step ensures that the
# Cypress binary is in place
- name: Install Cypress
run: pnpm exec cypress install
- name: Run tests
run: pnpm cypress:ci
- name: Upload Screenshots
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: failure()
with:
name: cypress-screenshots
path: ./cypress/screenshots
check_builds:
name: Check builds for changes in size
runs-on: ${{ vars.USE_GITHUB_RUNNERS == 'true' && '${{ matrix.os }}' || 'ephemeral-runner' }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [24.x]
steps:
- name: Checking out latest commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Secure Network
uses: Khan/actions@secure-network-v1
timeout-minutes: 5
with:
conf-files: .github/npm-extra-domains.conf
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
# Make sure our packages aren't growing unexpectedly. This must come
# last as it builds the old code last and so leaves the wrong code
# in place for the next job; in other words, it leaves the repo on a
# base branch.
- name: Check Builds
uses: preactjs/compressed-size-action@66325aad6443cb7cf89c4bfcd414aea2367cda94 # v2
with:
# We only care about the ES module size, really:
pattern: "**/dist/es/*.js"
# Always ignore SourceMaps and node_modules:
exclude: "{**/*.map,**/node_modules/**}"
# Clean up before a build
clean-script: "clean"
# Build production
build-script: "build:prodsizecheck"
#
# Do not place any steps after "Check Builds"
#