Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: run circleci validator on split-e2e-tests #8313

Merged
merged 3 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"link-win": "node ./scripts/link-bin.js packages/amplify-cli/bin/amplify amplify-dev",
"link-aa-win": "node ./scripts/link-bin.js packages/amplify-app/bin/amplify-app amplify-app-dev",
"setup-dev-win": "yarn dev-build && yarn link-win && yarn link-aa-win",
"split-e2e-tests": "yarn ts-node ./scripts/split-e2e-tests.ts && git add .circleci/config.yml && circleci config validate",
"split-e2e-tests": "yarn ts-node ./scripts/split-e2e-tests.ts && git add .circleci/config.yml",
"pkg-clean": "rimraf build out pkg/node_modules pkg/yarn.lock",
"pkg-install": "cd pkg && cp ../yarn.lock ./ && yarn --production",
"pkg-prune": "cd pkg && rimraf **/*.d.ts **/*.js.map **/*.d.ts.map **/README.md **/readme.md **/Readme.md **/CHANGELOG.md **/changelog.md **/Changelog.md **/HISTORY.md **/history.md **/History.md",
Expand Down
19 changes: 19 additions & 0 deletions scripts/split-e2e-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as glob from 'glob';
import { join } from 'path';
import * as fs from 'fs-extra';
import { supportedRegions } from '../packages/amplify-category-geo/src/constants';
import * as execa from 'execa';

const CONCURRENCY = 25;
// Some our e2e tests are known to fail when run on windows hosts
Expand Down Expand Up @@ -447,6 +448,23 @@ function saveConfig(config: CircleCIConfig): void {
const output = ['# auto generated file. Edit config.base.yaml if you want to change', yaml.dump(config, { noRefs: true })];
fs.writeFileSync(configFile, output.join('\n'));
}
function verifyConfig() {
edwardfoyle marked this conversation as resolved.
Show resolved Hide resolved
try {
execa.commandSync('which circleci');
} catch {
console.error(
'Please install circleci cli to validate your circle config. Installation information can be found at https://circleci.com/docs/2.0/local-cli/',
);
process.exit(1);
}
try {
execa.commandSync('circleci config validate');
} catch {
console.error(`"circleci config validate" command failed. Please check your .circleci/config.yml validity`);
process.exit(1);
}
}

function main(): void {
const config = loadConfig();
const splitNodeTests = splitTests(
Expand All @@ -471,5 +489,6 @@ function main(): void {
CONCURRENCY,
);
saveConfig(splitGqlTests);
verifyConfig();
}
main();