From c69e235445bac6775d0bbce65d9b670bb40bc5df Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Thu, 18 Jun 2020 19:02:12 -0400 Subject: [PATCH] feedback and split out basics --- .github/workflows/ci.yml | 31 ++++++++++++++----- .../smokehouse/frontends/smokehouse-bin.js | 18 +++++------ .../smokehouse/lighthouse-runners/bundle.js | 2 +- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b928fd439bfd..72392ece964a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,24 @@ name: 💡🏠 on: [pull_request] jobs: + basics: + # basic checks that depend only on the cloned and yarned repo. + runs-on: ubuntu-latest + + steps: + - name: git clone + uses: actions/checkout@v2 + + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + + - run: yarn --frozen-lockfile + - run: yarn type-check + - run: yarn lint + - run: yarn i18n:checks + ci: runs-on: ubuntu-latest @@ -37,8 +55,6 @@ jobs: - run: yarn --frozen-lockfile - run: yarn build-all - run: yarn diff:sample-json - - run: yarn type-check - - run: yarn lint - run: yarn test-proto # Run before unit-core because the roundtrip json is needed for proto tests. # Run tests that require headfull Chrome. @@ -54,9 +70,11 @@ jobs: - run: yarn test-lantern - run: yarn test-legacy-javascript - - run: yarn i18n:checks - run: yarn dogfood-lhci + # Fail if any changes were written to source files (ex, from: build/build-cdt-lib.js). + - run: git diff --exit-code + - name: Upload dist/ uses: actions/upload-artifact@v2 with: @@ -73,14 +91,11 @@ jobs: # https://buildtracker.dev/docs/guides/github-actions#configuration BT_API_AUTH_TOKEN: ${{ secrets.BT_API_AUTH_TOKEN }} - # Fail if any changes were written to source files (ex, from: build/build-cdt-lib.js). - - run: git diff --exit-code - smoke: runs-on: ubuntu-latest strategy: matrix: - invert: [false, true] + smokeTestInvert: [false, true] # e.g. if smoke 0 fails, continue with smoke 1 anyway fail-fast: false env: @@ -99,4 +114,4 @@ jobs: - run: yarn --frozen-lockfile - name: Run smoke tests - run: xvfb-run --auto-servernum yarn smoke --debug -j=1 --retries=2 --invert ${{ matrix.invert }} $SMOKE_GROUP_1 + run: xvfb-run --auto-servernum yarn smoke --debug -j=1 --retries=2 --invert-match ${{ matrix.smokeTestInvert }} $SMOKE_GROUP_1 diff --git a/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js b/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js index 030d324bf5d5..592db8e04ab3 100644 --- a/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +++ b/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js @@ -34,19 +34,19 @@ const runnerPaths = { * Determine batches of smoketests to run, based on the `requestedIds`. * @param {Array} allTestDefns * @param {Array} requestedIds - * @param {{invert: boolean}} options + * @param {{invertMatch: boolean}} options * @return {Array} */ -function getDefinitionsToRun(allTestDefns, requestedIds, {invert}) { +function getDefinitionsToRun(allTestDefns, requestedIds, {invertMatch}) { let smokes = []; const usage = ` ${log.dim}yarn smoke ${allTestDefns.map(t => t.id).join(' ')}${log.reset}\n`; - if (requestedIds.length === 0 && !invert) { + if (requestedIds.length === 0 && !invertMatch) { smokes = [...allTestDefns]; console.log('Running ALL smoketests. Equivalent to:'); console.log(usage); } else { - smokes = allTestDefns.filter(test => invert !== requestedIds.includes(test.id)); + smokes = allTestDefns.filter(test => invertMatch !== requestedIds.includes(test.id)); console.log(`Running ONLY smoketests for: ${smokes.map(t => t.id).join(' ')}\n`); } @@ -73,16 +73,16 @@ async function begin() { .help('help') .usage('node $0 [] ') .example('node $0 -j=1 pwa seo', 'run pwa and seo tests serially') - .example('node $0 --invert byte', 'run all smoke tests but `byte`') + .example('node $0 --invert-match byte', 'run all smoke tests but `byte`') .describe({ 'debug': 'Save test artifacts and output verbose logs', 'jobs': 'Manually set the number of jobs to run at once. `1` runs all tests serially', 'retries': 'The number of times to retry failing tests before accepting. Defaults to 0', 'runner': 'The method of running Lighthouse', 'tests-path': 'The path to a set of test definitions to run. Defaults to core smoke tests.', - 'invert': 'Run all available tests except the ones provided', + 'invert-match': 'Run all available tests except the ones provided', }) - .boolean(['debug', 'invert']) + .boolean(['debug', 'invert-match']) .alias({ 'jobs': 'j', }) @@ -106,8 +106,8 @@ async function begin() { testDefnPath = path.resolve(process.cwd(), testDefnPath); const requestedTestIds = argv._; const allTestDefns = require(testDefnPath); - const invert = argv.invert; - const testDefns = getDefinitionsToRun(allTestDefns, requestedTestIds, {invert}); + const invertMatch = argv.invertMatch; + const testDefns = getDefinitionsToRun(allTestDefns, requestedTestIds, {invertMatch}); const options = {jobs, retries, isDebug: argv.debug, lighthouseRunner}; diff --git a/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js b/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js index ed2e6eeb2451..665e5cd9c35c 100644 --- a/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +++ b/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js @@ -16,7 +16,7 @@ const ChromeProtocol = require('../../../../lighthouse-core/gather/connections/c // Load bundle, which creates a `global.runBundledLighthouse`. // @ts-ignore - file won't exist until `yarn build-all`, but not used for types anyways. -require('../../../../dist/lighthouse-dt-bundle.js'); +require('../../../../dist/lighthouse-dt-bundle.js'); // eslint-disable-line /** @type {import('../../../../lighthouse-core/index.js')} */ // @ts-ignore - not worth giving test global an actual type.