Skip to content

Commit

Permalink
Merge pull request #155 from mshima/badges
Browse files Browse the repository at this point in the history
Update badges
  • Loading branch information
DanielFran committed Nov 7, 2023
2 parents cfd0be0 + cdf95e5 commit f75a49e
Show file tree
Hide file tree
Showing 43 changed files with 1,087 additions and 428 deletions.
5 changes: 5 additions & 0 deletions .blueprint/cli/commands.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
'update-readme': {
description: 'Run update-readme sub-generator (builds blueprint)',
},
};
17 changes: 17 additions & 0 deletions .blueprint/update-readme/command.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @type {import('generator-jhipster').JHipsterCommandDefinition}
*/
const command = {
options: {},
configs: {
main: {
desc: 'Regenerate generator-jhispter references in README.md',
cli: {
type: Boolean,
},
scope: 'generator',
},
},
};

export default command;
74 changes: 74 additions & 0 deletions .blueprint/update-readme/generator.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { readdir } from 'fs/promises';
import { parse } from 'yaml';
import cronParser from 'cron-parser';
import command from './command.mjs';
import { basename, join } from 'path';

export default async env => {
const BaseApplicationGenerator = await env.requireGenerator('jhipster:base-application');
return class extends BaseApplicationGenerator {
main;
context = {};

get [BaseApplicationGenerator.INITIALIZING]() {
return this.asInitializingTaskGroup({
async initializingTemplateTask() {
this.parseJHipsterCommand(command);
},
});
}

get [BaseApplicationGenerator.PROMPTING]() {
return this.asPromptingTaskGroup({
async promptingTemplateTask() {},
});
}

get [BaseApplicationGenerator.LOADING]() {
return this.asLoadingTaskGroup({
async loadingTemplateTask() {
const workflowsPath = this.templatePath('../../../.github/workflows');
const workflows = await readdir(workflowsPath);
this.context.workflows = workflows
.map(workflow => ({ workflow, content: parse(this.readDestination(join(workflowsPath, workflow))) }))
.map(workflow => ({ ...workflow, workflowName: basename(workflow.workflow) }));

if (this.main) {
this.context.workflows = this.context.workflows.filter(
({ workflowName }) =>
workflowName.startsWith('ng-') ||
workflowName.startsWith('react-') ||
workflowName.startsWith('vue-') ||
workflowName.startsWith('elasticsearch') ||
workflowName.startsWith('monolith-') ||
workflowName.startsWith('no-') ||
workflowName.startsWith('ms-') ||
workflowName.startsWith('docker-') ||
workflowName.startsWith('windows'),
);
} else {
this.context.workflows = this.context.workflows.filter(workflow => workflow.content.on.schedule?.[0]?.cron);
}
for (const workflow of this.context.workflows) {
const cron = cronParser.parseExpression(workflow.content.on.schedule[0].cron);
workflow.cron = `${cron.fields.hour[0].toString().padStart(2, '0')}:${cron.fields.minute[0].toString().padStart(2, '0')}`;
}
this.context.workflows.sort((a, b) => a.cron.localeCompare(b.cron));
},
});
}

get [BaseApplicationGenerator.WRITING]() {
return this.asWritingTaskGroup({
async writingTemplateTask() {
await this.writeFiles({
sections: {
files: [{ templates: [this.main ? 'README.main.md' : 'README.md'] }],
},
context: this.context,
});
},
});
}
};
};
2 changes: 2 additions & 0 deletions .blueprint/update-readme/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as createGenerator } from './generator.mjs';
export { default as command } from './command.mjs';
10 changes: 10 additions & 0 deletions .blueprint/update-readme/templates/README.main.md.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
| Pipeline Status |
| :--- |
<%_ for (const workflow of workflows) { _%>
| [![<%- workflow.content.name %>][<%- workflow.workflowName %>-badge]][<%- workflow.workflowName %>-link] |
<%_ } _%>

<%_ for (const workflow of workflows) { _%>
[<%- workflow.workflowName %>-badge]: https://github.com/hipster-labs/jhipster-daily-builds/actions/workflows/<%- workflow.workflowName %>/badge.svg
[<%- workflow.workflowName %>-link]: https://github.com/hipster-labs/jhipster-daily-builds/actions/workflows/<%- workflow.workflowName %>
<%_ } _%>
16 changes: 16 additions & 0 deletions .blueprint/update-readme/templates/README.md.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# jhipster-daily-builds

