Skip to content

Commit

Permalink
adjust git-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Oct 24, 2024
1 parent 3694014 commit 1d58644
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .blueprint/github-build-matrix/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ export default class extends BaseGenerator {
// Push events requires a base commit for diff. Diff cannot be checked by @~1 if PR was merged with a rebase.
const useChanges = this.eventName === 'pull_request';
const changes = await getGitChanges({ allTrue: !useChanges });
const { base, common, devBlueprint, client, e2e, java, workspaces } = changes;
const { base, common, devBlueprint, client, e2e, graalvm, java, workspaces } = changes;
const hasWorkflowChanges = changes[`${this.workflow}Workflow`];

let matrix: GitHubMatrixRecord = {};
let randomEnvironment = false;
if (this.workflow === 'docker-compose-integration') {
matrix = dockerComposeMatrix;
} else if (this.workflow === 'graalvm') {
if (hasWorkflowChanges || java) {
if (hasWorkflowChanges || java || graalvm) {
matrix = graalvmMatrix;
}
} else if (this.workflow === 'devserver') {
Expand Down
1 change: 0 additions & 1 deletion .blueprint/github-build-matrix/samples/graalvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const graalvmMatrix = Object.fromEntries(
key,
{
'java-version': '21',
'jdl-base': convertOptionsToJDL({ ...value, cacheProvider: 'no' }),
jdl: convertOptionsToJDL({ ...value, graalvmSupport: true }),
},
]),
Expand Down
9 changes: 7 additions & 2 deletions .blueprint/github-build-matrix/support/git-changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export const getGitChanges = async (options: { allTrue?: boolean } = {}) => {
const git = simpleGit({ baseDir: fileURLToPath(new URL('../../', import.meta.url).href) });
const summary = await git.diffSummary({ '@~1': null });
const files = summary.files.map(({ file }) => file);
hasPatternChanges = (pattern: string) => files.some(file => minimatch(file, pattern, { dot: true }));
hasPatternChanges = (pattern: string, ignore?: string) =>
files.some(file => minimatch(file, pattern, { dot: true }) && (!ignore || !minimatch(file, ignore, { dot: true })));
}

const hasClientWorkflowChanges = (client: 'angular' | 'react' | 'vue') =>
Expand All @@ -29,7 +30,11 @@ export const getGitChanges = async (options: { allTrue?: boolean } = {}) => {
common: hasPatternChanges('generators/{app,common,docker,languages}/**'),
client: hasPatternChanges('generators/{client,init,javascript}/**'),
e2e: hasPatternChanges('generators/cypress/**'),
java: hasPatternChanges('generators/{cucumber,feign-client,gatling,gradle,java,liquibase,maven,server,spring*}/**'),
java: hasPatternChanges(
'generators/{cucumber,feign-client,gatling,gradle,java,liquibase,maven,server,spring*}/**',
'generators/java/generators/graalvm/**',
),
graalvm: hasPatternChanges('generators/java/generators/graalvm/**'),
react: hasPatternChanges('generators/react/**'),
reactWorkflow: hasClientWorkflowChanges('react'),
workspaces: hasPatternChanges('generators/{docker-compose,kubernetes*,workspaces}/**'),
Expand Down

0 comments on commit 1d58644

Please sign in to comment.