Skip to content

Commit

Permalink
feedback and split out basics
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Jun 18, 2020
1 parent 6c8bf7e commit c69e235
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
18 changes: 9 additions & 9 deletions lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ const runnerPaths = {
* Determine batches of smoketests to run, based on the `requestedIds`.
* @param {Array<Smokehouse.TestDfn>} allTestDefns
* @param {Array<string>} requestedIds
* @param {{invert: boolean}} options
* @param {{invertMatch: boolean}} options
* @return {Array<Smokehouse.TestDfn>}
*/
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`);
}

Expand All @@ -73,16 +73,16 @@ async function begin() {
.help('help')
.usage('node $0 [<options>] <test-ids>')
.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',
})
Expand All @@ -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};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c69e235

Please sign in to comment.