Skip to content

Commit

Permalink
Use setup action at others workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jun 6, 2021
1 parent d3bf563 commit 61adf65
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 311 deletions.
63 changes: 26 additions & 37 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,22 @@ jobs:
steps:
- name: 'SETUP: Checkout generator-jhipster'
uses: actions/checkout@v2
- name: 'SETUP: environment'
id: setup
uses: ./.github/actions/setup
- uses: actions/setup-node@v2.1.5
with:
node-version: 14
- name: 'SETUP: Get date for cache key'
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
node-version: ${{ steps.setup.outputs.node-version }}
- name: 'SETUP: load npm cache'
uses: actions/cache@v2.1.6
with:
path: |
~/.npm
~/.cache/Cypress/
key: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}
key: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}

- name: 'Install generator-jhipster npm version'
run: npm install -g npm@$(node -e "console.log(require('./generators/generator-constants').NPM_VERSION);")
run: npm install -g npm@${{ steps.setup.outputs.npm-version }}
- name: Cache generator-jhipster node_modules
run: npm ci
continue-on-error: true
Expand All @@ -84,7 +83,7 @@ jobs:
working-directory: generators/client/templates/angular
- name: Cache client common node_modules
run: |
npm install
npm install --legacy-peer-deps
npx cypress install
continue-on-error: true
working-directory: generators/client/templates/common
Expand All @@ -110,36 +109,31 @@ jobs:
uses: actions/checkout@v2
with:
path: generator-jhipster
- name: 'SETUP: Create required structure'
run: |
mkdir app
working-directory: ${{ github.workspace }}
- name: 'SETUP: environment'
id: setup
uses: ./generator-jhipster/.github/actions/setup
- uses: actions/setup-node@v2.1.5
with:
node-version: 14
node-version: ${{ steps.setup.outputs.node-version }}
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11.x'
- name: 'SETUP: Get date for cache key'
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
java-version: ${{ steps.setup.outputs.java-version }}
- name: 'SETUP: load npm cache'
uses: actions/cache@v2.1.6
with:
path: |
~/.npm
~/.cache/Cypress/
key: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}-cache
restore-keys: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}
key: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-cache
restore-keys: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}
- name: 'SETUP: load maven cache'
uses: actions/cache@v2.1.6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ steps.get-date.outputs.date }}
key: ${{ runner.os }}-maven-${{ steps.setup.outputs.date }}
- name: 'Install generator-jhipster npm version'
run: npm install -g npm@$(node -e "console.log(require('./generators/generator-constants').NPM_VERSION);")
run: npm install -g npm@${{ steps.setup.outputs.npm-version }}

- name: 'GENERATION: install JHipster'
run: $JHI_SCRIPTS/10-install-jhipster.sh
Expand Down Expand Up @@ -171,43 +165,38 @@ jobs:
uses: actions/checkout@v2
with:
path: generator-jhipster
- name: 'SETUP: Create required structure'
run: |
mkdir app
working-directory: ${{ github.workspace }}
- name: 'SETUP: environment'
id: setup
uses: ./generator-jhipster/.github/actions/setup
- uses: actions/setup-node@v2.1.5
with:
node-version: 14
node-version: ${{ steps.setup.outputs.node-version }}
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11.x'
- name: 'SETUP: Get date for cache key'
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
java-version: ${{ steps.setup.outputs.java-version }}
- name: 'SETUP: load npm cache'
uses: actions/cache@v2.1.6
with:
path: |
~/.npm
~/.cache/Cypress/
key: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}-cache
restore-keys: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}
key: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-cache
restore-keys: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}
- name: 'SETUP: load maven cache'
uses: actions/cache@v2.1.6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ steps.get-date.outputs.date }}
key: ${{ runner.os }}-maven-${{ steps.setup.outputs.date }}
- name: 'SETUP: load gradle cache'
uses: actions/cache@v2.1.6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}
key: ${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}
- name: 'Install generator-jhipster npm version'
run: npm install -g npm@$(node -e "console.log(require('./generators/generator-constants').NPM_VERSION);")
run: npm install -g npm@${{ steps.setup.outputs.npm-version }}

