diff --git a/.github/actions/compare-base/action.yml b/.github/actions/compare-base/action.yml index c88577560c5..eb0f25010d5 100644 --- a/.github/actions/compare-base/action.yml +++ b/.github/actions/compare-base/action.yml @@ -37,12 +37,15 @@ runs: steps: - name: 'MERGE: Install base generator-jhipster' run: | - mkdir -p ${{ github.workspace }}/base/generator-jhipster - cd ${{ github.workspace }}/base/generator-jhipster - git clone "$JHI_HOME" . + if [[ "$JHI_CLI_PACKAGE" == "" ]]; then + JHI_CLI_PACKAGE=generator-jhipster + fi + mkdir -p "${{ github.workspace }}/base/$JHI_CLI_PACKAGE" + cd "${{ github.workspace }}/base/$JHI_CLI_PACKAGE" + git clone "${{ github.workspace }}/$JHI_CLI_PACKAGE" . git checkout @~1 git log - npm uninstall -g generator-jhipster + npm uninstall -g $JHI_CLI_PACKAGE npm install npm install -g . shell: bash @@ -64,7 +67,7 @@ runs: - name: 'MERGE: merge base project' id: base run: | - $JHI_SCRIPTS/12-generate-project.sh --skip-install --skip-git ${{ inputs.extra-args }} + $JHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies --skip-install --skip-git ${{ inputs.extra-args }} echo "::set-output name=application-path::${{inputs.application-path}}" env: JHI_FOLDER_APP: ${{ inputs.application-path }} diff --git a/.github/actions/compare/action.yml b/.github/actions/compare/action.yml index eb2ab9ae4bd..3e52683bb42 100644 --- a/.github/actions/compare/action.yml +++ b/.github/actions/compare/action.yml @@ -23,7 +23,7 @@ inputs: application-path: description: 'Application path' required: false - default: ${{ github.workspace }}/app + default: ${{ github.workspace }}/base/app outputs: equals: description: "Generated source didn't changed" diff --git a/.github/actions/generate/action.yml b/.github/actions/generate/action.yml new file mode 100644 index 00000000000..955fe26877f --- /dev/null +++ b/.github/actions/generate/action.yml @@ -0,0 +1,38 @@ +# +# Copyright 2013-2021 the original author or authors from the JHipster project. +# +# This file is part of the JHipster project, see https://www.jhipster.tech/ +# for more information. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: 'Generate' +description: 'Generate application for test-integration scripts' +inputs: + extra-args: + description: 'Extra arguments' + 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 --skip-jhipster-dependencies ${{ inputs.extra-args }} + shell: bash diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 81f54213672..bf6ec332fa3 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -76,6 +76,14 @@ inputs: description: 'JHipster BOM path' required: false default: ${{ github.workspace }}/jhipster-bom + package-with-executable: + description: 'Package which contains the executable' + required: false + default: '' + executable: + description: 'Executable' + required: false + default: jhipster outputs: java-version: description: 'Java version' @@ -99,10 +107,14 @@ runs: id: variables run: | JHI_HOME="${{ inputs.generator-jhipster-directory }}" + JHI_WORKSPACE="${{ github.workspace }}" + JHI_CLI_PACKAGE="${{inputs.package-with-executable}}" source "$JHI_HOME/test-integration/scripts/00-init-env.sh" echo "JHI_HOME=$JHI_HOME" >> $GITHUB_ENV echo "JHI_SCRIPTS=$JHI_SCRIPTS" >> $GITHUB_ENV + echo "JHI_CLI_PACKAGE_PATH=$JHI_CLI_PACKAGE_PATH" >> $GITHUB_ENV + echo "JHI_CLI_PACKAGE=$JHI_CLI_PACKAGE" >> $GITHUB_ENV echo "JHI_LIB_REPO=${{inputs.jhipster-bom-repository}}" >> $GITHUB_ENV echo "JHI_LIB_BRANCH=${{inputs.jhipster-bom-branch}}" >> $GITHUB_ENV @@ -115,6 +127,7 @@ runs: echo "JHI_APP=${{inputs.application-sample}}" >> $GITHUB_ENV echo "JHI_ENTITY=${{inputs.entities-sample}}" >> $GITHUB_ENV echo "JHI_JDL_ENTITY=${{inputs.jdl-entities-sample}}" >> $GITHUB_ENV + echo "JHI_CLI=${{inputs.executable}}" >> $GITHUB_ENV echo "JHI_PROFILE=${{inputs.application-environment}}" >> $GITHUB_ENV test ${{inputs.application-packaging}} != war || echo "JHI_WAR=1" >> $GITHUB_ENV @@ -152,3 +165,6 @@ runs: - name: 'SETUP: Create required structure' run: mkdir -p $JHI_FOLDER_APP shell: bash + - name: 'SETUP: configure git' + run: $JHI_SCRIPTS/04-git-config.sh + shell: bash diff --git a/test-integration/scripts/00-init-env.sh b/test-integration/scripts/00-init-env.sh index 83f77bf4d66..78d7c39e120 100755 --- a/test-integration/scripts/00-init-env.sh +++ b/test-integration/scripts/00-init-env.sh @@ -24,6 +24,15 @@ if [[ "$JHI_HOME" == "" ]]; then JHI_HOME="$JHI_DETECTED_DIR" fi +# folder for executable package (blueprints or generator-jhipster) +if [[ "$JHI_CLI_PACKAGE_PATH" == "" ]]; then + if [[ "$JHI_CLI_PACKAGE" != "" && "$JHI_WORKSPACE" != "" ]]; then + JHI_CLI_PACKAGE_PATH="$JHI_WORKSPACE/$JHI_CLI_PACKAGE" + else + JHI_CLI_PACKAGE_PATH="$JHI_HOME" + fi +fi + # folder where the repo is cloned if [[ "$JHI_REPO_PATH" == "" ]]; then JHI_REPO_PATH=$(init_var "$BUILD_REPOSITORY_LOCALPATH" "$GITHUB_WORKSPACE") @@ -78,6 +87,10 @@ if [[ "$JHI_JDK" == "11" && "$JHI_GITHUB_CI" != "true" ]]; then JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") fi +if [[ "$JHI_CLI" == "" ]]; then + JHI_CLI=jhipster +fi + # node version JHI_NODE_VERSION=$(grep -o "NODE_VERSION = '[^']*'" $JHI_HOME/generators/generator-constants.js | cut -f2 -d "'") diff --git a/test-integration/scripts/10-install-jhipster.sh b/test-integration/scripts/10-install-jhipster.sh index 1b6e343c1bb..e2b02e2e5bb 100755 --- a/test-integration/scripts/10-install-jhipster.sh +++ b/test-integration/scripts/10-install-jhipster.sh @@ -49,12 +49,12 @@ fi #------------------------------------------------------------------------------- cd "$HOME" if [[ "$JHI_REPO" == *"/generator-jhipster" || "$JHI_GEN_BRANCH" == "local" ]]; then - echo "*** generator-jhipster: use local version at JHI_HOME=$JHI_HOME" + echo "*** generator-jhipster or executable: use local version at JHI_CLI_PACKAGE_PATH=$JHI_CLI_PACKAGE_PATH" - cd "$JHI_HOME" + cd "$JHI_CLI_PACKAGE_PATH" 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 npm ci - npm install -g "$JHI_HOME" + npm install -g "$JHI_CLI_PACKAGE_PATH" elif [[ "$JHI_GEN_BRANCH" == "release" ]]; then echo "*** generator-jhipster: use release version" diff --git a/test-integration/scripts/12-generate-project.sh b/test-integration/scripts/12-generate-project.sh index 6b94abd2bbe..f9220a6c712 100755 --- a/test-integration/scripts/12-generate-project.sh +++ b/test-integration/scripts/12-generate-project.sh @@ -19,7 +19,7 @@ if [[ "$JHI_ENTITY" == "jdl" ]]; then cp -f "$JHI_SAMPLES"/"$JHI_APP"/*.jdl "$JHI_FOLDER_APP"/ cd "$JHI_FOLDER_APP" ls -la "$JHI_FOLDER_APP"/ - jhipster import-jdl *.jdl --no-insight $@ + eval "$JHI_CLI import-jdl *.jdl --no-insight $@" elif [[ "$JHI_APP" == "jdl" ]]; then #------------------------------------------------------------------------------- @@ -40,7 +40,7 @@ elif [[ "$JHI_APP" == "jdl" ]]; then ls -la "$JHI_FOLDER_APP"/ cd "$JHI_FOLDER_APP" - jhipster import-jdl *.jdl --no-insight $@ + eval "$JHI_CLI import-jdl *.jdl --no-insight $@" else #------------------------------------------------------------------------------- @@ -55,7 +55,7 @@ else fi cd "$JHI_FOLDER_APP" - jhipster --force --no-insight --skip-checks --with-entities $@ + eval "$JHI_CLI --force --no-insight --skip-checks --with-entities $@" fi