Bug 1957705 - Switch newtab and messaging system node tests to use toolchains for node modules. r=releng-reviewers,jcristau

This avoids the tests running npm ci on every run.

Differential Revision: https://phabricator.services.mozilla.com/D244071
This commit is contained in:
Mark Banner
2025-04-02 08:08:59 +00:00
parent b8e5807722
commit 64129eaeeb
4 changed files with 101 additions and 20 deletions

View File

@@ -37,6 +37,14 @@ path:package.json
path:package-lock.json
path:tools/lint/
# for other node toolchain packaging
path:browser/extensions/newtab/package.json
path:browser/extensions/newtab/package-lock.json
path:browser/components/aboutwelcome/package.json
path:browser/components/aboutwelcome/package-lock.json
path:browser/components/asrouter/package.json
path:browser/components/asrouter/package-lock.json
# for new-style try pushes
path:try_task_config.json

View File

@@ -33,14 +33,14 @@ newtab-unit-tests:
- target.tar.xz
toolchain:
- linux64-node
- node-modules
- newtab-node-modules
run:
command: >
cd /builds/worker/checkouts/gecko &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/node_modules node_modules &&
cd /builds/worker/checkouts/gecko/browser/extensions/newtab &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/newtab/node_modules node_modules &&
FIREFOX_BIN=$MOZ_FETCHES_DIR/firefox/firefox node bin/try-runner.js
when:
files-changed:
@@ -66,14 +66,14 @@ newtab-unit-tests-ccov:
- target.tar.xz
toolchain:
- linux64-node
- node-modules
- newtab-node-modules
run:
command: >
cd /builds/worker/checkouts/gecko &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/node_modules node_modules &&
cd /builds/worker/checkouts/gecko/browser/extensions/newtab &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/newtab/node_modules node_modules &&
FIREFOX_BIN=$MOZ_FETCHES_DIR/firefox/firefox node bin/try-runner.js
# This should only run on mozilla-central, as the bot will only parse mozilla-central
# coverage anyways.
@@ -94,17 +94,19 @@ messagingsystem-unit-tests:
linux1804-64/opt: build-linux64/opt
default:
linux1804-64/opt: build-linux64-shippable/opt
fetches:
toolchain:
- node-modules
- aboutwelcome-node-modules
- asrouter-node-modules
run:
command: >
cd /builds/worker/checkouts/gecko &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/node_modules node_modules &&
cd /builds/worker/checkouts/gecko/browser/components/aboutwelcome &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/aboutwelcome/node_modules node_modules &&
cd /builds/worker/checkouts/gecko/browser/components/asrouter &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/asrouter/node_modules node_modules &&
node bin/try-runner.js
when:
files-changed:
@@ -126,17 +128,19 @@ messagingsystem-unit-tests-ccov:
linux1804-64/opt: build-linux64/opt
default:
linux1804-64/opt: build-linux64-shippable/opt
fetches:
toolchain:
- node-modules
- aboutwelcome-node-modules
- asrouter-node-modules
run:
command: >
cd /builds/worker/checkouts/gecko &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/node_modules node_modules &&
cd /builds/worker/checkouts/gecko/browser/components/aboutwelcome &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/aboutwelcome/node_modules node_modules &&
cd /builds/worker/checkouts/gecko/browser/components/asrouter &&
rm -rf node_modules &&
npm ci &&
cp -r $MOZ_FETCHES_DIR/asrouter/node_modules node_modules &&
node bin/try-runner.js
# This should only run on mozilla-central, as the bot will only parse mozilla-central
# coverage anyways.

View File

@@ -407,6 +407,38 @@ browsertime:
toolchain:
- linux64-node
aboutwelcome-node-modules:
description: "npm install aboutwelcome node_modules"
treeherder:
symbol: TL(aboutwelcome-node)
run:
script: generic-node-modules.sh
arguments: ['aboutwelcome', 'browser/components/aboutwelcome/']
sparse-profile: null
resources:
- 'browser/components/aboutwelcome/package.json'
- 'browser/components/aboutwelcome/package-lock.json'
toolchain-artifact: public/build/aboutwelcome-node-modules.tar.zst
fetches:
toolchain:
- linux64-node
asrouter-node-modules:
description: "npm install asrouter node_modules"
treeherder:
symbol: TL(asrouter-node)
run:
script: generic-node-modules.sh
arguments: ['asrouter', 'browser/components/asrouter/']
sparse-profile: null
resources:
- 'browser/components/asrouter/package.json'
- 'browser/components/asrouter/package-lock.json'
toolchain-artifact: public/build/asrouter-node-modules.tar.zst
fetches:
toolchain:
- linux64-node
eslint-plugin-mozilla:
description: "npm install eslint-plugin-mozilla node_modules"
treeherder:
@@ -422,6 +454,23 @@ eslint-plugin-mozilla:
toolchain:
- linux64-node
newtab-node-modules:
description: "npm install newtab node_modules"
treeherder:
symbol: TL(newtab-node)
run:
script: generic-node-modules.sh
arguments: ['newtab', 'browser/extensions/newtab/']
sparse-profile: null
resources:
- 'browser/extensions/newtab/package.json'
- 'browser/extensions/newtab/package-lock.json'
toolchain-artifact: public/build/newtab-node-modules.tar.zst
fetches:
toolchain:
- linux64-node
node-modules:
description: "npm install top-level node_modules"
treeherder:

View File

@@ -0,0 +1,20 @@
#!/bin/bash -vex
set -x -e
echo "running as" $(id)
set -v
cd $GECKO_PATH
export PATH=$PATH:$MOZ_FETCHES_DIR/node/bin
rm -rf $2/node_modules
npm ci --prefix $2
# We have $2/{node_modules,...} and want $1/{node_modules}.
mkdir -p /builds/worker/artifacts
cd $2
cd ..
tar caf /builds/worker/artifacts/$1-node-modules.tar.zst $1/node_modules