Skip to content

Commit 6564ddc

Browse files
committed
cross import
1 parent 7e84aaa commit 6564ddc

File tree

3 files changed

+56
-55
lines changed

3 files changed

+56
-55
lines changed

scripts/ci/githubActions/createMatrix.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { setOutput } from '@actions/core';
44
import { CLIENTS, createClientName, GENERATORS, LANGUAGES } from '../../common.js';
55
import { getLanguageFolder, getTestExtension, getTestOutputFolder } from '../../config.js';
66

7-
import { COMMON_DEPENDENCIES, DEPENDENCIES } from './setRunVariables.js';
87
import type { ClientMatrix, CreateMatrix, ToRunMatrix } from './types.js';
9-
import { isBaseChanged } from './utils.js';
8+
import { COMMON_DEPENDENCIES, DEPENDENCIES, isBaseChanged } from './utils.js';
109

1110
// This empty matrix is required by the CI, otherwise it throws
1211
const EMPTY_MATRIX = { client: ['no-run'] };

scripts/ci/githubActions/setRunVariables.ts

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
11
/* eslint-disable no-console */
22
import * as core from '@actions/core';
33

4-
import { LANGUAGES } from '../../common.js';
5-
import { getLanguageFolder } from '../../config.js';
64
import type { Language } from '../../types.js';
75

8-
import { isBaseChanged } from './utils.js';
9-
10-
export const COMMON_DEPENDENCIES = {
11-
GITHUB_ACTIONS_CHANGED: ['.github/actions', '.github/workflows'],
12-
SCRIPTS_CHANGED: [
13-
'scripts',
14-
'eslint',
15-
'yarn.lock',
16-
'.eslintrc.cjs',
17-
'config/generation.config.mjs',
18-
'config/clients.config.json',
19-
'config/release.config.json',
20-
'generators',
21-
'tests/CTS',
22-
'.nvmrc',
23-
],
24-
COMMON_SPECS_CHANGED: ['specs/common'],
25-
};
6+
import { DEPENDENCIES, isBaseChanged } from './utils.js';
267

278
export function getVersionFileForLanguage(lang: Language): string {
289
// js rely on the nvmrc of the repo
@@ -38,39 +19,6 @@ export function getVersionFileForLanguage(lang: Language): string {
3819
return `config/.${lang}-version`;
3920
}
4021

41-
/**
42-
* This dependency array is generated to match the "external" dependencies of a generated client.
43-
*
44-
* Those variables are used to determine if jobs should run, based on the changes
45-
* made in their respective dependencies.
46-
*
47-
* Negative paths should start with `:!`.
48-
*
49-
* The variable will be accessible in the CI via `steps.diff.outputs.<name>`.
50-
*
51-
* Variables starting by `LANGUAGENAME_` will be used in the `createMatrix` to determine
52-
* if a job should be added.
53-
*/
54-
export const DEPENDENCIES = LANGUAGES.reduce(
55-
(finalDependencies, lang) => {
56-
const key = `${lang.toUpperCase()}_CLIENT_CHANGED`;
57-
const langFolder = getLanguageFolder(lang);
58-
59-
finalDependencies[key] = [
60-
':!**node_modules',
61-
`templates/${lang}`,
62-
// language related files
63-
langFolder,
64-
getVersionFileForLanguage(lang),
65-
`:!${langFolder}/.github`,
66-
`:!${langFolder}/README.md`,
67-
];
68-
69-
return finalDependencies;
70-
},
71-
{ ...COMMON_DEPENDENCIES } as Record<string, string[]>,
72-
);
73-
7422
/**
7523
* Outputs variables used in the CI to determine if a job should run.
7624
*/

scripts/ci/githubActions/utils.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,62 @@
11
/* eslint-disable no-console */
22
import * as core from '@actions/core';
33

4+
import { LANGUAGES } from '../../common.js';
5+
import { getLanguageFolder } from '../../config.js';
46
import { getNbGitDiff } from '../utils.js';
57

8+
import { getVersionFileForLanguage } from './setRunVariables.js';
9+
10+
export const COMMON_DEPENDENCIES = {
11+
GITHUB_ACTIONS_CHANGED: ['.github/actions', '.github/workflows'],
12+
SCRIPTS_CHANGED: [
13+
'scripts',
14+
'eslint',
15+
'yarn.lock',
16+
'.eslintrc.cjs',
17+
'config/generation.config.mjs',
18+
'config/clients.config.json',
19+
'config/release.config.json',
20+
'generators',
21+
'tests/CTS',
22+
'.nvmrc',
23+
],
24+
COMMON_SPECS_CHANGED: ['specs/common'],
25+
};
26+
27+
/**
28+
* This dependency array is generated to match the "external" dependencies of a generated client.
29+
*
30+
* Those variables are used to determine if jobs should run, based on the changes
31+
* made in their respective dependencies.
32+
*
33+
* Negative paths should start with `:!`.
34+
*
35+
* The variable will be accessible in the CI via `steps.diff.outputs.<name>`.
36+
*
37+
* Variables starting by `LANGUAGENAME_` will be used in the `createMatrix` to determine
38+
* if a job should be added.
39+
*/
40+
export const DEPENDENCIES = LANGUAGES.reduce(
41+
(finalDependencies, lang) => {
42+
const key = `${lang.toUpperCase()}_CLIENT_CHANGED`;
43+
const langFolder = getLanguageFolder(lang);
44+
45+
finalDependencies[key] = [
46+
':!**node_modules',
47+
`templates/${lang}`,
48+
// language related files
49+
langFolder,
50+
getVersionFileForLanguage(lang),
51+
`:!${langFolder}/.github`,
52+
`:!${langFolder}/README.md`,
53+
];
54+
55+
return finalDependencies;
56+
},
57+
{ ...COMMON_DEPENDENCIES } as Record<string, string[]>,
58+
);
59+
660
/**
761
* Determines if changes have been found in the `dependencies`, compared to the `baseBranch`.
862
*

0 commit comments

Comments
 (0)