Build cache #122
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
# | |
# Copyright 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@v3 | |
with: | |
path: generator-jhipster | |
- name: 'SETUP: environment' | |
id: setup | |
uses: ./generator-jhipster/.github/actions/setup | |
with: | |
jdl-sample: cache | |
generator-jhipster-branch: local | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ steps.setup.outputs.node-version }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ steps.setup.outputs.java-version }} | |
- name: 'SETUP: load npm cache' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
~/.cache/Cypress/ | |
key: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}${{ github.event.inputs.key }} | |
- name: 'SETUP: load maven cache' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ steps.setup.outputs.date }}${{ github.event.inputs.key }} | |
- name: 'SETUP: load gradle cache' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}${{ github.event.inputs.key }} | |
# 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/angular/templates | |
- 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 | |
- name: Cache react node_modules | |
run: npm install --force | |
continue-on-error: true | |
working-directory: ${{ github.workspace }}/generator-jhipster/generators/react/templates | |
- name: Cache vue node_modules | |
run: npm install | |
continue-on-error: true | |
working-directory: ${{ github.workspace }}/generator-jhipster/generators/vue/templates | |
- name: 'mvn: install JHipster' | |
run: $JHI_SCRIPTS/10-install-jhipster.sh | |
continue-on-error: true | |
- name: 'mvn(imperative): prepare project' | |
run: | | |
$JHI_SCRIPTS/11-generate-config.sh | |
continue-on-error: true | |
- name: 'mvn(imperative): cache dependencies' | |
run: | | |
$JHI_SCRIPTS/12-generate-project.sh --skip-install --workspaces | |
npm install --force | |
npm run backend:build-cache || true | |
cd .. | |
rm -rf app | |
mkdir app | |
continue-on-error: true | |
- name: 'mvn(reactive): prepare project' | |
run: | | |
$JHI_SCRIPTS/11-generate-config.sh | |
continue-on-error: true | |
- name: 'mvn(reactive): cache dependencies' | |
run: | | |
$JHI_SCRIPTS/12-generate-project.sh --skip-install --workspaces --reactive | |
npm install --force | |
npm run backend:build-cache || true | |
cd .. | |
rm -rf app | |
mkdir app | |
continue-on-error: true | |
- name: 'gradle(imperative): prepare project' | |
run: | | |
$JHI_SCRIPTS/11-generate-config.sh | |
continue-on-error: true | |
- name: 'gradle(imperative): cache dependencies' | |
run: | | |
$JHI_SCRIPTS/12-generate-project.sh --skip-install --workspaces --build gradle | |
npm install --force | |
npm run backend:build-cache || true | |
cd .. | |
rm -rf app | |
mkdir app | |
continue-on-error: true | |
- name: 'gradle(reactive): prepare project' | |
run: | | |
$JHI_SCRIPTS/11-generate-config.sh | |
continue-on-error: true | |
- name: 'gradle(reactive): cache dependencies' | |
run: | | |
$JHI_SCRIPTS/12-generate-project.sh --skip-install --workspaces --build gradle --reactive | |
npm install --force | |
npm run backend:build-cache || true | |
cd .. | |
rm -rf app | |
mkdir app | |
continue-on-error: true |