diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2950f64..4c7c624 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,13 +2,13 @@ default: image: maven:3-amazoncorretto-17-alpine stages: - - pull + #- pull - on_commit - sonarcloud_scan variables: GITLAB_CLONE_DIR: "/builds/thischwa/CloudflareDNS-java" -# GITLAB_CLONE_DIR: "cloudflaredns-java" + # GITLAB_CLONE_DIR: "cloudflaredns-java" SONAR_HOST_URL: "https://sonarcloud.io" SONAR_PROJECT_KEY: "th-schwarz_DynDRest" SONAR_ORGANIZATION: "th-schwarz" @@ -17,21 +17,30 @@ variables: GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task -pull_source: - stage: pull +#pull_source: +# stage: pull +# script: +# - echo "Cloning GitHub repository..." +# - git clone --depth 1 https://oauth2:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/th-schwarz/CloudflareDNS-java.git ${GITLAB_CLONE_DIR} +# - echo "Repository cloned successfully." +# only: +# - schedules + +build: script: - - echo "Cloning GitHub repository..." - - git clone --depth 1 https://oauth2:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/th-schwarz/CloudflareDNS-java.git ${GITLAB_CLONE_DIR} - - echo "Repository cloned successfully." - only: - - schedules + - mvn clean package -DskipTests + artifacts: + paths: + - target/ on_commits: stage: on_commit + dependencies: + - build script: - echo "Running tests..." - cd ${GITLAB_CLONE_DIR} - - mvn clean test + - mvn test cache: key: "${CI_JOB_NAME}" paths: @@ -43,15 +52,16 @@ on_commits: sonarcloud_scan: stage: sonarcloud_scan + dependencies: + - build image: name: sonarsource/sonar-scanner-cli:latest - entrypoint: [""] + entrypoint: [ "" ] cache: key: "${CI_JOB_NAME}" paths: - .maven-cache script: - - mvn clean package -DskipTests - sonar-scanner -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.organization=${SONAR_ORGANIZATION} -Dsonar.token=${SONAR_TOKEN} -Dsonar.java.binaries=target/classes only: - merge_requests