forked from elastic/elastic-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ts
More file actions
52 lines (46 loc) · 1.73 KB
/
build.ts
File metadata and controls
52 lines (46 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { bkEnv } from './buildkite';
interface Job {
name: string;
id: string;
}
interface BuildConfig {
jobs: Job[];
}
/**
* This config enabled updating of required check runs when build is skipped
*/
export const getBuildConfig = (): BuildConfig => {
return {
jobs: [
{ name: 'Types', id: 'types' },
{ name: 'API', id: 'api' },
{ name: 'Build - Docs', id: 'build_docs' },
{ name: 'Build - e2e server', id: 'build_e2e' },
{ name: 'Build - Storybook', id: 'build_storybook' },
...(bkEnv.isPullRequest ? [{ name: 'Build - @elastic/charts package', id: 'build_charts_package_preview' }] : []),
{ name: 'Pre Deploy - firebase', id: 'pre_deploy_fb' },
{ name: 'Eslint', id: 'eslint' },
{ name: 'Prettier', id: 'prettier' },
{ name: 'Deploy - firebase', id: 'deploy_fb' },
// ...(bkEnv.isMainBranch ? [{ name: 'Deploy - GitHub Pages', id: 'deploy_ghp' }] : []),
{ name: 'Jest', id: 'jest' },
{ name: 'Playwright e2e VRT', id: 'playwright_vrt' },
{ name: 'Playwright e2e A11Y', id: 'playwright_a11y' },
],
};
};
export const getJobCheckName = (checkId: string) => {
const { jobs } = getBuildConfig();
const job = jobs.find(({ id }) => id === checkId);
if (!job) {
throw new Error(`Failed to find check name from step id ${checkId}. Job ids are:\n\n\t${jobs.join('\n\t')}`);
}
return job.name;
};