<commit_before>#
# 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: Dev Server
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:
      - 'generators/*client/**'
  pull_request:
    types: [closed, opened, synchronize, reopened]
    branches:
      - '*'
    paths:
      - 'generators/*client/**'
jobs:
  build-matrix:
    runs-on: ubuntu-20.04
    outputs:
      matrix: ${{ steps.build.outputs.matrix }}
    steps:
      - name: 'SETUP: Checkout generator-jhipster'
        uses: actions/checkout@v2.4.0
        with:
          fetch-depth: 2
      - name: 'Build matrix'
        id: build
        uses: ./.github/actions/build-matrix
        with:
          workflow-file-prefix: devserver
  applications:
    name: ${{ matrix.app-sample }}
    needs: build-matrix
    runs-on: ubuntu-20.04
    defaults:
      run:
        working-directory: ${{ github.workspace }}/app
    timeout-minutes: 40
    strategy:
      fail-fast: false
      matrix: ${{fromJson(needs.build-matrix.outputs.matrix)}}
    steps:
      #----------------------------------------------------------------------
      # Install all tools and check configuration
      #----------------------------------------------------------------------
      - name: 'SETUP: Checkout generator-jhipster'
        uses: actions/checkout@v2.4.0
        with:
          path: generator-jhipster
          fetch-depth: 2
      - name: 'SETUP: environment'
        id: setup
        uses: ./generator-jhipster/.github/actions/setup
        with:
          entities-sample: ${{ matrix.entity }}
          jdl-entities-sample: ${{ matrix.jdl-entity }}
          application-sample: ${{ matrix.jhi-app-sample || matrix.app-sample }}
          application-environment: ${{ matrix.environment }}
          application-packaging: ${{ (matrix.war == 1 && 'war') || 'jar' }}
          enable-testcontainers: ${{ matrix.testcontainers == 1 }}
      - uses: actions/setup-node@v2.5.0
        with:
          node-version: ${{ steps.setup.outputs.node-version }}
      - uses: actions/setup-java@v2
        with:
          distribution: 'temurin'
          java-version: ${{ steps.setup.outputs.java-version }}
      - name: 'SETUP: load npm cache'
        uses: actions/cache@v2.1.7
        with:
          path: |
            ~/.npm
            ~/.cache/Cypress/
          key: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-${{ matrix.cache }}-${{ hashFiles('generator-jhipster/package-lock.json', 'generator-jhipster/**/package.json') }}
          restore-keys: |
            ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-${{ matrix.cache }}-
            ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-
            ${{ runner.os }}-node-${{ steps.setup.outputs.date }}
      - name: 'SETUP: load maven cache'
        uses: actions/cache@v2.1.7
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ steps.setup.outputs.date }}-${{ hashFiles('generator-jhipster/**/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: contains(matrix.app-sample, 'gradle')
        uses: actions/cache@v2.1.7
        with:
          path: |
            ~/.gradle/caches
            ~/.gradle/wrapper
          key: ${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}-${{ hashFiles('generator-jhipster/**/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: $JHI_SCRIPTS/03-system.sh
      - name: 'TOOLS: configure git'
        run: $JHI_SCRIPTS/04-git-config.sh
      #----------------------------------------------------------------------
      # Install JHipster and generate project+entities
      #----------------------------------------------------------------------
      - name: 'GENERATION: install JHipster'
        run: $JHI_SCRIPTS/10-install-jhipster.sh
      - name: 'GENERATION: config'
        run: $JHI_SCRIPTS/11-generate-config.sh
      - name: 'GENERATION: project'
        run: $JHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies ${{ matrix.extra-args }} ${{ matrix.new-extra-args }}
      - name: 'GENERATION: jhipster info'
        run: $JHI_SCRIPTS/14-jhipster-info.sh
      #----------------------------------------------------------------------
      # Launch tests
      #----------------------------------------------------------------------
      - name: 'E2E: Run'
        id: e2e
        run: npm run e2e:devserver --if-present
      - name: 'E2E: Teardown'
        if: always() && matrix.e2e == 1 && steps.compare.outputs.equals != 'true'
        run: npm run ci:e2e:teardown
      - name: 'BACKEND: Store failure logs'
        uses: actions/upload-artifact@v2
        if: always() && steps.backend.outcome == 'failure'
        with:
          name: log-${{ matrix.app-sample }}
          path: ${{ steps.setup.outputs.application-path }}/*/test-results/**/*.xml
      - name: 'E2E: Store failure screenshots'
        uses: actions/upload-artifact@v2
        if: always() && steps.e2e.outcome == 'failure'
        with:
          name: screenshots-${{ matrix.app-sample }}
          path: ${{ steps.setup.outputs.application-path }}/*/cypress/screenshots
      - name: 'ANALYSIS: Sonar analysis'
        if: steps.compare.outputs.equals != 'true' && matrix.sonar-analyse != 'false'
        run: $JHI_SCRIPTS/25-sonar-analyze.sh<commit_msg>Switch devserver workflow to opt-in sonar.<commit_after>#
# 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: Dev Server
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:
      - 'generators/*client/**'
  pull_request:
    types: [closed, opened, synchronize, reopened]
    branches:
      - '*'
    paths:
      - 'generators/*client/**'
jobs:
  build-matrix:
    runs-on: ubuntu-20.04
    outputs:
      matrix: ${{ steps.build.outputs.matrix }}
    steps:
      - name: 'SETUP: Checkout generator-jhipster'
        uses: actions/checkout@v2.4.0
        with:
          fetch-depth: 2
      - name: 'Build matrix'
        id: build
        uses: ./.github/actions/build-matrix
        with:
          workflow-file-prefix: devserver
  applications:
    name: ${{ matrix.app-sample }}
    needs: build-matrix
    runs-on: ubuntu-20.04
    defaults:
      run:
        working-directory: ${{ github.workspace }}/app
    timeout-minutes: 40
    strategy:
      fail-fast: false
      matrix: ${{fromJson(needs.build-matrix.outputs.matrix)}}
    steps:
      #----------------------------------------------------------------------
      # Install all tools and check configuration
      #----------------------------------------------------------------------
      - name: 'SETUP: Checkout generator-jhipster'
        uses: actions/checkout@v2.4.0
        with:
          path: generator-jhipster
          fetch-depth: 2
      - name: 'SETUP: environment'
        id: setup
        uses: ./generator-jhipster/.github/actions/setup
        with:
          entities-sample: ${{ matrix.entity }}
          jdl-entities-sample: ${{ matrix.jdl-entity }}
          application-sample: ${{ matrix.jhi-app-sample || matrix.app-sample }}
          application-environment: ${{ matrix.environment }}
          application-packaging: ${{ (matrix.war == 1 && 'war') || 'jar' }}
          enable-testcontainers: ${{ matrix.testcontainers == 1 }}
      - uses: actions/setup-node@v2.5.0
        with:
          node-version: ${{ steps.setup.outputs.node-version }}
      - uses: actions/setup-java@v2
        with:
          distribution: 'temurin'
          java-version: ${{ steps.setup.outputs.java-version }}
      - name: 'SETUP: load npm cache'
        uses: actions/cache@v2.1.7
        with:
          path: |
            ~/.npm
            ~/.cache/Cypress/
          key: ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-${{ matrix.cache }}-${{ hashFiles('generator-jhipster/package-lock.json', 'generator-jhipster/**/package.json') }}
          restore-keys: |
            ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-${{ matrix.cache }}-
            ${{ runner.os }}-node-${{ steps.setup.outputs.date }}-
            ${{ runner.os }}-node-${{ steps.setup.outputs.date }}
      - name: 'SETUP: load maven cache'
        uses: actions/cache@v2.1.7
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ steps.setup.outputs.date }}-${{ hashFiles('generator-jhipster/**/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: contains(matrix.app-sample, 'gradle')
        uses: actions/cache@v2.1.7
        with:
          path: |
            ~/.gradle/caches
            ~/.gradle/wrapper
          key: ${{ runner.os }}-gradle-${{ steps.setup.outputs.date }}-${{ hashFiles('generator-jhipster/**/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: $JHI_SCRIPTS/03-system.sh
      - name: 'TOOLS: configure git'
        run: $JHI_SCRIPTS/04-git-config.sh
      #----------------------------------------------------------------------
      # Install JHipster and generate project+entities
      #----------------------------------------------------------------------
      - name: 'GENERATION: install JHipster'
        run: $JHI_SCRIPTS/10-install-jhipster.sh
      - name: 'GENERATION: config'
        run: $JHI_SCRIPTS/11-generate-config.sh
      - name: 'GENERATION: project'
        run: $JHI_SCRIPTS/12-generate-project.sh --skip-jhipster-dependencies ${{ matrix.extra-args }} ${{ matrix.new-extra-args }}
      - name: 'GENERATION: jhipster info'
        run: $JHI_SCRIPTS/14-jhipster-info.sh
      #----------------------------------------------------------------------
      # Launch tests
      #----------------------------------------------------------------------
      - name: 'E2E: Run'
        id: e2e
        run: npm run e2e:devserver --if-present
      - name: 'E2E: Teardown'
        if: always() && matrix.e2e == 1 && steps.compare.outputs.equals != 'true'
        run: npm run ci:e2e:teardown
      - name: 'BACKEND: Store failure logs'
        uses: actions/upload-artifact@v2
        if: always() && steps.backend.outcome == 'failure'
        with:
          name: log-${{ matrix.app-sample }}
          path: ${{ steps.setup.outputs.application-path }}/*/test-results/**/*.xml
      - name: 'E2E: Store failure screenshots'
        uses: actions/upload-artifact@v2
        if: always() && steps.e2e.outcome == 'failure'
        with:
          name: screenshots-${{ matrix.app-sample }}
          path: ${{ steps.setup.outputs.application-path }}/*/cypress/screenshots
      - name: 'ANALYSIS: Sonar analysis'
        if: steps.compare.outputs.equals != 'true' && matrix.sonar-analyse == 'true'
        run: $JHI_SCRIPTS/25-sonar-analyze.sh
{'fraction_non_alphanumeric': 0.20400180532571086, 'fraction_numerical': 0.010681510455844742, 'mean_word_length': 1.832339156369834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7462895', 'n_tokens_mistral': 4061, 'n_tokens_neox': 3885, 'n_words': 892}