ci: run client linters on changed files (#33701)

This commit is contained in:
Valery Bugakov 2022-04-14 00:37:25 -07:00 committed by GitHub
parent c31661b83a
commit 868472f43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 119 additions and 75 deletions

2
.vscode/tasks.json vendored
View File

@ -39,7 +39,7 @@
{
"label": "stylelint",
"command": "yarn",
"args": ["-s", "run", "all:stylelint", "--", "--formatter", "compact"],
"args": ["-s", "run", "lint:css:all", "--", "--formatter", "compact"],
"problemMatcher": {
"owner": "stylelint",
"applyTo": "closedDocuments",

View File

@ -5,8 +5,8 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/branded/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"test": "jest"
}
}

View File

@ -23,8 +23,8 @@
"release:firefox": "./scripts/release-firefox.sh",
"release:npm": "TS_NODE_COMPILER_OPTIONS=\"{\\\"module\\\":\\\"commonjs\\\"}\" ts-node ./scripts/publish-npm.ts",
"lint": "yarn run eslint && yarn run stylelint",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss'",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss'",
"clean": "rm -rf build/ dist/ *.zip *.xpi .checksum",
"test": "jest --testPathIgnorePatterns end-to-end integration",
"test-e2e": "mocha './src/end-to-end/**/*.test.ts'",

View File

@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}

View File

@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}

View File

@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
}

View File

@ -1,3 +1,4 @@
/* stylelint-disable */
.github-testase * {
box-sizing: border-box;
}

View File

@ -1,3 +1,4 @@
/* stylelint-disable */
.sourcegraph-testcase * {
box-sizing: border-box;
}

View File

@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}

View File

@ -10,7 +10,7 @@
],
"main": "lib/index.js",
"scripts": {
"eslint": "echo 'TODO: add proper ESLint config, issue #19448'",
"lint:js": "echo 'TODO: add proper ESLint config, issue #19448'",
"test": "mocha tests --recursive"
},
"dependencies": {

View File

@ -19,7 +19,7 @@
],
"sideEffects": false,
"scripts": {
"eslint": "eslint 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint 'src/**/*.[jt]s?(x)'",
"prepublishOnly": "yarn run eslint"
},
"peerDependencies": {

View File

@ -21,7 +21,7 @@
],
"sideEffects": false,
"scripts": {
"eslint": "eslint 'src/*.[jt]s?(x)'",
"lint:js": "eslint 'src/*.[jt]s?(x)'",
"docs": "typedoc",
"prepublishOnly": "yarn run eslint && yarn run docs"
},

View File

@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}

View File

@ -8,7 +8,7 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/search-ui/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}

View File

@ -1,3 +1,5 @@
// This rule is disable to preserve 1-1 mapping between `DecoratedToken` types and classes.
/* stylelint-disable selector-class-pattern */
.root {
flex: 1;
min-width: 0;
@ -46,6 +48,7 @@
code {
background-color: rgba(220, 220, 220, 0.4);
border-radius: var(--border-radius);
/* stylelint-disable-next-line declaration-property-unit-allowed-list */
padding: 0 0.4em;
}

View File

@ -375,7 +375,7 @@ const tokenDecorators: { [key: string]: Decoration } = Object.fromEntries(
const emptyDecorator = Decoration.mark({})
const focusedFilterDeco = Decoration.mark({ class: styles.focusedFilter })
// Chooses the correct decorator for the decorated token. Copied (and adapated)
// Chooses the correct decorator for the decorated token. Copied (and adapted)
// from decoratedToMonaco (decoratedToken.ts).
const decoratedToDecoration = (token: DecoratedToken): Decoration => {
let cssClass = 'identifier'

View File

@ -30,6 +30,7 @@
// Border should appear directly under the width of the icon
// Halfway past the icon, minus half the border size
/* stylelint-disable scss/operator-no-newline-after */
margin-left: calc(
var(--icon-inline-size) / 2 - var(--streaming-skipped-item-message-border-size) / 2 +
var(--streaming-skipped-item-button-margin)
@ -39,6 +40,7 @@
var(--icon-inline-size) / 2 - var(--streaming-skipped-item-message-border-size) / 2 +
var(--streaming-skipped-item-button-margin)
);
/* stylelint-enable scss/operator-no-newline-after */
margin-right: var(--streaming-skipped-item-button-margin);
}

View File

@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}

View File

@ -5,8 +5,8 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/shared/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"test": "jest",
"graphql": "gulp graphQlSchema",
"schema": "gulp schema",

View File

@ -7,7 +7,7 @@
"license": "Apache-2.0",
"main": "./src/index.ts",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"start": "TS_NODE_TRANSPILE_ONLY=true start-storybook -p 9001 -c ./src -s ./assets,../../ui/assets",
"build": "TS_NODE_TRANSPILE_ONLY=true build-storybook -c ./src -s ./assets,../../ui/assets",
"build:webpack-stats": "TS_NODE_TRANSPILE_ONLY=true WEBPACK_DLL_PLUGIN=false start-storybook -c ./src -s ./assets --smoke-test --webpack-stats-json ./storybook-static --loglevel warn",

View File

@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}

