Skip to content
Snippets Groups Projects
Commit 63de3d0d authored by Gashi Erzan's avatar Gashi Erzan
Browse files

Update .gitlab-ci.yml file

parent f42a7ab2
No related branches found
No related tags found
No related merge requests found
Pipeline #58634 failed
......@@ -16,34 +16,63 @@
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
include:
- template: Jobs/SAST.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
cache:
paths:
- ".m2/repository"
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
stages:
- build
- test
- package
build-musicmanager:
stage: build
image: maven:3.8-openjdk-18
script:
- echo "Compiling the code..."
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
- echo 'Starting Build Stage'
- mvn compile
test-musicmanager:
stage: test
image: maven:3.8-openjdk-18
services:
- mariadb
- mongo
variables:
MYSQL_ROOT_PASSWORD: ultr4_s4ve_pwd
MYSQL_DATABASE: musicmanagerdb
MYSQL_USER: musicmanageruser
MONGO_INITDB_ROOT_USERNAME: musicmanageruser
MONGO_INITDB_ROOT_PASSWORD: sup3r_s4ve_pwd
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production
- echo 'Starting Test Stage'
- mvn test -Dtest='!NoSqlManagerTest,!SqlDbManagerTest, !AudioTrackApiControllerTest'
artifacts:
reports:
junit:
- target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml
package-musicmanager:
stage: package
image: maven:3.8-openjdk-18
services:
- mariadb
- mongo
variables:
MYSQL_ROOT_PASSWORD: ultr4_s4ve_pwd
MYSQL_DATABASE: musicmanagerdb
MYSQL_USER: musicmanageruser
MONGO_INITDB_ROOT_USERNAME: musicmanageruser
MONGO_INITDB_ROOT_PASSWORD: sup3r_s4ve_pwd
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
- echo 'Starting Package Stage'
- mvn package -Dtest='!NoSqlManagerTest,!SqlDbManagerTest, !AudioTrackApiControllerTest'
only:
refs:
- main
artifacts:
paths:
- target/*.jar
expire_in: 2 days
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment