Skip to content

Update Copyright Headers #649

Update Copyright Headers

Update Copyright Headers #649

Workflow file for this run

#
# 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-ignore:
- 'dependabot/**'
- 'skip_ci*'
paths-ignore:
- 'package*.json'
- 'generators/*client/templates/react/**'
- 'generators/*client/templates/vue/**'
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@v3
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') &&
needs.build-matrix.outputs.workflow-angular == 'true'
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@v3
with:
path: jhipster-kotlin
fetch-depth: 2
- name: Checkout JHipster repo
uses: actions/checkout@v3
with:
repository: jhipster/generator-jhipster
path: generator-jhipster
ref: v7.9.3
- 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' }}
- 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 }}-${{ matrix.npm-cache || 'angular' }}-${{ hashFiles('jhipster-kotlin/package-lock.json', 'jhipster-kotlin/**/package.json') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.setup.outputs.date }}-${{ matrix.npm-cache || 'angular' }}-
${{ runner.os }}-node-${{ steps.setup.outputs.date }}-
${{ 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 }}-${{ hashFiles('jhipster-kotlin/**/pom.xml.ejs') }}
restore-keys: |
${{ runner.os }}-maven-${{ steps.setup.outputs.date }}-
${{ runner.os }}-maven-${{ steps.setup.outputs.date }}
- name: 'SETUP: load gradle cache'
if: matrix.workspaces == 'true' || matrix.gradle == 1 || contains(matrix.name, 'gradle')
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}-${{ hashFiles('jhipster-kotlin/**/build.gradle.ejs') }}
restore-keys: |
${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}-
${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}
- name: 'TOOLS: configure tools installed by the system'
run: $KHI_SCRIPTS/03-system.sh
- name: 'TOOLS: configure git'
run: $KHI_SCRIPTS/04-git-config.sh
# Update global NPM for workspaces support
- name: 'Install required NPM version'
if: matrix.workspaces == 'true'
run: npm install -g npm@${{ steps.setup.outputs.npm-version }} || true
#----------------------------------------------------------------------
# Install JHipster and generate project+entities
#----------------------------------------------------------------------
- name: 'GENERATION: install JHipster'
run: $KHI_SCRIPTS/10-install-jhipster.sh
- name: 'GENERATION: config'
run: $KHI_SCRIPTS/11-generate-config.sh
- name: 'GENERATION: project'
run: $KHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies --skip-install ${{ matrix.extra-args }} ${{ matrix.new-extra-args }}
- name: 'GENERATION: workspace git'
if: matrix.workspaces == 'true'
run: |
git add .
git commit -m "Commit workspaces"
- name: 'GENERATION: jhipster info'
run: $KHI_SCRIPTS/14-jhipster-info.sh
#----------------------------------------------------------------------
# Detect changes against base commit
#----------------------------------------------------------------------
- name: 'MERGE: generate base'
continue-on-error: true
id: base-app
if: >-
github.event.pull_request &&
!contains(github.event.pull_request.labels.*.name, 'pr: disable-compare')
uses: ./generator-jhipster-kotlin/.github/actions/compare-base
with:
extra-args: '--skip-jhipster-dependencies ${{ matrix.extra-args }}'
- name: 'MERGE: compare changes'
continue-on-error: true
id: compare
if: steps.base-app.outcome == 'success'
uses: ./generator-jhipster-kotlin/.github/actions/compare
with:
application-path: ${{ steps.base-app.outputs.application-path }}
#----------------------------------------------------------------------
# Launch tests
#----------------------------------------------------------------------
- name: 'PREPARE: npm install'
if: steps.compare.outputs.equals != 'true'
run: ${{ (matrix.workspaces == 'true' && 'npm') || './npmw' }} install
- 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}}
- 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
- name: 'TESTS: packaging'
if: steps.compare.outputs.equals != 'true'
run: npm run ci:e2e:package
- name: 'TESTS: Start docker-compose containers for e2e tests'
if: steps.compare.outputs.equals != 'true'
run: npm run ci:e2e:prepare
- name: 'E2E: Run'
id: e2e
if: steps.compare.outputs.equals != 'true'
run: npm run ci:e2e:run --if-present
- name: 'BACKEND: Store failure logs'
uses: actions/upload-artifact@v3
if: always() && steps.backend.outcome == 'failure'
with:
name: log-${{ matrix.name }}
path: ${{ steps.setup.outputs.application-path }}/**/test-results/**/*.xml
- name: 'E2E: Store failure screenshots'
uses: actions/upload-artifact@v3
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