-
-
Notifications
You must be signed in to change notification settings - Fork 95
203 lines (202 loc) · 9.78 KB
/
angular.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#
# 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: Angular
concurrency:
# Group PRs by head_ref, push to main branch by commit id, and others branch by ref.
group: ${{ github.workflow }}-${{ github.head_ref || (github.ref == 'refs/heads/main' && github.sha) || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
types: [closed, opened, synchronize, reopened]
branches:
- '*'
jobs:
build-matrix:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.build.outputs.matrix }}
client: ${{ steps.build.outputs.client }}
server: ${{ steps.build.outputs.server }}
any: ${{ steps.build.outputs.any }}
workflow-angular: ${{ steps.build.outputs.workflow-angular }}
workflow-react: ${{ steps.build.outputs.workflow-react }}
workflow-vue: ${{ steps.build.outputs.workflow-vue }}
steps:
- name: 'SETUP: Checkout generator-jhipster-kotlin'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: 'Build matrix'
id: build
uses: ./.github/actions/build-matrix
with:
workflow-samples-file: angular
applications:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'ubuntu-20.04' }}
needs: build-matrix
defaults:
run:
working-directory: ${{ github.workspace }}/app
if: >-
!contains(github.event.head_commit.message, '[react]') &&
!contains(github.event.head_commit.message, '[vue]') &&
!contains(github.event.pull_request.title, '[react]') &&
!contains(github.event.pull_request.title, '[vue]') &&
!contains(github.event.head_commit.message, '[ci skip]') &&
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.pull_request.title, '[skip ci]') &&
!contains(github.event.pull_request.title, '[ci skip]') &&
github.event.action != 'closed' &&
!contains(github.event.pull_request.labels.*.name, 'pr: skip-ci')
# ktlint takes 8 minutes to run, add additional 15 minutes
# https://github.com/pinterest/ktlint/issues/2754
timeout-minutes: 40
strategy:
fail-fast: false
# Matrix available at https://github.com/jhipster/jhipster-kotlin/tree/main/test-integration/workflow-samples/
matrix: ${{fromJson(needs.build-matrix.outputs.matrix)}}
steps:
#----------------------------------------------------------------------
# Install all tools and check configuration
#----------------------------------------------------------------------
- name: 'SETUP: Checkout generator-jhipster-kotlin'
uses: actions/checkout@v4
with:
path: jhipster-kotlin
fetch-depth: 2
- run: npm install
working-directory: jhipster-kotlin
# workspaces fork the process and lookup blueprints again, link globally to be findable
- run: npm link
if: matrix.workspaces == 'true'
working-directory: jhipster-kotlin
- uses: jhipster/actions/setup-runner@v0
with:
node-version: 20
java-version: 17
binary-dir: ${{ github.workspace }}/jhipster-kotlin/cli
- run: |
mkdir -p ~/.gradle
echo "org.gradle.warning.mode=all" >> ~/.gradle/gradle.properties
- name: 'SETUP: environment'
id: setup
uses: ./jhipster-kotlin/.github/actions/setup
with:
application-sample: ${{ matrix.jhi-app-sample || matrix.app-sample || 'jdl' }}
entities-sample: ${{ matrix.entity || 'none' }}
jdl-entities-sample: ${{ matrix.jdl-entity || '' }}
jdl-sample: ${{ matrix.jdl-samples || '' }}
application-environment: ${{ matrix.environment || 'prod' }}
application-packaging: ${{ (matrix.war == 1 && 'war') || 'jar' }}
# Update global NPM for workspaces support
#----------------------------------------------------------------------
# Install JHipster and generate project+entities
#----------------------------------------------------------------------
- run: cli.cjs generate-sample --skip-jhipster-dependencies --skip-install --skip-ktlint-format ${{ matrix.extra-args }} ${{ matrix.new-extra-args }}
- run: cli.cjs info
#----------------------------------------------------------------------
# Detect changes against base commit
#----------------------------------------------------------------------
- uses: jhipster/actions/compare-sample@v0
id: compare
if: >-
github.event.pull_request &&
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
with:
generator-path: jhipster-kotlin
cmd: cli.cjs generate-sample --skip-jhipster-dependencies --skip-install --skip-ktlint-format ${{ matrix.extra-args }}
#----------------------------------------------------------------------
# Launch tests
#----------------------------------------------------------------------
- name: 'TESTS: backend'
id: backend
if: steps.compare.outputs.equals != 'true' && matrix.skip-backend-tests != 1 && needs.build-matrix.outputs.server != 'false'
run: npm run ci:backend:test
continue-on-error: ${{matrix.continue-on-backend-tests-error || false}}
timeout-minutes: 20
- name: 'PREPARE: npm install'
if: steps.compare.outputs.equals != 'true'
run: ${{ (matrix.workspaces == 'true' && 'npm') || './npmw' }} install
timeout-minutes: 7
- name: 'TESTS: packaging'
if: steps.compare.outputs.equals != 'true'
run: npm run ci:e2e:package
timeout-minutes: 7
- name: 'TESTS: Start docker-compose containers for e2e tests'
if: steps.compare.outputs.equals != 'true'
run: npm run ci:e2e:prepare
timeout-minutes: 5
- run: npm run preci:e2e:server:start --if-present
- run: npm run ci:e2e:run --if-present
id: e2e
if: steps.compare.outputs.equals != 'true'
timeout-minutes: 20
# - name: 'TESTS: frontend'
# if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 1 && needs.build-matrix.outputs.client != 'false'
# run: npm run ci:frontend:test
# timeout-minutes: 8
- name: 'BACKEND: Store failure logs'
uses: actions/upload-artifact@v4
if: always() && steps.backend.outcome == 'failure'
with:
name: log-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/reports/ktlint/**
- name: 'E2E: Store failure screenshots'
uses: actions/upload-artifact@v4
if: always() && steps.e2e.outcome == 'failure'
with:
name: screenshots-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/cypress/screenshots
- name: Dump docker logs
if: always()
uses: jwalton/gh-docker-logs@v2
- name: 'ANALYSIS: Sonar analysis'
if: >-
github.event_name == 'push' &&
github.repository == 'jhipster/generator-jhipster' &&
matrix.sonar-analyse == 'true' &&
steps.compare.outputs.equals != 'true' &&
matrix.workspaces != 'true' &&
matrix.skip-frontend-tests != 1 &&
needs.build-matrix.outputs.client != 'false' &&
matrix.skip-backend-tests != 1 &&
needs.build-matrix.outputs.server != 'false'
run: |
./mvnw -ntp --batch-mode initialize org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectKey=jhipster-sample-application \
-Dsonar.organization=jhipster \
-Dsonar.login=$SONAR_TOKEN
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
check-angular:
runs-on: ubuntu-latest
needs: [applications]
if: always()
steps:
- run: |
echo '${{ toJSON(needs) }}'
if [ 'skipped' == '${{ needs.applications.result }}' ] || [ 'success' == '${{ needs.applications.result }}' ] || [ 'closed' == '${{ github.event.action }}' ]; then
exit 0
fi
exit 1