mattermost-mobile-upstream/.github/actions/compute-e2e-build-fingerprint/paths.js
yasser khan 587e15ea89
chore(e2e): Cache app builds. Skip E2E on docs only PR. (#9930)
Based on the later commits (after the earlier experimentation and reversions), the meaningful end state of the PR is:

**Summary:** Improve E2E CI reliability, performance, and security by introducing robust build caching with safe fingerprinting and cache isolation, duration-based test sharding with graceful fallbacks, more reliable E2E impact detection and status handling, stronger cancellation/concurrency behavior, multiple iOS Detox stability fixes, and hardening GitHub Actions to avoid executing PR-authored code. Also includes CI fixes for iOS builds and a temporary Android E2E test skip for a known regression.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-08-04 19:13:39 +05:30

49 lines
1.5 KiB
JavaScript

'use strict';
/**
* Shared helpers for paths.json — used by the fingerprint action (via node -e)
* and by unit tests. Keep impact-filter glob conversion here so both sides agree.
*/
const path = require('path');
function loadPaths(pathsFile) {
// Dynamic path so the composite action can pass GITHUB_ACTION_PATH/paths.json.
// eslint-disable-next-line import/no-dynamic-require, global-require
return require(pathsFile || path.join(__dirname, 'paths.json'));
}
/** git ls-tree path → impact-filter glob (dir/ → dir/**). */
function fingerprintPathToGlob(entry) {
return entry.endsWith('/') ? `${entry}**` : entry;
}
function fingerprintPathsForPlatform(paths, platform) {
const extra = paths.fingerprintByPlatform[platform];
if (!extra) {
throw new Error(`Unknown platform: ${platform}`);
}
return [...paths.fingerprintShared, ...extra];
}
/** All globs the label manager should treat as E2E-impacting. */
function impactGlobs(paths) {
const fromFingerprint = new Set();
for (const entry of paths.fingerprintShared) {
fromFingerprint.add(fingerprintPathToGlob(entry));
}
for (const platformPaths of Object.values(paths.fingerprintByPlatform)) {
for (const entry of platformPaths) {
fromFingerprint.add(fingerprintPathToGlob(entry));
}
}
return [...fromFingerprint, ...paths.triggerExtra];
}
module.exports = {
loadPaths,
fingerprintPathToGlob,
fingerprintPathsForPlatform,
impactGlobs,
};