<%# Copyright 2013-2025 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. -%> os: - linux services: - docker language: node_js node_js: - "<%= nodeVersion %>" cache: directories: - node - node_modules <%_ if (buildToolMaven) { _%> - $HOME/.m2 <%_ } else if (buildToolGradle) { _%> - $HOME/.gradle <%_ } _%> env: global: - NODE_VERSION=<%= nodeVersion %> - JHI_JDK=<%= javaVersion %> - SPRING_OUTPUT_ANSI_ENABLED=ALWAYS - SPRING_JPA_SHOW_SQL=false - JHI_DISABLE_WEBPACK_LOGS=true - NG_CLI_ANALYTICS="false" <%_ if (buildToolMaven) { _%> - MAVEN_USER_HOME=$HOME/.m2/repository/ <%_ } _%> <%_ if(cypressTests) { _%> - CYPRESS_ENABLE_RECORD: <%= ciCdIntegrationsCypressDashboard %> <%_ } _%> before_install: - | echo '*** Using OpenJDK 17 by default' sudo apt-get update -q sudo apt-get install -y openjdk-17-jdk sudo update-java-alternatives -s java-1.17.0-openjdk-amd64 java -version - sudo /etc/init.d/mysql stop - sudo /etc/init.d/postgresql stop - nvm install $NODE_VERSION - npm install -g npm - node -v - npm -v install: - <%= clientPackageManager %> install script: <%_ if (ciCdIntegrationsSnyk) { _%> - curl -Lo ./snyk $(curl -s https://api.github.com/repos/snyk/snyk/releases/latest | grep "browser_download_url.*snyk-linux" | cut -d ':' -f 2,3 | tr -d \" | tr -d ' ') - chmod +x snyk - ./snyk test --all-projects || true - ./snyk monitor --all-projects <%_ } _%> <%_ if (buildToolMaven) { _%> - chmod +x mvnw <%_ } else if (buildToolGradle) { _%> - chmod +x gradlew <%_ } _%> - <%= clientPackageManager %> run ci:backend:test <%_ if (!skipClient) { _%> - <%= clientPackageManager %> run ci:frontend:test <%_ } _%> - <%= clientPackageManager %> run java:jar:prod <%_ if (buildToolMaven) { _%> <%_ if (ciCdIntegrationsSonar) { _%> - if [ $TRAVIS_PULL_REQUEST == "false" ]; then ./mvnw -ntp org.jacoco:jacoco-maven-plugin:prepare-agent initialize sonar:sonar <% if (sonarOrga) { %>-Dsonar.organization=<%= sonarOrga %> <% } %>-Dsonar.host.url=<%= sonarUrl %> -Dsonar.login=$SONAR_TOKEN; fi <%_ } _%> <%_ if (ciCdIntegrationsHeroku) { _%> - ./mvnw -ntp com.heroku.sdk:heroku-maven-plugin:3.0.7:deploy -DskipTests -Pprod -Dheroku.buildpacks=heroku/jvm -Dheroku.appName=<%= herokuAppName %> <%_ } _%> <%_ } else if (buildToolGradle) { _%> <%_ if (ciCdIntegrationsSonar) { _%> - if [ $TRAVIS_PULL_REQUEST == "false" ]; then ./gradlew sonarqube --no-daemon <% if (sonarOrga) { %>-Dsonar.organization=<%= sonarOrga %> <% } %>-Dsonar.host.url=<%= sonarUrl %> -Dsonar.login=$SONAR_TOKEN; fi <%_ } _%> <%_ if (ciCdIntegrationsHeroku) { _%> - ./gradlew deployHeroku <%_ } _%> <%_ } _%> <%_ if (cypressTests) { const commented = applicationTypeGateway ? '# ' : ''; _%> <%= commented %>- <%= clientPackageManager %> run ci:e2e:package <%= commented %>- <%= clientPackageManager %> run ci:e2e:prepare <%= commented %>- <%= clientPackageManager %> run ci:e2e:run <%= commented %>- <%= clientPackageManager %> run ci:e2e:teardown <%_ } _%> notifications: webhooks: on_success: change # options: [always|never|change] default: always on_failure: always # options: [always|never|change] default: always on_start: false # default: false