## GitHub Actions builds

Please note shown times below are in UTC.

| Pipeline Status | At |
| :--- | :--- |
<%_ for (const workflow of workflows) { _%>
| [![<%- workflow.content.name %>][<%- workflow.workflowName %>-badge]][<%- workflow.workflowName %>-link] | <%- workflow.cron %> |
<%_ } _%>

<%_ for (const workflow of workflows) { _%>
[<%- workflow.workflowName %>-badge]: https://github.com/hipster-labs/jhipster-daily-builds/actions/workflows/<%- workflow.workflowName %>/badge.svg
[<%- workflow.workflowName %>-link]: https://github.com/hipster-labs/jhipster-daily-builds/actions/workflows/<%- workflow.workflowName %>
<%_ } _%>
8 changes: 4 additions & 4 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ jobs:
- name: 'mvn: project'
run: $JHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies --skip-install --workspaces
continue-on-error: true
- name: "mvn: install workspaces deps"
- name: 'mvn: install workspaces deps'
run: npm install --force
continue-on-error: true
- name: "mvn: build cache"
- name: 'mvn: build cache'
run: npm run backend:build-cache || true
continue-on-error: true

Expand All @@ -122,9 +122,9 @@ jobs:
- name: 'gradle: project'
run: $JHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies --skip-install --workspaces
continue-on-error: true
- name: "gradle: install workspaces deps"
- name: 'gradle: install workspaces deps'
run: npm install --force
continue-on-error: true
- name: "gradle: build cache"
- name: 'gradle: build cache'
run: npm run backend:build-cache || true
continue-on-error: true
2 changes: 1 addition & 1 deletion .github/workflows/couchbase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false

schedule:
- cron: '0 4 * * *'
- cron: '15 6 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ concurrency:
on:
workflow_dispatch:
schedule:
- cron: '30 3 * * *'
- cron: '0 6 * * *'
jobs:
builds:
runs-on: 'ubuntu-latest'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '0 2 * * *'
- cron: '0 4 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-consul-gradle-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 6 * * *'
- cron: '30 8 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-consul-gradle-oauth2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 6 * * *'
- cron: '45 8 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-consul-maven-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '0 6 * * *'
- cron: '0 8 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-consul-maven-oauth2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '0 6 * * *'
- cron: '15 8 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-eureka-gradle-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 5 * * *'
- cron: '30 7 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-eureka-gradle-oauth2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 5 * * *'
- cron: '45 7 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-eureka-maven-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '0 5 * * *'
- cron: '0 7 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdl-eureka-maven-oauth2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '0 5 * * *'
- cron: '15 7 * * *'
env:
JHI_JDL_SAMPLES: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-samples
JHI_JDL_SCRIPTS: ${{ github.workspace }}/jhipster-daily-builds/test-integration/jdl-scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/monolith-oauth2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false

schedule:
- cron: '0 2 * * *'
- cron: '15 4 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ms-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '0 3 * * *'
- cron: '0 5 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ms-oauth2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false

schedule:
- cron: '0 3 * * *'
- cron: '30 5 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/neo4j.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 4 * * *'
- cron: '30 6 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '0 1 * * *'
- cron: '45 1 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '50 0 * * *'
- cron: '30 1 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '40 0 * * *'
- cron: '15 1 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 0 * * *'
- cron: '0 1 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/no-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 2 * * *'
- cron: '30 4 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/react-gradle-nosql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false

schedule:
- cron: '10 1 * * *'
- cron: '45 2 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/react-gradle-sql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false

schedule:
- cron: '0 1 * * *'
- cron: '30 2 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/react-maven-nosql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false

schedule:
- cron: '50 0 * * *'
- cron: '15 2 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/react-maven-sql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false

schedule:
- cron: '40 0 * * *'
- cron: '0 2 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vue-gradle-nosql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '50 1 * * *'
- cron: '45 3 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vue-gradle-sql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '40 1 * * *'
- cron: '30 3 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vue-maven-nosql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
default: 'main'
required: false
schedule:
- cron: '30 1 * * *'
- cron: '15 3 * * *'
env:
JHI_SAMPLES: ${{ github.workspace }}/generator-jhipster/test-integration/daily-builds
jobs:
Expand Down
Loading

0 comments on commit f75a49e

Please sign in to comment.