/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
build-system/pr-check/browser-tests.js
57 строк
1 KB
Daniel Rozenberg
🏗 Turbo-charge CircleCI parallelization for faster overall builds (#39861)
29 фев 2024, 00:21
Не верифицирован
29 фев 2024, 00:21
8007632
Код
Авторство
О чём код?
'use strict'; /** * @fileoverview Script that runs tests on Safari / Firefox / Edge during CI. */ const {skipDependentJobs, timedExecOrThrow} = require('./utils'); const {runCiJob} = require('./ci-job'); const {Targets, buildTargetsInclude} = require('./build-targets'); const argv = require('minimist')(process.argv.slice(2)); const {type} = argv; const browser = argv.browser.toLowerCase(); const jobName = 'browser-tests.js'; const COMMANDS = { 'Unit': `amp unit --${browser}`, 'Integration': `amp integration --nobuild --minified --${browser}`, 'End-to-End': `amp e2e --nobuild --minified --browsers=${browser}`, }; const INDIVIDUAL_TARGET = { 'Unit': Targets.UNIT_TEST, 'Integration': Targets.INTEGRATION_TEST, 'End-to-End': Targets.E2E_TEST, }; /** * Steps to run during push builds. */ function pushBuildWorkflow() { try { timedExecOrThrow(COMMANDS[type], `${type} tests failed!`); } catch (e) { if (e.status) { process.exitCode = e.status; } } } /** * Steps to run during PR builds. */ function prBuildWorkflow() { if (!buildTargetsInclude(Targets.RUNTIME, INDIVIDUAL_TARGET[type])) { skipDependentJobs( jobName, `this PR does not affect the runtime or ${type} tests` ); return; } pushBuildWorkflow(); } runCiJob(jobName, pushBuildWorkflow, prBuildWorkflow);