-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from mshima/cache
Implement cache
- Loading branch information
Showing
5 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,19 @@ jobs: | |
with: | ||
distribution: 'adopt' | ||
java-version: ${{ steps.setup.outputs.java-version }} | ||
- name: 'SETUP: load cache' | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.npm | ||
~/.cache/Cypress/ | ||
~/.m2/repository | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-cache-${{ steps.setup.outputs.date }}-${{ hashFiles('pom.xml', '**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }}- | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }} | ||
- name: 'TOOLS: configure tools installed by the system' | ||
run: $JHI_SCRIPTS/03-system.sh | ||
- name: 'TOOLS: configure git' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# | ||
# 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: Build cache | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
key: | ||
description: 'Cache key' | ||
required: false | ||
default: '-new' | ||
schedule: | ||
- cron: '0 0 * * *' | ||
jobs: | ||
npm_cache: | ||
name: Create cache | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: ${{ github.workspace }}/app | ||
steps: | ||
- name: 'SETUP: Checkout generator-jhipster' | ||
uses: actions/checkout@v2 | ||
with: | ||
path: jhipster-bom | ||
- name: 'SETUP: Checkout generator-jhipster' | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'jhipster/generator-jhipster' | ||
path: generator-jhipster | ||
- name: 'SETUP: environment' | ||
id: setup | ||
uses: ./generator-jhipster/.github/actions/setup | ||
with: | ||
jdl-sample: cache | ||
generator-jhipster-branch: local | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: ${{ steps.setup.outputs.node-version }} | ||
- name: 'SETUP: load npm cache' | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.npm | ||
~/.cache/Cypress/ | ||
~/.m2/repository | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-cache-${{ steps.setup.outputs.date }}${{ github.event.inputs.key }} | ||
restore-keys: | | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }} | ||
# generator-jhipster npm | ||
- name: 'Install generator-jhipster 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 | ||
working-directory: ${{ github.workspace }}/generator-jhipster | ||
- name: Cache last released generator-jhipster | ||
run: | | ||
npm install -g generator-jhipster@latest | ||
npm uninstall -g generator-jhipster | ||
continue-on-error: true | ||
- name: Cache common node_modules | ||
run: npm install | ||
continue-on-error: true | ||
working-directory: ${{ github.workspace }}/generator-jhipster/generators/common/templates/ | ||
- name: Cache angular node_modules | ||
run: npm install --force | ||
continue-on-error: true | ||
working-directory: ${{ github.workspace }}/generator-jhipster/generators/client/templates/angular | ||
- name: Cache client common node_modules | ||
run: | | ||
npm install --force | ||
npx cypress install | ||
continue-on-error: true | ||
working-directory: ${{ github.workspace }}/generator-jhipster/generators/client/templates/common | ||
- name: Cache react node_modules | ||
run: npm install --force | ||
continue-on-error: true | ||
working-directory: ${{ github.workspace }}/generator-jhipster/generators/client/templates/react | ||
- name: Cache vue node_modules | ||
run: npm install | ||
continue-on-error: true | ||
working-directory: ${{ github.workspace }}/generator-jhipster/generators/client/templates/vue | ||
|
||
# build | ||
- name: jhipster-bom build | ||
run: mvn -ntp dependency:go-offline | ||
working-directory: ${{ github.workspace }}/jhipster-bom | ||
- name: 'mvn: install JHipster' | ||
run: $JHI_SCRIPTS/10-install-jhipster.sh | ||
continue-on-error: true | ||
|
||
# maven | ||
- name: 'mvn: config' | ||
run: $JHI_SCRIPTS/11-generate-config.sh | ||
continue-on-error: true | ||
- name: 'mvn: project' | ||
run: $JHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies --skip-install --workspaces | ||
continue-on-error: true | ||
- name: 'mvn: replace version in generated project' | ||
run: $JHI_SCRIPTS/13-replace-version-generated-project.sh | ||
continue-on-error: true | ||
- name: "mvn: install workspaces deps" | ||
run: npm install --force | ||
continue-on-error: true | ||
- name: "mvn: build cache" | ||
run: npm run backend:build-cache || true | ||
continue-on-error: true | ||
|
||
# gradle | ||
- name: 'gradle: config' | ||
run: $JHI_SCRIPTS/11-generate-config.sh | ||
continue-on-error: true | ||
- name: 'gradle: project' | ||
run: $JHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies --skip-install --workspaces | ||
continue-on-error: true | ||
- name: 'gradle: replace version in generated project' | ||
run: $JHI_SCRIPTS/13-replace-version-generated-project.sh | ||
continue-on-error: true | ||
- name: "gradle: install workspaces deps" | ||
run: npm install --force | ||
continue-on-error: true | ||
- name: "gradle: build cache" | ||
run: npm run backend:build-cache || true | ||
continue-on-error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,6 +147,19 @@ jobs: | |
with: | ||
distribution: 'adopt' | ||
java-version: ${{ steps.setup.outputs.java-version }} | ||
- name: 'SETUP: load cache' | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.npm | ||
~/.cache/Cypress/ | ||
~/.m2/repository | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-cache-${{ steps.setup.outputs.date }}-${{ hashFiles('pom.xml', '**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }}- | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }} | ||
- name: 'TOOLS: configure tools installed by the system' | ||
run: $JHI_SCRIPTS/03-system.sh | ||
- name: 'TOOLS: configure git' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,19 @@ jobs: | |
with: | ||
distribution: 'adopt' | ||
java-version: ${{ steps.setup.outputs.java-version }} | ||
- name: 'SETUP: load npm cache' | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.npm | ||
~/.cache/Cypress/ | ||
~/.m2/repository | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-cache-${{ steps.setup.outputs.date }}-${{ hashFiles('pom.xml', '**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }}- | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }} | ||
- name: 'TOOLS: configure tools installed by the system' | ||
run: $JHI_SCRIPTS/03-system.sh | ||
- name: 'TOOLS: configure git' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,19 @@ jobs: | |
with: | ||
distribution: 'adopt' | ||
java-version: ${{ steps.setup.outputs.java-version }} | ||
- name: 'SETUP: load npm cache' | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.npm | ||
~/.cache/Cypress/ | ||
~/.m2/repository | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-cache-${{ steps.setup.outputs.date }}-${{ hashFiles('pom.xml', '**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }}- | ||
${{ runner.os }}-cache-${{ steps.setup.outputs.date }} | ||
- name: 'TOOLS: configure tools installed by the system' | ||
run: $JHI_SCRIPTS/03-system.sh | ||
- name: 'TOOLS: configure git' | ||
|