View File

@ -0,0 +1,11 @@
{
"extends": ["../../.stylelintrc.json"],
"overrides": [
{
"files": ["./src/webview/index.scss"],
"rules": {
"filenames/match-regex": null
}
}
]
}

View File

@ -207,7 +207,7 @@
}
},
"scripts": {
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"test": "ts-node ./tests/runTests.ts",
"package": "ts-node ./scripts/package.ts",
"task:gulp": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" gulp",

View File

@ -27,8 +27,8 @@
"watch-webpack": "yarn task:gulp watchWebpack",
"webpack": "yarn task:gulp webpack",
"lint": "yarn run eslint && gulp unusedExports && yarn run stylelint",
"eslint": "NODE_OPTIONS=\"--max_old_space_size=16192\" eslint --cache '**/*.[tj]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "NODE_OPTIONS=\"--max_old_space_size=16192\" eslint --cache '**/*.[tj]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"browserslist": "browserslist",
"analyze-bundle": "WEBPACK_USE_NAMED_CHUNKS=true NODE_ENV=production ENTERPRISE=1 WEBPACK_ANALYZER=1 yarn build",
"bundlesize": "bundlesize --config=./bundlesize.config.js"

View File

@ -8,8 +8,8 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/wildcard/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"test": "jest"
}
}

View File

@ -11,7 +11,7 @@ echo "--- Yarn install in root"
yarn --mutex network --frozen-lockfile --network-timeout 60000
echo "--- Run integration test suite"
yarn percy exec yarn cover-integration:base "$@"
yarn percy exec yarn _cover-integration "$@"
echo "--- Process NYC report"
yarn nyc report -r json

View File

@ -29,7 +29,6 @@ DIRS=(
client/storybook
client/client-api
dev/release
dev/ts-morph
)
run_command() {

View File

@ -3,8 +3,8 @@
"description": "Scripts for managing release captain duties",
"private": true,
"scripts": {
"release": "../../node_modules/.bin/ts-node --transpile-only ./src/main.ts",
"eslint": "../../node_modules/.bin/eslint 'src/**/*.ts'"
"release": "ts-node --transpile-only ./src/main.ts",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'"
},
"dependencies": {}
}

View File

