forked from jhipster/generator-jhipster
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (167 loc) · 6.18 KB
/
cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#
# 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 }}
restore-keys: |
${{ runner.os }}-node-${{ steps.setup.outputs.date }}
- 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 }}
restore-keys: |
${{ runner.os }}-maven-${{ steps.setup.outputs.date }}
- 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 }}
restore-keys: |
${{ runner.os }}-gradle-${{ 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/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-jhipster-dependencies --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-jhipster-dependencies --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-jhipster-dependencies --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-jhipster-dependencies --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