MM-69003 Mostly share ESLint config between web app and E2E tests (#36767)

* Switch Cypress to use shared ESLint config

* Run --fix in Cypress

* Manually fix remaining lint issues in Cypress

* Switch Playwright to use shared ESLint config

* Run --fix in Playwright

* Manually fix remaining lint issues in Playwright

* Install and cache web app deps during Cypress CI builds

This also caches the types and client package. That isn't needed currently
since it uses prepackaged versions of those, but I imagine we might change
that at some point.

* Run e2e-tests-check when ESLint plugin is updated

* Change E2E test GHA caching to cache all of web app node_modules

* Fix mismatch between cache save and restore

* Try bumping cache keys

* Copy step to install dependencies to server.run_cypress.sh

I don't know how this must've worked before, but if this fixes the issue,
it seems like neither Cypress nor Playwright actually use the cached
depenendencies.

* Try disabling caching entirely for Cypress tests

* Try bypassing makefile?

* Try also manually building dependencies in run_specs.sh

I don't know why this appears to duplicate run_cypress.sh and
run_playwright.sh, both of which are called run_test.sh which
might not be used any more as best I can tell.

* Try installing the web app dependencies in yet another place

* Disable the extra steps in server.prepare.sh specifically for Cypress

* Revert changes to update cache key and disable web app depenedency cache on Cypress builds
This commit is contained in:
Harrison Healey
2026-06-09 20:50:58 +00:00
committed by GitHub
parent cc1547ac46
commit f3836530b7
388 changed files with 1229 additions and 3354 deletions
+6 -3
View File
@@ -5,6 +5,7 @@ on:
paths:
- "e2e-tests/**"
- "webapp/platform/client/**"
- "webapp/platform/eslint-plugin/**"
- "webapp/platform/types/**"
- ".github/workflows/e2e-*.yml"
@@ -38,6 +39,11 @@ jobs:
# failures in npm's cacache writer.
run: npm cache verify
# Set up web app subpackages and eslint plugin
- name: ci/get-webapp-node-modules
working-directory: webapp
run: make node_modules
# Cypress check
- name: ci/cypress/npm-install
working-directory: e2e-tests/cypress
@@ -47,9 +53,6 @@ jobs:
run: npm run check
# Playwright check
- name: ci/get-webapp-node-modules
working-directory: webapp
run: make node_modules
- name: ci/playwright/npm-install
working-directory: e2e-tests/playwright
run: npm ci
@@ -216,6 +216,25 @@ jobs:
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: ".nvmrc"
- name: ci/cache-platform-pkgs
# `webapp/node_modules/@mattermost/{client,types}` are the workspace
# symlinks Node walks up to find when platform/client requires
# @mattermost/types. Without them, module resolution fails inside
# the slim slice.
id: cache-platform-pkgs
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
webapp/**/node_modules
webapp/platform/client/lib
webapp/platform/types/lib
key: e2e-platform-pkgs-${{ runner.os }}-${{ hashFiles('webapp/package-lock.json', 'webapp/platform/client/src/**', 'webapp/platform/client/tsconfig*.json', 'webapp/platform/types/src/**', 'webapp/platform/types/tsconfig*.json') }}
- name: ci/build-platform-pkgs
# Full webapp install is needed for tsc + workspace linking; the
# postinstall builds platform/{client,types}/lib. We only cache those.
if: steps.cache-platform-pkgs.outputs.cache-hit != 'true'
working-directory: webapp
run: make node_modules
- name: ci/cache-cypress-deps
# node_modules + the cypress binary (downloaded to ~/.cache/Cypress by
# cypress's postinstall, not into node_modules). Both must be cached;
@@ -317,6 +336,17 @@ jobs:
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: ".nvmrc"
- name: ci/restore-platform-pkgs
# Built lib/ for @mattermost/client and @mattermost/types, plus the
# webapp workspace symlinks under webapp/node_modules/@mattermost/.
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
webapp/**/node_modules
webapp/platform/client/lib
webapp/platform/types/lib
key: e2e-platform-pkgs-${{ runner.os }}-${{ hashFiles('webapp/package-lock.json', 'webapp/platform/client/src/**', 'webapp/platform/client/tsconfig*.json', 'webapp/platform/types/src/**', 'webapp/platform/types/tsconfig*.json') }}
fail-on-cache-miss: true
- name: ci/restore-cypress-deps
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
@@ -222,6 +222,14 @@ jobs:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: "e2e-tests/cypress/package-lock.json"
- name: ci/npm-cache-verify
# Heal any partial/dangling entries left in the restored ~/.npm cache
# before running `npm ci`. Avoids the intermittent EEXIST/ENOENT
# failures in npm's cacache writer.
run: npm cache verify
- name: ci/get-webapp-node-modules
working-directory: webapp
run: make node_modules
- name: ci/run-tests
run: |
make cloud-init
@@ -192,12 +192,9 @@ jobs:
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
webapp/node_modules/@mattermost/client
webapp/node_modules/@mattermost/types
webapp/**/node_modules
webapp/platform/client/lib
webapp/platform/client/node_modules
webapp/platform/types/lib
webapp/platform/types/node_modules
key: e2e-platform-pkgs-${{ runner.os }}-${{ hashFiles('webapp/package-lock.json', 'webapp/platform/client/src/**', 'webapp/platform/client/tsconfig*.json', 'webapp/platform/types/src/**', 'webapp/platform/types/tsconfig*.json') }}
- name: ci/build-platform-pkgs
# Full webapp install is needed for tsc + workspace linking; the
@@ -319,12 +316,9 @@ jobs:
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
webapp/node_modules/@mattermost/client
webapp/node_modules/@mattermost/types
webapp/**/node_modules
webapp/platform/client/lib
webapp/platform/client/node_modules
webapp/platform/types/lib
webapp/platform/types/node_modules
key: e2e-platform-pkgs-${{ runner.os }}-${{ hashFiles('webapp/package-lock.json', 'webapp/platform/client/src/**', 'webapp/platform/client/tsconfig*.json', 'webapp/platform/types/src/**', 'webapp/platform/types/tsconfig*.json') }}
fail-on-cache-miss: true
- name: ci/restore-playwright-deps