This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
This GitLab CI configuration is valid. Learn more
.gitlab-ci.yml 5.14 KiB
image: sharing-codeability.uibk.ac.at:5051/sharing/codeability-sharing-platform/root-jhipster

cache: &global_cache
  key: '$CI_COMMIT_REF_SLUG'
  paths:
    - .maven/
    - .npm/
  policy: pull-push

stages:
  - lint
  - build
  - test
  - analyze
  - release
  - deploy

before_script:
  - export NG_CLI_ANALYTICS="false"
  - export MAVEN_USER_HOME=`pwd`/.maven
  - npm ci --cache .npm --prefer-offline

pmdCheckstylePrettierLint:
  stage: lint
  cache:
    # inherit all global cache settings
    <<: *global_cache
    # override the policy
    policy: pull
  when: always
  script:
    - SUCCESS=true
    - echo "Running PMD"
    - ls -a
    - '"../bin/run.sh" pmd -d src/main/java -f textcolor -R pmd_rules.xml 2>&1 | tee pmd.log || SUCCESS=false'
    - cd ..
    - ls -a
    - echo "Running checkstyle"
    - ./mvnw -ntp checkstyle:check -Dmaven.repo.local=$MAVEN_USER_HOME || SUCCESS=false
    - echo "Running prettier"
    - npm run prettier:check
    - echo "Running eslint"
    - 'npm run lint | tee lint.log'
    - "! grep -qE '✖ [0-9]+ problem' lint.log || SUCCESS=false"
    - $SUCCESS
  needs: []
  artifacts:
    when: on_failure
    expire_in: 30 days
    paths:
      - pmd.log

maven-compile:
  stage: build
  script:
    - ./mvnw -ntp compile -P-webapp -Dmaven.repo.local=$MAVEN_USER_HOME
  artifacts:
    paths:
      - target/classes/
      - target/generated-sources/
    expire_in: 15 days
  needs: []

maven-test:
  # DinD service is required for Testcontainers
  services:
    - docker:20-dind
  variables:
    # Instruct Testcontainers to use the daemon of DinD.
    DOCKER_HOST: 'tcp://docker:2375'