Skip to content

Commit

Permalink
Merge pull request #26262 from mshima/matrix
Browse files Browse the repository at this point in the history
randomize node and java versions
  • Loading branch information
DanielFran authored May 24, 2024
2 parents 72077df + 12992f4 commit 4869768
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 72 deletions.
58 changes: 34 additions & 24 deletions test-integration/scripts/99-write-matrix.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
import { writeFileSync, readFileSync } from 'fs';
import { join } from 'path';
import { createHash } from 'node:crypto';
import { writeFileSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import {
packageRoot,
JAVA_VERSION,
Expand All @@ -21,6 +22,10 @@ try {
existing = { include: [] };
}

const randomReproducibleValue = (seed, choices) => {
return choices[createHash('shake256', { outputLength: 1 }).update(seed, 'utf8').digest('binary').charCodeAt(0) % choices.length];
};

writeFileSync(
MATRIX_FILE,
JSON.stringify(
Expand All @@ -34,28 +39,33 @@ writeFileSync(
try {
return JSON.parse(readFileSync(file).toString())
.include.filter(sample => !sample.disabled)
.map(({ generatorOptions, ...sample }) => ({
workspaces: generatorOptions?.workspaces ? 'true' : undefined,
'extra-args': `${generatorOptions?.workspaces ? ' --workspaces' : ''}${generatorOptions?.monorepository ? ' --monorepository' : ''}`,
'setup-application-sample': sample['jhi-app-sample'] || sample['app-sample'] || 'jdl',
'setup-application-environment': generatorOptions?.defaultEnvironment ?? 'prod',
'setup-application-packaging': generatorOptions?.defaultPackaging ?? 'jar',
'setup-entities-sample': sample.entity ?? 'none',
'setup-jdl-entities-sample': sample['jdl-entity'] ?? '',
'setup-jdl-sample': sample['jdl-samples'] ?? '',
java: sample['java-version'] ?? JAVA_VERSION,
node: sample['node-version'] ?? NODE_VERSION,
'java-version': JAVA_VERSION,
'node-version': NODE_VERSION,
'npm-version': generatorOptions?.workspaces ? NPM_VERSION : undefined,
'build-jhipster-bom': BUILD_JHIPSTER_BOM,
'jhipster-bom-branch': BUILD_JHIPSTER_BOM ? JHIPSTER_BOM_BRANCH : undefined,
'jhipster-bom-cicd-version': BUILD_JHIPSTER_BOM ? JHIPSTER_BOM_CICD_VERSION : undefined,
'gradle-cache': generatorOptions?.workspaces || sample.name.includes('gradle') ? true : undefined,
...sample,
'skip-backend-tests': sample['skip-backend-tests'] ? 'true' : 'false',
'skip-frontend-tests': sample['skip-frontend-tests'] ? 'true' : 'false',
}));
.map(({ generatorOptions, name, ...sample }) => {
const javaVersion = randomReproducibleValue(`java-${name}`, [JAVA_VERSION, '17', '21']);
const nodeVersion = randomReproducibleValue(`node-${name}`, [NODE_VERSION, '18', '20']);
return {
name,
workspaces: generatorOptions?.workspaces ? 'true' : undefined,
'extra-args': `${generatorOptions?.workspaces ? ' --workspaces' : ''}${generatorOptions?.monorepository ? ' --monorepository' : ''}`,
'setup-application-sample': sample['jhi-app-sample'] || sample['app-sample'] || 'jdl',
'setup-application-environment': generatorOptions?.defaultEnvironment ?? 'prod',
'setup-application-packaging': generatorOptions?.defaultPackaging ?? 'jar',
'setup-entities-sample': sample.entity ?? 'none',
'setup-jdl-entities-sample': sample['jdl-entity'] ?? '',
'setup-jdl-sample': sample['jdl-samples'] ?? '',
java: javaVersion,
node: nodeVersion,
'java-version': javaVersion,
'node-version': nodeVersion,
'npm-version': generatorOptions?.workspaces ? NPM_VERSION : undefined,
'build-jhipster-bom': BUILD_JHIPSTER_BOM,
'jhipster-bom-branch': BUILD_JHIPSTER_BOM ? JHIPSTER_BOM_BRANCH : undefined,
'jhipster-bom-cicd-version': BUILD_JHIPSTER_BOM ? JHIPSTER_BOM_CICD_VERSION : undefined,
'gradle-cache': generatorOptions?.workspaces || name.includes('gradle') ? true : undefined,
...sample,
'skip-backend-tests': sample['skip-backend-tests'] ? 'true' : 'false',
'skip-frontend-tests': sample['skip-frontend-tests'] ? 'true' : 'false',
};
});
} catch (error) {
console.log(`File ${file} not found`, error);
return [];
Expand Down
41 changes: 12 additions & 29 deletions test-integration/workflow-samples/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,20 @@
"name": "ng-default-additional",
"entity": "none",
"app-sample": "ng-default",
"jdl-entity": "*",
"node-version": "20",
"java-version": "21"
"jdl-entity": "*"
},
{
"name": "ng-mysql-es-noi18n-mapsid",
"app-sample": "ng-mysql-es-noi18n-mapsid",
"entity": "sql",
"node-version": "20"
"entity": "sql"
},
{
"name": "ng-mongodb-kafka-cucumber",
"app-sample": "ng-mongodb-kafka-cucumber",
"entity": "mongodb",
"generatorOptions": {
"defaultEnvironment": "dev"
},
"java-version": "21"
}
},
{
"name": "ng-h2mem-ws-nol2",
Expand All @@ -52,18 +48,15 @@
{
"name": "ng-gradle-fr",
"app-sample": "ng-gradle-fr",
"entity": "sql",
"node-version": "20",
"java-version": "21"
"entity": "sql"
},
{
"name": "ng-gradle-mariadb-oauth2-infinispan",
"app-sample": "ng-gradle-mariadb-oauth2-infinispan",
"entity": "sql",
"generatorOptions": {
"defaultEnvironment": "dev"
},
"node-version": "20"
}
},
{
"name": "ng-gradle-h2disk-ws-nocache",
Expand All @@ -72,8 +65,7 @@
"generatorOptions": {
"defaultEnvironment": "dev",
"defaultPackaging": "war"
},
"java-version": "21"
}
},
{
"name": "ng-webflux-mongodb",
Expand All @@ -83,9 +75,7 @@
{
"name": "ng-webflux-gradle-mongodb-oauth2",
"app-sample": "webflux-mongodb-oauth2",
"entity": "mongodb",
"node-version": "20",
"java-version": "21"
"entity": "mongodb"
},
{
"name": "ng-webflux-psql-default",
Expand All @@ -94,25 +84,21 @@
},
{
"name": "ng-webflux-psql-additional",
"jdl-samples": "webflux-psql,custom-domain",
"node-version": "20",
"java-version": "21"
"jdl-samples": "webflux-psql,custom-domain"
},
{
"name": "ng-webflux-gradle-session-h2mem-es",
"app-sample": "webflux-gradle-session-h2mem-es",
"generatorOptions": {
"defaultEnvironment": "dev"
},
"entity": "sqllight",
"node-version": "20"
"entity": "sqllight"
},
{
"name": "ng-webflux-couchbase",
"disabled": "needs adjusts for sb3",
"app-sample": "webflux-couchbase",
"entity": "couchbase",
"java-version": "21"
"entity": "couchbase"
},
{
"name": "ms-ng-oauth2-mongodb-caffeine",
Expand All @@ -129,18 +115,15 @@
"generatorOptions": {
"workspaces": true,
"monorepository": true
},
"node-version": "20",
"java-version": "21"
}
},
{
"name": "ms-mf-ng-consul-oauth2-neo4j",
"jdl-samples": "ms-mf-ng-consul-oauth2-neo4j",
"generatorOptions": {
"workspaces": true,
"monorepository": true
},
"node-version": "20"
}
}
]
}
13 changes: 4 additions & 9 deletions test-integration/workflow-samples/react.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,25 @@
"entity": "sql",
"generatorOptions": {
"defaultEnvironment": "dev"
},
"node-version": "20",
"java-version": "21"
}
},
{
"name": "react-gradle-mysql-es-noi18n-mapsid",
"app-sample": "react-gradle-mysql-es-noi18n-mapsid",
"entity": "sql",
"node-version": "20"
"entity": "sql"
},
{
"name": "react-gradle-cassandra-session-redis",
"app-sample": "react-gradle-cassandra-session-redis",
"entity": "cassandra",
"java-version": "21"
"entity": "cassandra"
},
{
"name": "ms-react-consul-jwt-cassandra-redis",
"jdl-samples": "ms-react-consul-jwt-cassandra-redis",
"generatorOptions": {
"workspaces": true,
"monorepository": true
},
"java-version": "21"
}
},
{
"name": "ms-mf-react-eureka-oauth2-mariadb-infinispan",
Expand Down
14 changes: 4 additions & 10 deletions test-integration/workflow-samples/vue.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,25 @@
"name": "vue-default-additional",
"app-sample": "vue-default",
"entity": "none",
"jdl-entity": "custom-id",
"node-version": "20",
"java-version": "21"
"jdl-entity": "custom-id"
},
{
"name": "vue-noi18n-mysql-ws-oauth2",
"app-sample": "vue-noi18n-ws-oauth2",
"entity": "sqlfull",
"node-version": "20",
"java-version": "21"
"entity": "sqlfull"
},
{
"name": "vue-fulli18n-mysql-es",
"app-sample": "vue-fulli18n-es",
"entity": "sql",
"node-version": "20"
"entity": "sql"
},
{
"name": "vue-gradle-h2mem-ws-session",
"app-sample": "vue-gradle-ws-session",
"entity": "sql",
"generatorOptions": {
"defaultEnvironment": "dev"
},
"java-version": "21"
}
},
{
"name": "vue-h2disk-ws-theme",
Expand Down

0 comments on commit 4869768

Please sign in to comment.