From 0d2c42a1c47c7cc5293d9664121180b35c4cdf65 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Tue, 4 Jul 2023 14:17:25 +0200 Subject: [PATCH] ci: fix Actions not running sometimes (#10503) --- .github/workflows/ci.yml | 2 +- .github/workflows/devtools.yml | 2 +- .github/workflows/issue-analyzer.yml | 2 +- test/src/mocha-utils.ts | 35 +++++++++++++++++++--------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d81bb87e04f..25cdc505601 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: - '**' concurrency: - group: ${{ github.head_ref || github.run_id }} + group: ci-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: diff --git a/.github/workflows/devtools.yml b/.github/workflows/devtools.yml index 48c5bb675cd..8614d6c0cc4 100644 --- a/.github/workflows/devtools.yml +++ b/.github/workflows/devtools.yml @@ -8,7 +8,7 @@ on: types: [labeled] concurrency: - group: ${{ github.head_ref || github.run_id }} + group: devtools-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: diff --git a/.github/workflows/issue-analyzer.yml b/.github/workflows/issue-analyzer.yml index ba67be6267a..b4ad46ce84c 100644 --- a/.github/workflows/issue-analyzer.yml +++ b/.github/workflows/issue-analyzer.yml @@ -7,7 +7,7 @@ on: types: [opened, reopened, edited] concurrency: - group: ${{ format('issue-{0}', github.event.issue.number) }} + group: issue-${{ format('issue-{0}', github.event.issue.number) }} cancel-in-progress: true jobs: diff --git a/test/src/mocha-utils.ts b/test/src/mocha-utils.ts index d5cde00d95d..2fb68550322 100644 --- a/test/src/mocha-utils.ts +++ b/test/src/mocha-utils.ts @@ -255,20 +255,33 @@ process.on('unhandledRejection', reason => { const browserNotClosedError = new Error( 'A manually launched browser was not closed!' ); + export const mochaHooks = { async beforeAll(): Promise { - const {server, httpsServer} = await setupServer(); + async function setUpDefaultState() { + const {server, httpsServer} = await setupServer(); - state.puppeteer = puppeteer; - state.server = server; - state.httpsServer = httpsServer; - state.isFirefox = processVariables.isFirefox; - state.isChrome = processVariables.isChrome; - state.isHeadless = processVariables.isHeadless; - state.headless = processVariables.headless; - state.puppeteerPath = path.resolve( - path.join(__dirname, '..', '..', 'packages', 'puppeteer') - ); + state.puppeteer = puppeteer; + state.server = server; + state.httpsServer = httpsServer; + state.isFirefox = processVariables.isFirefox; + state.isChrome = processVariables.isChrome; + state.isHeadless = processVariables.isHeadless; + state.headless = processVariables.headless; + state.puppeteerPath = path.resolve( + path.join(__dirname, '..', '..', 'packages', 'puppeteer') + ); + } + + try { + await Deferred.race([ + setUpDefaultState(), + Deferred.create({ + message: `Failed in after Hook`, + timeout: (this as any).timeout() - 1000, + }), + ]); + } catch {} }, async afterAll(): Promise {