Skip to content

Commit

Permalink
use jhipster/actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Apr 13, 2024
1 parent 4c211c9 commit 07981ac
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .blueprint/generate-sample/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class extends BaseGenerator {
transform(() => {}),
);

let generatorOptions = {};
let generatorOptions = { ...sample.sample.generatorOptions };
if (sample.sample.workspaces && sample.sample.workspaces !== 'false') {
generatorOptions = { ...generatorOptions, workspaces: true, monorepository: true };
}
Expand Down
37 changes: 12 additions & 25 deletions .github/workflows/angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,49 +111,36 @@ jobs:
npm: true
maven: true
gradle: ${{ matrix.workspaces == 'true' || matrix.gradle == 1 || contains(matrix.name, 'gradle') }}
- name: 'TOOLS: configure tools installed by the system'
run: $JHI_SCRIPTS/03-system.sh
- name: 'TOOLS: configure git'
run: $JHI_SCRIPTS/04-git-config.sh
- uses: jhipster/actions/setup-keycloak-hostname@v0
- uses: jhipster/actions/setup-git@v0
# Update global NPM for workspaces support
- name: 'Install required NPM version'
if: matrix.workspaces == 'true'
run: npm install -g npm@${{ steps.setup.outputs.npm-version }} || true
run: npm install -g npm@${{ matrix.npm }} || true
#----------------------------------------------------------------------
# Install JHipster and generate project+entities
#----------------------------------------------------------------------
- name: 'GENERATION: install JHipster'
run: $JHI_SCRIPTS/10-install-jhipster.sh
- name: 'GENERATION: config'
run: $JHI_SCRIPTS/11-generate-config.sh
- name: 'GENERATION: project'
run: jhipster generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
- name: 'GENERATION: workspace git'
if: matrix.workspaces == 'true'
run: |
git add .
git commit --allow-empty -m "Commit workspaces"
- name: 'GENERATION: jhipster info'
run: $JHI_SCRIPTS/14-jhipster-info.sh
- run: jhipster info
#----------------------------------------------------------------------
# Detect changes against base commit
#----------------------------------------------------------------------
- name: 'MERGE: generate base'
continue-on-error: true
id: base-app
if: >-
github.event.pull_request &&
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
uses: ./generator-jhipster/.github/actions/compare-base
with:
extra-args: --skip-jhipster-dependencies ${{ matrix.extra-args }}
- name: 'MERGE: compare changes'
continue-on-error: true
- uses: jhipster/actions/compare-sample@v0
id: compare
if: steps.base-app.outcome == 'success'
uses: ./generator-jhipster/.github/actions/compare
with:
application-path: ${{ steps.base-app.outputs.application-path }}
generator-path: generator-jhipster
cmd: ${{ github.workspace }}/generator-jhipster/bin/jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
env:
# generate-sample uses JHI_FOLDER_APP to generate the application.
JHI_FOLDER_APP: ${{ github.workspace }}/base/app
#----------------------------------------------------------------------
# Launch tests
#----------------------------------------------------------------------
Expand Down Expand Up @@ -189,13 +176,13 @@ jobs:
if: always() && steps.backend.outcome == 'failure'
with:
name: log-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/test-results/**/*.xml
path: ${{ github.workspace }}/app/**/test-results/**/*.xml
- name: 'E2E: Store failure screenshots'
uses: actions/upload-artifact@v4
if: always() && steps.e2e.outcome == 'failure'
with:
name: screenshots-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/cypress/screenshots
path: ${{ github.workspace }}/app/**/cypress/screenshots
- name: Dump docker logs
if: always()
uses: jwalton/gh-docker-logs@v2
Expand Down
37 changes: 12 additions & 25 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,49 +111,36 @@ jobs:
npm: true
maven: true
gradle: ${{ matrix.workspaces == 'true' || matrix.gradle == 1 || contains(matrix.name, 'gradle') }}
- name: 'TOOLS: configure tools installed by the system'
run: $JHI_SCRIPTS/03-system.sh
- name: 'TOOLS: configure git'
run: $JHI_SCRIPTS/04-git-config.sh
- uses: jhipster/actions/setup-keycloak-hostname@v0
- uses: jhipster/actions/setup-git@v0
# Update global NPM for workspaces support
- name: 'Install required NPM version'
if: matrix.workspaces == 'true'
run: npm install -g npm@${{ steps.setup.outputs.npm-version }} || true
run: npm install -g npm@${{ matrix.npm }} || true
#----------------------------------------------------------------------
# Install JHipster and generate project+entities
#----------------------------------------------------------------------
- name: 'GENERATION: install JHipster'
run: $JHI_SCRIPTS/10-install-jhipster.sh
- name: 'GENERATION: config'
run: $JHI_SCRIPTS/11-generate-config.sh
- name: 'GENERATION: project'
run: jhipster generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
- name: 'GENERATION: workspace git'
if: matrix.workspaces == 'true'
run: |
git add .
git commit --allow-empty -m "Commit workspaces"
- name: 'GENERATION: jhipster info'
run: $JHI_SCRIPTS/14-jhipster-info.sh
- run: jhipster info
#----------------------------------------------------------------------
# Detect changes against base commit
#----------------------------------------------------------------------
- name: 'MERGE: generate base'
continue-on-error: true
id: base-app
if: >-
github.event.pull_request &&
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
uses: ./generator-jhipster/.github/actions/compare-base
with:
extra-args: '--skip-jhipster-dependencies ${{ matrix.extra-args }}'
- name: 'MERGE: compare changes'
continue-on-error: true
- uses: jhipster/actions/compare-sample@v0
id: compare
if: steps.base-app.outcome == 'success'
uses: ./generator-jhipster/.github/actions/compare
with:
application-path: ${{ steps.base-app.outputs.application-path }}
generator-path: generator-jhipster
cmd: ${{ github.workspace }}/generator-jhipster/bin/jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
env:
# generate-sample uses JHI_FOLDER_APP to generate the application.
JHI_FOLDER_APP: ${{ github.workspace }}/base/app
#----------------------------------------------------------------------
# Launch tests
#----------------------------------------------------------------------
Expand Down Expand Up @@ -189,13 +176,13 @@ jobs:
if: always() && steps.backend.outcome == 'failure'
with:
name: log-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/test-results/**/*.xml
path: ${{ github.workspace }}/app/**/test-results/**/*.xml
- name: 'E2E: Store failure screenshots'
uses: actions/upload-artifact@v4
if: always() && steps.e2e.outcome == 'failure'
with:
name: screenshots-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/cypress/screenshots
path: ${{ github.workspace }}/app/**/cypress/screenshots
- name: Dump docker logs
if: always()
uses: jwalton/gh-docker-logs@v2
Expand Down
37 changes: 12 additions & 25 deletions .github/workflows/vue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,49 +111,36 @@ jobs:
npm: true
maven: true
gradle: ${{ matrix.workspaces == 'true' || matrix.gradle == 1 || contains(matrix.name, 'gradle') }}
- name: 'TOOLS: configure tools installed by the system'
run: $JHI_SCRIPTS/03-system.sh
- name: 'TOOLS: configure git'
run: $JHI_SCRIPTS/04-git-config.sh
- uses: jhipster/actions/setup-keycloak-hostname@v0
- uses: jhipster/actions/setup-git@v0
# Update global NPM for workspaces support
- name: 'Install required NPM version'
if: matrix.workspaces == 'true'
run: npm install -g npm@${{ steps.setup.outputs.npm-version }} || true
run: npm install -g npm@${{ matrix.npm }} || true
#----------------------------------------------------------------------
# Install JHipster and generate project+entities
#----------------------------------------------------------------------
- name: 'GENERATION: install JHipster'
run: $JHI_SCRIPTS/10-install-jhipster.sh
- name: 'GENERATION: config'
run: $JHI_SCRIPTS/11-generate-config.sh
- name: 'GENERATION: project'
run: jhipster generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
- name: 'GENERATION: workspace git'
if: matrix.workspaces == 'true'
run: |
git add .
git commit --allow-empty -m "Commit workspaces"
- name: 'GENERATION: jhipster info'
run: $JHI_SCRIPTS/14-jhipster-info.sh
- run: jhipster info
#----------------------------------------------------------------------
# Detect changes against base commit
#----------------------------------------------------------------------
- name: 'MERGE: generate base'
continue-on-error: true
id: base-app
if: >-
github.event.pull_request &&
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
uses: ./generator-jhipster/.github/actions/compare-base
with:
extra-args: '--skip-jhipster-dependencies ${{ matrix.extra-args }}'
- name: 'MERGE: compare changes'
continue-on-error: true
- uses: jhipster/actions/compare-sample@v0
id: compare
if: steps.base-app.outcome == 'success'
uses: ./generator-jhipster/.github/actions/compare
with:
application-path: ${{ steps.base-app.outputs.application-path }}
generator-path: generator-jhipster
cmd: ${{ github.workspace }}/generator-jhipster/bin/jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight
env:
# generate-sample uses JHI_FOLDER_APP to generate the application.
JHI_FOLDER_APP: ${{ github.workspace }}/base/app
#----------------------------------------------------------------------
# Launch tests
#----------------------------------------------------------------------
Expand Down Expand Up @@ -189,13 +176,13 @@ jobs:
if: always() && steps.backend.outcome == 'failure'
with:
name: log-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/test-results/**/*.xml
path: ${{ github.workspace }}/app/**/test-results/**/*.xml
- name: 'E2E: Store failure screenshots'
uses: actions/upload-artifact@v4
if: always() && steps.e2e.outcome == 'failure'
with:
name: screenshots-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/cypress/screenshots
path: ${{ github.workspace }}/app/**/cypress/screenshots
- name: Dump docker logs
if: always()
uses: jwalton/gh-docker-logs@v2
Expand Down
17 changes: 17 additions & 0 deletions test-integration/integration-test-constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { JHIPSTER_DEPENDENCIES_VERSION } from '../generators/generator-constants.js';

