Skip to content

Commit

Permalink
Update Auth Firefox cross browser action to only run on changed auth …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
dwyfrequency authored Aug 19, 2022
1 parent bea604e commit f88805e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test-changed-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
12 changes: 11 additions & 1 deletion scripts/run_tests_in_ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '_');
Expand Down Expand Up @@ -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 => {
Expand Down

0 comments on commit f88805e

Please sign in to comment.