Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/actions/generate-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 'Generate Project'
description: 'Generate JHipster project from configuration'
inputs:
sample-name:
description: 'Name of the sample to generate'
required: true
extra-args:
description: 'Extra arguments for generation'
required: false
default: ''
skip-config:
description: 'Skip configuration file copy'
required: false
default: 'false'
runs:
using: 'composite'
steps:
- name: 'Prepare project directory'
shell: bash
run: |
mkdir -p "$JHI_FOLDER_APP"
cd "$JHI_FOLDER_APP"
echo "Working directory: $(pwd)"

- name: 'Copy configuration if not skipped'
shell: bash
if: inputs.skip-config != 'true'
run: |
if [[ -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" ]]; then
cp -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" "$JHI_FOLDER_APP"/
echo "Copied configuration for sample: ${{ inputs.sample-name }}"
else
echo "Warning: Sample configuration not found for ${{ inputs.sample-name }}"
fi

- name: 'Generate project with JHipster'
shell: bash
run: |
cd "$JHI_FOLDER_APP"
echo "Generating project with arguments: ${{ inputs.extra-args }}"
$JHI_CLI --force --no-insight --skip-checks --skip-jhipster-dependencies ${{ inputs.extra-args }}

- name: 'Display generated project'
shell: bash
run: |
echo "Generated project structure:"
ls -al "$JHI_FOLDER_APP"
echo "Git log (if available):"
git --no-pager log -n 10 --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit || true
103 changes: 103 additions & 0 deletions .github/actions/generate-sample-config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: 'Generate Sample Configuration'
description: 'Generate sample configuration and entities for testing'
inputs:
sample-name:
description: 'Name of the sample to generate'
required: true
database-type:
description: 'Database type (sql, mongodb, cassandra, couchbase, neo4j, micro)'
required: false
default: 'sql'
extra-args:
description: 'Extra arguments for generation'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: 'Prepare application directory'
shell: bash
run: |
mkdir -p "$JHI_FOLDER_APP"/.jhipster/
echo "Created directory: $JHI_FOLDER_APP"

- name: 'Copy sample configuration'
shell: bash
run: |
if [[ -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" ]]; then
cp -f "$JHI_SAMPLES/${{ inputs.sample-name }}/.yo-rc.json" "$JHI_FOLDER_APP"/
echo "Copied configuration for sample: ${{ inputs.sample-name }}"
else
echo "Error: Sample configuration not found for ${{ inputs.sample-name }}"
exit 1
fi

- name: 'Generate entities based on database type'
shell: bash
run: |
case "${{ inputs.database-type }}" in
"mongodb"|"couchbase")
# MongoDB/Couchbase entities
for entity in DocumentBankAccount EmbeddedOperation Place Division FieldTestEntity FieldTestMapstructAndServiceClassEntity FieldTestServiceClassAndJpaFilteringEntity FieldTestServiceImplEntity FieldTestInfiniteScrollEntity FieldTestPaginationEntity EntityWithDTO EntityWithPaginationAndDTO EntityWithServiceClassAndPagination EntityWithServiceClassPaginationAndDTO EntityWithServiceImplAndDTO EntityWithServiceImplAndPagination EntityWithServiceImplPaginationAndDTO; do
if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then
cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/
echo "Added entity: $entity"
fi
done
;;
"neo4j")
# Neo4j entities
for entity in Album Track Genre Artist; do
if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then
cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/
echo "Added entity: $entity"
fi
done
;;
"cassandra")
# Cassandra entities
for entity in CassBankAccount FieldTestEntity FieldTestServiceImplEntity FieldTestMapstructAndServiceClassEntity FieldTestPaginationEntity; do
if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then
cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/
echo "Added entity: $entity"
fi
done
;;
"micro")
# Microservice entities
for entity in MicroserviceBankAccount MicroserviceOperation MicroserviceLabel FieldTestEntity FieldTestMapstructAndServiceClassEntity FieldTestServiceClassAndJpaFilteringEntity FieldTestServiceImplEntity FieldTestInfiniteScrollEntity FieldTestPaginationEntity; do
if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then
cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/
echo "Added entity: $entity"
fi
done
;;
"sqllight")
# SQL Light entities
for entity in BankAccount Label Operation; do
if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then
cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/
echo "Added entity: $entity"
fi
done
;;
"sqlfull"|"sql")
# SQL Full entities
for entity in BankAccount Label Operation Place Division FieldTestEntity FieldTestMapstructAndServiceClassEntity FieldTestServiceClassAndJpaFilteringEntity FieldTestServiceImplEntity FieldTestInfiniteScrollEntity FieldTestPaginationEntity FieldTestEnumWithValue TestEntity TestMapstruct TestServiceClass TestServiceImpl TestInfiniteScroll TestPagination TestManyToOne TestManyToMany TestManyRelPaginDTO TestOneToOne TestCustomTableName TestTwoRelationshipsSameEntity SuperMegaLargeTestEntity EntityWithDTO EntityWithPaginationAndDTO EntityWithServiceClassAndPagination EntityWithServiceClassPaginationAndDTO EntityWithServiceImplAndDTO EntityWithServiceImplAndPagination EntityWithServiceImplPaginationAndDTO MapsIdParentEntityWithoutDTO MapsIdChildEntityWithoutDTO MapsIdGrandchildEntityWithoutDTO MapsIdParentEntityWithDTO MapsIdChildEntityWithDTO MapsIdGrandchildEntityWithDTO MapsIdUserProfileWithDTO JpaFilteringRelationship JpaFilteringOtherSide; do
if [[ -f "$JHI_ENTITY_SAMPLES/$entity.json" ]]; then
cp "$JHI_ENTITY_SAMPLES/$entity.json" "$JHI_FOLDER_APP"/.jhipster/
echo "Added entity: $entity"
fi
done
;;
*)
echo "Unknown database type: ${{ inputs.database-type }}"
exit 1
;;
esac