- name: 'GENERATION: install JHipster'
run: $JHI_SCRIPTS/10-install-jhipster.sh
Expand Down
80 changes: 25 additions & 55 deletions .github/workflows/incremental-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,6 @@ on:
- 'generators/entity/**'
- 'generators/database-changelog/**'
- 'generators/database-changelog-liquibase/**'
env:
JHI_RUN_APP: 1
JHI_JDK: 11
JHI_LIB_REPO: https://github.com/jhipster/jhipster-bom.git
JHI_LIB_BRANCH: main
JHI_GEN_REPO: https://github.com/jhipster/generator-jhipster.git
JHI_GEN_BRANCH: main
SPRING_OUTPUT_ANSI_ENABLED: ALWAYS
SPRING_JPA_SHOW_SQL: false
JHI_DISABLE_WEBPACK_LOGS: true
JHI_E2E_HEADLESS: true
JHI_HOME: ${{ github.workspace }}/generator-jhipster
JHI_SCRIPTS: ${{ github.workspace }}/generator-jhipster/test-integration/scripts
JHI_FOLDER_APP: ${{ github.workspace }}/app
NG_CLI_ANALYTICS: 'false'
JHI_GITHUB_CI: true
FORCE_COLOR: 1
# https://github.com/actions/virtual-environments/issues/1499#issuecomment-689467080
MAVEN_OPTS: >-
-Dhttp.keepAlive=false
-Dmaven.wagon.http.pool=false
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
jobs:
applications:
name: ${{ matrix.app-type }}
Expand All @@ -77,7 +55,6 @@ jobs:
strategy:
fail-fast: false
matrix:
node_version: [14.16.0]
os: [ubuntu-20.04]
cache: [angular]
app-type:
Expand All @@ -86,17 +63,9 @@ jobs:
- app-type: liquibase-jdl-rename-field
entity: jdl
liquibase: jdl
profile: prod
environment: prod
war: 0
e2e: 1
env:
JHI_ENTITY: ${{ matrix.entity }}
JHI_APP: ${{ matrix.app-type }}
JHI_LIQUIBASE: ${{ matrix.liquibase }}
JHI_PROFILE: ${{ matrix.profile }}
JHI_WAR: ${{ matrix.war }}
JHI_E2E: ${{ matrix.e2e }}
JHI_TESTCONTAINERS: ${{ matrix.testcontainers }}
steps:
#----------------------------------------------------------------------
# Install all tools and check configuration
Expand All @@ -105,51 +74,52 @@ jobs:
uses: actions/checkout@v2
with:
path: generator-jhipster
- name: 'SETUP: Create required structure'
run: |
mkdir app
working-directory: ${{ github.workspace }}
- name: 'SETUP: environment'
id: setup
uses: ./generator-jhipster/.github/actions/setup
with:
application-sample: ${{ matrix.app-type }}
entities-sample: ${{ matrix.entity }}
application-environment: ${{ matrix.environment }}
application-packaging: ${{ (matrix.war == 1 && 'war') || 'jar' }}
enable-testcontainers: ${{ matrix.testcontainers == 1 }}
- uses: actions/setup-node@v2.1.5
with:
node-version: ${{ matrix.node_version }}
node-version: ${{ steps.setup.outputs.node-version }}
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11.x'
- name: 'SETUP: Get date'
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
java-version: ${{ steps.setup.outputs.java-version }}
- name: 'SETUP: load npm cache'
uses: actions/cache@v2.1.6
with:
path: |
~/.npm
~/.cache/Cypress/
key: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}-${{ matrix.cache }}-${{ hashFiles('generator-jhipster/package-lock.json', 'generator-jhipster/**/package.json') }}
key: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-${{ matrix.cache }}-${{ hashFiles('generator-jhipster/package-lock.json', 'generator-jhipster/**/package.json') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.get-date.outputs.date }}-${{ matrix.cache }}-
${{ runner.os }}-node-${{ steps.get-date.outputs.date }}-
${{ runner.os }}-node-${{ steps.get-date.outputs.date }}
${{ runner.os }}-node-${{ steps.setup.outputs.date }}-${{ matrix.cache }}-
${{ runner.os }}-node-${{ steps.setup.outputs.date }}-
${{ runner.os }}-node-${{ steps.setup.outputs.date }}
- name: 'SETUP: load maven cache'
uses: actions/cache@v2.1.6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ steps.get-date.outputs.date }}-${{ hashFiles('generator-jhipster/**/pom.xml.ejs') }}
key: ${{ runner.os }}-maven-${{ steps.setup.outputs.date }}-${{ hashFiles('generator-jhipster/**/pom.xml.ejs') }}
restore-keys: |
${{ runner.os }}-maven-${{ steps.get-date.outputs.date }}-
${{ runner.os }}-maven-${{ steps.get-date.outputs.date }}
${{ runner.os }}-maven-${{ steps.setup.outputs.date }}-
${{ runner.os }}-maven-${{ steps.setup.outputs.date }}
- name: 'SETUP: load gradle cache'
if: contains(matrix.app-type, 'gradle')
uses: actions/cache@v2.1.6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}-${{ hashFiles('generator-jhipster/**/build.gradle.ejs') }}
key: ${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}-${{ hashFiles('generator-jhipster/**/build.gradle.ejs') }}
restore-keys: |
${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}-
${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}
${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}-
${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}
- name: 'ENV: display variables'
run: $JHI_SCRIPTS/01-display-configuration.sh
- name: 'TOOLS: configure tools installed by the system'
Expand All @@ -161,8 +131,8 @@ jobs:
#----------------------------------------------------------------------
- name: 'GENERATION: install JHipster'
run: $JHI_SCRIPTS/10-install-jhipster.sh
- name: 'GENERATION: entities'
run: $JHI_SCRIPTS/11-generate-entities.sh
- name: 'GENERATION: config'
run: $JHI_SCRIPTS/11-generate-config.sh
- name: 'GENERATION: project'
run: $JHI_SCRIPTS/12-generate-project.sh --with-entities --force --skip-jhipster-dependencies --creation-timestamp '2020-01-01'
env:
Expand Down Expand Up @@ -199,7 +169,7 @@ jobs:
if: always() && steps.e2e.outcome == 'failure'
with:
name: screenshots-${{ matrix.app-type }}
path: ${{ github.workspace }}/app/*/cypress/screenshots
path: ${{ steps.setup.outputs.application-path }}/*/cypress/screenshots
- name: 'ANALYSIS: Sonar analysis'
run: $JHI_SCRIPTS/25-sonar-analyze.sh
env:
Expand Down
Loading

0 comments on commit 61adf65

Please sign in to comment.