const FORCE_BUILD_JHIPSTER_BOM = false;
export const JHIPSTER_BOM_BRANCH = 'main';
export const JHIPSTER_BOM_CICD_VERSION = '0.0.0-CICD';
export const BUILD_JHIPSTER_BOM = FORCE_BUILD_JHIPSTER_BOM || JHIPSTER_DEPENDENCIES_VERSION.includes('-SNAPSHOT');

export { NODE_VERSION, JAVA_VERSION } from '../generators/generator-constants.js';

const __filename = fileURLToPath(import.meta.url);
export const packageRoot = join(dirname(__filename), '../..');

export const NPM_VERSION = JSON.parse(readFileSync(join(packageRoot, 'generators/common/resources/package.json'), 'utf-8')).devDependencies
.npm;
20 changes: 14 additions & 6 deletions test-integration/scripts/99-write-matrix.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env node
import { writeFileSync, readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { JAVA_VERSION, NODE_VERSION } from '../../generators/generator-constants.js';

const __filename = fileURLToPath(import.meta.url);
const packageRoot = join(dirname(__filename), '../..');
import { join } from 'path';
import {
packageRoot,
JAVA_VERSION,
NODE_VERSION,
NPM_VERSION,
JHIPSTER_BOM_BRANCH,
JHIPSTER_BOM_CICD_VERSION,
BUILD_JHIPSTER_BOM,
} from '../integration-test-constants.js';

const MATRIX_FILE = 'matrix.json';

Expand Down Expand Up @@ -42,6 +46,10 @@ writeFileSync(
'setup-jdl-sample': sample['jdl-samples'] ?? '',
java: sample['java'] ?? JAVA_VERSION,
node: sample['node'] ?? NODE_VERSION,
npm: NPM_VERSION,
'build-jhipster-bom': BUILD_JHIPSTER_BOM,
'jhipster-bom-branch': BUILD_JHIPSTER_BOM ? JHIPSTER_BOM_BRANCH : '',
'jhipster-bom-cicd-version': BUILD_JHIPSTER_BOM ? JHIPSTER_BOM_CICD_VERSION : '',
}));
} catch (error) {
console.log(`File ${file} not found`, error);
Expand Down

0 comments on commit 07981ac

Please sign in to comment.