- name: 'List generated entities'
shell: bash
run: |
echo "Generated entities:"
ls -al "$JHI_FOLDER_APP"/.jhipster/ || true
38 changes: 26 additions & 12 deletions .github/actions/generate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,36 @@
# limitations under the License.
#

name: 'Deprecated: Generate'
description: 'Generate application for test-integration scripts'
name: 'Generate Application'
description: 'Generate JHipster application using new action-based approach'
inputs:
sample-name:
description: 'Name of the sample to generate'
required: true
database-type:
description: 'Database type for entities'
required: false
default: 'sql'
extra-args:
description: 'Extra arguments'
description: 'Extra arguments for generation'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: 'GENERATION: install executable'
run: $JHI_SCRIPTS/10-install-jhipster.sh
shell: bash
- name: 'GENERATION: generate config'
run: $JHI_SCRIPTS/11-generate-config.sh
shell: bash
- name: 'GENERATION: project'
run: $JHI_SCRIPTS/12-generate-project.sh ${{ inputs.extra-args }}
shell: bash
- name: 'Initialize environment'
uses: ./.github/actions/init-environment@v0
with:
generator-path: generator-jhipster

- name: 'Generate sample configuration'
uses: ./.github/actions/generate-sample-config@v0
with:
sample-name: ${{ inputs.sample-name }}
database-type: ${{ inputs.database-type }}

- name: 'Generate project'
uses: ./.github/actions/generate-project@v0
with:
sample-name: ${{ inputs.sample-name }}
extra-args: ${{ inputs.extra-args }}
51 changes: 51 additions & 0 deletions .github/actions/init-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'Initialize Environment'
description: 'Initialize environment variables for JHipster testing'
inputs:
generator-path:
description: 'Path to the generator'
required: false
default: 'generator-jhipster'
workspace:
description: 'GitHub workspace path'
required: false
default: '${{ github.workspace }}'
runs:
using: 'composite'
steps:
- name: 'Set environment variables'
shell: bash
run: |
# Set core paths
echo "JHI_HOME=${{ inputs.workspace }}/${{ inputs.generator-path }}" >> $GITHUB_ENV
echo "JHI_INTEG=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration" >> $GITHUB_ENV
echo "JHI_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples" >> $GITHUB_ENV
echo "JHI_JDL_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/jdl-samples" >> $GITHUB_ENV
echo "JHI_FOLDER_APP=${{ inputs.workspace }}/app" >> $GITHUB_ENV

# Set CLI
echo "JHI_CLI=jhipster" >> $GITHUB_ENV

# Read versions from files
JHI_NODE_VERSION=$(cat ${{ inputs.workspace }}/${{ inputs.generator-path }}/generators/init/resources/.node-version)
echo "JHI_NODE_VERSION=$JHI_NODE_VERSION" >> $GITHUB_ENV

JHI_NPM_VERSION=$(grep -o '"npm": "[^"]*"' ${{ inputs.workspace }}/${{ inputs.generator-path }}/generators/common/resources/package.json | cut -f4 -d '"')
echo "JHI_NPM_VERSION=$JHI_NPM_VERSION" >> $GITHUB_ENV

JHI_VERSION=$(grep -o '"version": "[^"]*"' ${{ inputs.workspace }}/${{ inputs.generator-path }}/package.json | cut -f4 -d '"')
echo "JHI_VERSION=$JHI_VERSION" >> $GITHUB_ENV

# Set entity samples path
if [[ -d "${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples/.jhipster" ]]; then
echo "JHI_ENTITY_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples/.jhipster" >> $GITHUB_ENV
else
echo "JHI_ENTITY_SAMPLES=${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples/.jhipster" >> $GITHUB_ENV
fi

echo "Environment variables set:"
echo "JHI_HOME: ${{ inputs.workspace }}/${{ inputs.generator-path }}"
echo "JHI_SAMPLES: ${{ inputs.workspace }}/${{ inputs.generator-path }}/test-integration/samples"
echo "JHI_FOLDER_APP: ${{ inputs.workspace }}/app"
echo "JHI_NODE_VERSION: $JHI_NODE_VERSION"
echo "JHI_NPM_VERSION: $JHI_NPM_VERSION"
echo "JHI_VERSION: $JHI_VERSION"
24 changes: 16 additions & 8 deletions .github/workflows/generator-generate-blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,22 @@ jobs:
jhipster.cjs generate-blueprint --force --link-jhipster-dependency --generate-snapshots --skip-install
npm link generator-jhipster
npm link
- name: 'GENERATION: config'
run: $JHI_SCRIPTS/11-generate-config.sh
- name: 'GENERATION: project'
run: $JHI_SCRIPTS/12-generate-project.sh ${{ matrix.extra-args }} ${{ matrix.new-extra-args }} --blueprints foo
env:
JHI_CLI: jhipster.cjs
- name: 'GENERATION: jhipster info'
run: $JHI_SCRIPTS/14-jhipster-info.sh
- name: 'Initialize environment'
uses: ./generator-jhipster/.github/actions/init-environment@v0
with:
generator-path: generator-jhipster

- name: 'Generate sample configuration'
uses: ./generator-jhipster/.github/actions/generate-sample-config@v0
with:
sample-name: ng-default
database-type: sql

- name: 'Generate project'
uses: ./generator-jhipster/.github/actions/generate-project@v0
with:
sample-name: ng-default
extra-args: ${{ matrix.extra-args }} ${{ matrix.new-extra-args }} --blueprints foo
#----------------------------------------------------------------------
# Launch tests
#----------------------------------------------------------------------
Expand Down
Loading
Loading