Skip to content

Commit

Permalink
Merge branch 'main' into feature/editor-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremywiebe committed Jan 17, 2024
2 parents 0498106 + a547933 commit 56fa03f
Show file tree
Hide file tree
Showing 111 changed files with 3,394 additions and 2,146 deletions.
5 changes: 0 additions & 5 deletions .changeset/curly-jobs-sit.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fair-kids-prove.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/perfect-eels-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": minor
---

Update Perseus' Storybook to use MathJax instead of KaTeX
2 changes: 0 additions & 2 deletions .changeset/red-boats-learn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tender-tomatoes-flow.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tricky-suns-sneeze.md

This file was deleted.

21 changes: 20 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"containerEnv": { "NODE_OPTIONS": "--openssl-legacy-provider" }
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:16",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [6006],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "yarn install"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
27 changes: 27 additions & 0 deletions .github/actions/shared-node-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Shared Node Cache"
description: "Install & cache our npm dependencies"

# The inputs this action expects.
inputs:
node-version:
description: "Node version to use"
required: true
ssh-private-key:
description: "A private SSH key so that we can obtain private dependencies like our event schema package"
required: true

# The steps this action runs.
# The order of the two steps below needs to be maintained.
# The ssh-agent step needs to be before the Node.js/Install step because our package.json uses
# git+ssh. As this requires a valid SSH key, the ssh-agent action must be before the yarn install.
runs:
using: "composite"
steps:
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ inputs.ssh-private-key }}

- name: Use Node.js ${{ inputs.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
with:
node-version: ${{ inputs.node-version }}
21 changes: 12 additions & 9 deletions .github/workflows/node-ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ jobs:
os: [ubuntu-latest]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- uses: actions/checkout@v4
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

coverage:
needs: [prime_cache_primary]
Expand All @@ -40,12 +41,13 @@ jobs:
os: [ubuntu-latest]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Jest with coverage
run: yarn coverage
Expand All @@ -66,12 +68,13 @@ jobs:
node-version: [20.x]
steps:
- name: Checking out latest commit
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Run test with coverage
run: yarn cypress:ci
89 changes: 53 additions & 36 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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
Expand All @@ -18,7 +19,7 @@ jobs:
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -36,6 +37,10 @@ jobs:
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/[email protected]
with:
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Verify changeset entries
uses: Khan/[email protected]
with:
Expand All @@ -50,12 +55,13 @@ jobs:
node-version: [20.x]
steps:
- name: Checking out latest commit
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Get All Changed Files
uses: Khan/actions@get-changed-files-v1
Expand Down Expand Up @@ -128,26 +134,27 @@ jobs:
node-version: [20.x]
steps:
- name: Checking out latest commit
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Run test with coverage
run: yarn cypress:ci

# Upload coverage report as an GitHub artifact so that it can be used
# later in upload_coverage.
- name: Upload Artifact
uses: actions/upload-artifact@v2
- name: Upload Cypress Coverage
uses: actions/upload-artifact@v4
with:
name: cypress-coverage
path: ./.nyc_output/out.json

- name: Upload Cypress Screenshots
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
Expand All @@ -161,20 +168,21 @@ jobs:
os: [ubuntu-latest]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Jest with coverage
run: yarn coverage

# Upload coverage report as an GitHub artifact so that it can be used
# later in upload_coverage.
- name: Upload Artifact
uses: actions/upload-artifact@v2
- name: Upload Jest Coverage
uses: actions/upload-artifact@v4
with:
name: jest-coverage
path: ./coverage/coverage-final.json
Expand All @@ -184,23 +192,24 @@ jobs:
runs-on: ubuntu-latest
needs: [cypress, coverage]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Download Jest Coverage
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: jest-coverage
# path to decompress the artifact into, decompressed file
# will be ./coverage-final.json
path: ./

- name: Download Cypress Coverage
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: cypress-coverage
# path to decompress the artifact into, decompressed file
Expand All @@ -225,15 +234,16 @@ jobs:
node-version: [20.x]
steps:
- name: Checking out latest commit
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}
# 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.
# 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@v2
with:
Expand All @@ -246,6 +256,10 @@ jobs:
# Build production
build-script: "build:prodsizecheck"

#
# Do not place any steps after "Check Builds"
#

extract_strings:
name: Extract i18n strings
runs-on: ${{ matrix.os }}
Expand All @@ -254,12 +268,13 @@ jobs:
os: [ubuntu-latest]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Extract strings
run: yarn extract-strings
Expand All @@ -279,19 +294,20 @@ jobs:
steps:
# We need to checkout all history, so that the changeseat tool can diff it
- name: Checkout current commit
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Ensure main branch is avaialble
- name: Ensure main branch is available
run: |
REF=$(git rev-parse HEAD)
git checkout main
git checkout $REF
- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Publish Snapshot Release to npm
id: publish-snapshot
Expand Down Expand Up @@ -329,7 +345,7 @@ jobs:
body: |
# npm Snapshot: Published
🎉 Good news!! We've packaged up the latest commit from this PR (${{
Good news!! We've packaged up the latest commit from this PR (${{
steps.short-sha.outputs.short_sha }}) and published it to npm. You
can install it using the tag `${{
steps.publish-snapshot.outputs.npm_snapshot_tag }}`.
Expand All @@ -350,7 +366,7 @@ jobs:
body: |
# npm Snapshot: **NOT** Published
🤕 Oh noes!! We couldn't find any changesets in this PR (${{
Oh noes!! We couldn't find any changesets in this PR (${{
steps.short-sha.outputs.short_sha }}). As a result, we did not
publish an npm snapshot for you.
Expand All @@ -365,14 +381,15 @@ jobs:
# chromaui/@action doesn't work with shallow checkouts which is the
# default for actions/checkout so we need to force it to checkout
# more stuff.
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }} & Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
- name: Install & cache node_modules
uses: ./.github/actions/shared-node-cache
with:
node-version: ${{ matrix.node-version }}
ssh-private-key: ${{ secrets.KHAN_ACTIONS_BOT_SSH_PRIVATE_KEY }}

- name: Publish to Chromatic
uses: chromaui/action@v1
Expand Down
Loading

0 comments on commit 56fa03f

Please sign in to comment.