@ -1,3 +1,4 @@
/* stylelint-disable */
@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600&display=swap');
@media (prefers-color-scheme: dark) {

View File

@ -23,12 +23,12 @@ The default run type.
- **Pipeline setup**: Trigger async
- Client PR preview
- **Linters and static analysis**: Prettier, Misc linters, Yarn deduplicate lint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, ESLint, Build TS, Stylelint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, Build TS, ESLint (changed), Stylelint (changed)
- Upload build trace
- Pipeline for `GraphQL` changes:
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, ESLint, Build TS, Stylelint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, Build TS, ESLint (changed), Stylelint (changed)
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
- Upload build trace
@ -78,9 +78,8 @@ The run type for environment including `{"BEXT_NIGHTLY":"true"}`.
Base pipeline (more steps might be included based on branch changes):
- ESLint
- Build TS
- Stylelint
- ESLint (all)
- Stylelint (all)
- Test (client/browser)
- Puppeteer tests for chrome extension
- Test (all)
@ -97,7 +96,7 @@ Base pipeline (more steps might be included based on branch changes):
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, ESLint, Build TS, Stylelint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, Build TS, ESLint (all), Stylelint (all)
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
- **CI script tests**: test-trace-command.sh
@ -116,7 +115,7 @@ Base pipeline (more steps might be included based on branch changes):
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg, Build executor image, Build docker registry mirror image
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, ESLint, Build TS, Stylelint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, Build TS, ESLint (all), Stylelint (all)
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
- **CI script tests**: test-trace-command.sh
@ -131,9 +130,8 @@ The run type for branches matching `bext/release` (exact match).
Base pipeline (more steps might be included based on branch changes):
- ESLint
- Build TS
- Stylelint
- ESLint (all)
- Stylelint (all)
- Test (client/browser)
- Puppeteer tests for chrome extension
- Test (all)
@ -153,7 +151,7 @@ Base pipeline (more steps might be included based on branch changes):
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg, Build executor image
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, ESLint, Build TS, Stylelint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, Build TS, ESLint (all), Stylelint (all)
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
- **CI script tests**: test-trace-command.sh
@ -177,7 +175,7 @@ Base pipeline (more steps might be included based on branch changes):
- **Image builds**: Build alpine-3.12, Build alpine-3.14, Build cadvisor, Build codeinsights-db, Build codeintel-db, Build frontend, Build github-proxy, Build gitserver, Build grafana, Build indexed-searcher, Build jaeger-agent, Build jaeger-all-in-one, Build minio, Build postgres-12-alpine, Build postgres_exporter, Build precise-code-intel-worker, Build prometheus, Build redis-cache, Build redis-store, Build redis_exporter, Build repo-updater, Build search-indexer, Build searcher, Build symbols, Build syntax-highlighter, Build worker, Build migrator, Build server, Build sg, Build executor image
- **Image security scans**: Scan alpine-3.12, Scan alpine-3.14, Scan cadvisor, Scan codeinsights-db, Scan codeintel-db, Scan frontend, Scan github-proxy, Scan gitserver, Scan grafana, Scan indexed-searcher, Scan jaeger-agent, Scan jaeger-all-in-one, Scan minio, Scan postgres-12-alpine, Scan postgres_exporter, Scan precise-code-intel-worker, Scan prometheus, Scan redis-cache, Scan redis-store, Scan redis_exporter, Scan repo-updater, Scan search-indexer, Scan searcher, Scan symbols, Scan syntax-highlighter, Scan worker, Scan migrator, Scan server, Scan sg
- **Linters and static analysis**: Prettier, Misc linters, GraphQL lint, SVG lint, Yarn deduplicate lint, Docker linters, Check and build docsite
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, ESLint, Build TS, Stylelint
- **Client checks**: Puppeteer tests prep, Puppeteer tests for chrome extension, Puppeteer tests chunk #1, Puppeteer tests chunk #2, Puppeteer tests chunk #3, Puppeteer tests chunk #4, Puppeteer tests chunk #5, Puppeteer tests chunk #6, Puppeteer tests chunk #7, Puppeteer tests chunk #8, Puppeteer tests chunk #9, Upload Storybook to Chromatic, Test (all), Build, Enterprise build, Test (client/web), Test (client/browser), Puppeteer tests for VS Code extension, Build TS, ESLint (all), Stylelint (all)
- **Go checks**: Test (all), Test (enterprise/internal/codeintel/stores/dbstore), Test (enterprise/internal/codeintel/stores/lsifstore), Test (enterprise/internal/insights), Test (internal/database), Test (internal/repos), Test (enterprise/internal/batches), Test (cmd/frontend), Test (enterprise/internal/database), Test (enterprise/cmd/frontend/internal/batches/resolvers), Build
- **DB backcompat tests**: Backcompat test (all), Backcompat test (enterprise/internal/codeintel/stores/dbstore), Backcompat test (enterprise/internal/codeintel/stores/lsifstore), Backcompat test (enterprise/internal/insights), Backcompat test (internal/database), Backcompat test (internal/repos), Backcompat test (enterprise/internal/batches), Backcompat test (cmd/frontend), Backcompat test (enterprise/internal/database), Backcompat test (enterprise/cmd/frontend/internal/batches/resolvers)
- **CI script tests**: test-trace-command.sh

View File

@ -131,7 +131,7 @@ If you don't do this (and just use a normal `import`), it will still work, but i
## Formatting
We use [Prettier](https://github.com/prettier/prettier) so you never have to worry about how to format your code.
`yarn run prettier` will check & autoformat all code.
`yarn run format` will check & autoformat all code.
## Tests

View File

@ -27,10 +27,10 @@ To work on most frontend issues, it is necessary to run three applications local
2. Linters.
```sh
yarn all:eslint
yarn prettier-check
yarn all:stylelint
yarn graphql-lint
yarn lint:js:all
yarn lint:css:all
yarn lint:graphql
yarn format:check
```
3. Unit tests

View File

@ -22,8 +22,9 @@ import (
// e.g. by adding flags, and not as a condition for adding steps or commands.
type CoreTestOperationsOptions struct {
// for clientChromaticTests
ChromaticShouldAutoAccept bool
MinimumUpgradeableVersion string
ChromaticShouldAutoAccept bool
MinimumUpgradeableVersion string
ClientLintOnlyChangedFiles bool
}
// CoreTestOperations is a core set of tests that should be run in most CI cases. More
@ -65,14 +66,23 @@ func CoreTestOperations(diff changed.Diff, opts CoreTestOperationsOptions) *oper
if diff.Has(changed.Client | changed.GraphQL) {
// If there are any Graphql changes, they are impacting the client as well.
ops.Merge(operations.NewNamedSet("Client checks",
clientChecks := operations.NewNamedSet("Client checks",
clientIntegrationTests,
clientChromaticTests(opts.ChromaticShouldAutoAccept),
frontendTests, // ~4.5m
addWebApp, // ~5.5m
addBrowserExtensionUnitTests, // ~4.5m
addVSCExt, // ~5.5m
addClientLinters)) // ~9m
addTypescriptCheck, // ~4m
)
if opts.ClientLintOnlyChangedFiles {
clientChecks.Append(addClientLintersForChangedFiles)
} else {
clientChecks.Append(addClientLintersForAllFiles)
}
ops.Merge(clientChecks)
}
if diff.Has(changed.Go | changed.GraphQL) {
@ -143,14 +153,14 @@ func addCheck(pipeline *bk.Pipeline) {
func addPrettier(pipeline *bk.Pipeline) {
pipeline.AddStep(":lipstick: Prettier",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh prettier-check"))
bk.Cmd("dev/ci/yarn-run.sh format:check"))
}
// yarn ~41s + ~1s
func addGraphQLLint(pipeline *bk.Pipeline) {
pipeline.AddStep(":lipstick: :graphql: GraphQL lint",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh graphql-lint"))
bk.Cmd("dev/ci/yarn-run.sh lint:graphql"))
}
func addSVGLint(pipeline *bk.Pipeline) {
@ -163,22 +173,33 @@ func addYarnDeduplicateLint(pipeline *bk.Pipeline) {
bk.Cmd("dev/check/yarn-deduplicate.sh"))
}
// Adds client linters and Typescript check.
func addClientLinters(pipeline *bk.Pipeline) {
// - ESLint ~9m
pipeline.AddStep(":eslint: ESLint",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh all:eslint"))
// - build-ts ~4m
// Adds Typescript check.
func addTypescriptCheck(pipeline *bk.Pipeline) {
pipeline.AddStep(":typescript: Build TS",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh build-ts"))
}
// - Stylelint ~2m
pipeline.AddStep(":stylelint: Stylelint",
// Adds client linters to check all files.
func addClientLintersForAllFiles(pipeline *bk.Pipeline) {
pipeline.AddStep(":eslint: ESLint (all)",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh all:stylelint"))
bk.Cmd("dev/ci/yarn-run.sh lint:js:all"))
pipeline.AddStep(":stylelint: Stylelint (all)",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh lint:css:all"))
}
// Adds client linters to check changed in PR files.
func addClientLintersForChangedFiles(pipeline *bk.Pipeline) {
pipeline.AddStep(":eslint: ESLint (changed)",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh lint:js:changed"))
pipeline.AddStep(":stylelint: Stylelint (changed)",
withYarnCache(),
bk.Cmd("dev/ci/yarn-run.sh lint:css:changed"))
}
// Adds steps for the OSS and Enterprise web app builds. Runs the web app tests.

View File

@ -99,7 +99,10 @@ func GeneratePipeline(c Config) (*bk.Pipeline, error) {
ops.Append(prPreview())
}
}
ops.Merge(CoreTestOperations(c.Diff, CoreTestOperationsOptions{MinimumUpgradeableVersion: minimumUpgradeableVersion}))
ops.Merge(CoreTestOperations(c.Diff, CoreTestOperationsOptions{
MinimumUpgradeableVersion: minimumUpgradeableVersion,
ClientLintOnlyChangedFiles: c.RunType.Is(runtype.PullRequest),
}))
case runtype.ReleaseNightly:
ops.Append(triggerReleaseBranchHealthchecks(minimumUpgradeableVersion))
@ -120,7 +123,7 @@ func GeneratePipeline(c Config) (*bk.Pipeline, error) {
// If this is a browser extension release branch, run the browser-extension tests and
// builds.
ops = operations.NewSet(
addClientLinters,
addClientLintersForAllFiles,
addBrowserExtensionUnitTests,
addBrowserExtensionIntegrationTests(0), // we pass 0 here as we don't have other pipeline steps to contribute to the resulting Percy build
frontendTests,
@ -131,7 +134,7 @@ func GeneratePipeline(c Config) (*bk.Pipeline, error) {
// If this is a browser extension nightly build, run the browser-extension tests and
// e2e tests.
ops = operations.NewSet(
addClientLinters,
addClientLintersForAllFiles,
addBrowserExtensionUnitTests,
addBrowserExtensionIntegrationTests(0), // we pass 0 here as we don't have other pipeline steps to contribute to the resulting Percy build
frontendTests,

View File

@ -11,21 +11,25 @@
"yarn": "^1.22.4"
},
"scripts": {
"prettier": "prettier '**/{*.{js?(on),ts?(x),graphql,md,scss},.*.js?(on)}' --write --list-different --config prettier.config.js",
"prettier-check": "yarn -s run prettier --write=false --check --list-different=false --loglevel=warn",
"all:eslint": "DOCSITE_LIST=\"$(./dev/docsite.sh -config doc/docsite.json ls)\" dev/foreach-ts-project.sh yarn -s run eslint --quiet",
"all:stylelint": "yarn --cwd client/web run stylelint && yarn --cwd client/shared run stylelint && yarn --cwd client/branded run stylelint && yarn --cwd client/browser run stylelint && yarn --cwd client/wildcard run stylelint",
"format": "prettier '**/{*.{js?(on),ts?(x),graphql,md,scss},.*.js?(on)}' --write --list-different --config prettier.config.js",
"format:check": "yarn -s run format --write=false --check --list-different=false --loglevel=warn",
"_lint:js": "DOCSITE_LIST=\"$(./dev/docsite.sh -config doc/docsite.json ls)\" NODE_OPTIONS=\"--max_old_space_size=16192\" eslint",
"lint:js:changed": "yarn _lint:js $(git diff --diff-filter=d --name-only main | grep -E '.[tj]sx?$' | xargs)",
"lint:js:all": "DOCSITE_LIST=\"$(./dev/docsite.sh -config doc/docsite.json ls)\" dev/foreach-ts-project.sh yarn -s run lint:js --quiet",
"_lint:css": "stylelint",
"lint:css:changed": "yarn _lint:css $(git diff --diff-filter=d --name-only main | grep -E '.s?css$' | xargs)",
"lint:css:all": "yarn _lint:css 'client/*/src/**/*.scss'",
"lint:graphql": "graphql-schema-linter",
"build-ts": "tsc -b tsconfig.all.json",
"graphql-lint": "graphql-schema-linter",
"build-web": "yarn workspace @sourcegraph/web run build",
"watch-web": "yarn workspace @sourcegraph/web run watch",
"generate": "gulp generate",
"watch-generate": "gulp watchGenerate",
"test": "jest --testPathIgnorePatterns end-to-end regression integration storybook /out/.*test.js",
"test-integration:base": "TS_NODE_PROJECT=client/web/src/integration/tsconfig.json mocha --parallel=$CI --retries=1 --jobs=2",
"test-integration": "yarn test-integration:base \"./client/web/src/integration/**/*.test.ts\"",
"_test-integration": "TS_NODE_PROJECT=client/web/src/integration/tsconfig.json mocha --parallel=$CI --retries=1 --jobs=2",
"test-integration": "yarn _test-integration\"./client/web/src/integration/**/*.test.ts\"",
"test-browser-integration": "yarn workspace @sourcegraph/browser run test-integration",
"cover-integration:base": "nyc --hook-require=false yarn test-integration:base",
"_cover-integration": "nyc --hook-require=false yarn _test-integration",
"cover-integration": "nyc --hook-require=false yarn test-integration",
"cover-browser-integration": "nyc --hook-require=false yarn workspace @sourcegraph/browser test-integration",
"test-lighthouse": "SOURCEGRAPH_API_URL=https://sourcegraph.com lhci collect && lhci open",