From f88805e4884375b9eb30c3e48e1bcefbffbc02da Mon Sep 17 00:00:00 2001 From: dwyfrequency Date: Fri, 19 Aug 2022 17:10:41 -0400 Subject: [PATCH] Update Auth Firefox cross browser action to only run on changed auth files (#6546) * Update trigger condition for cross browser tests * Update github action * touch auth file * Revert touching auth file * Add note describing crossBrowserPackages object * Update comment describing crossBrowserPackages --- .github/workflows/test-changed-auth.yml | 6 +----- scripts/run_tests_in_ci.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-changed-auth.yml b/.github/workflows/test-changed-auth.yml index bdb224a9326..1902b136caa 100644 --- a/.github/workflows/test-changed-auth.yml +++ b/.github/workflows/test-changed-auth.yml @@ -63,10 +63,6 @@ jobs: - name: build run: yarn build:changed auth - name: Run tests on auth changed packages - run: xvfb-run yarn --cwd packages/auth test:browser:unit - env: - BROWSERS: 'Firefox' - - name: Run tests on auth-compat changed packages - run: xvfb-run yarn --cwd packages/auth-compat test:browser:unit + run: xvfb-run yarn test:changed auth env: BROWSERS: 'Firefox' diff --git a/scripts/run_tests_in_ci.js b/scripts/run_tests_in_ci.js index 775a430755c..ceaff03fa90 100644 --- a/scripts/run_tests_in_ci.js +++ b/scripts/run_tests_in_ci.js @@ -21,6 +21,9 @@ const { spawn } = require('child-process-promise'); const { writeFileSync } = require('fs'); const LOGDIR = process.env.CI ? process.env.HOME : '/tmp'; +// Maps the packages where we should not run `test:all` and instead isolate the cross-browser tests. +// TODO(dwyfrequency): Update object with `storage` and `firestore` packages. +const crossBrowserPackages = { 'packages/auth': 'test:browser:unit' }; function writeLogs(status, name, logText) { const safeName = name.replace(/@/g, 'at_').replace(/\//g, '_'); @@ -49,13 +52,20 @@ const argv = yargs.options({ (async () => { const myPath = argv.d; - const scriptName = argv.s; + let scriptName = argv.s; const dir = path.resolve(myPath); const { name } = require(`${dir}/package.json`); let stdout = ''; let stderr = ''; try { + if (process.env?.BROWSERS) { + for (const package in crossBrowserPackages) { + if (dir.endsWith(package)) { + scriptName = crossBrowserPackages[package]; + } + } + } const testProcess = spawn('yarn', ['--cwd', dir, scriptName]); testProcess.childProcess.stdout.on('data', data => {