Update .gitlab-ci.yml file

This commit is contained in:
odweta
2026-09-07 18:48:44 +02:00
parent 62a3482116
commit 4c45c983a5
+6 -7
View File
@@ -17,35 +17,34 @@
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml # 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 stages: # List of stages for jobs, and their order of execution
- prepare
- build - build
- test - test
- deploy - deploy
prepare-job:
stage: prepare
script:
- apt install docker
- apt install npm
build-job: # This job runs in the build stage, which runs first. build-job: # This job runs in the build stage, which runs first.
stage: build stage: build
image: docker:latest
script: script:
- cd ./app
- echo "Compiling the code..." - echo "Compiling the code..."
- docker compose build - docker compose build
- echo "Compile complete." - echo "Compile complete."
unit-test-job: # This job runs in the test stage. unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully. stage: test # It only starts when the job in the build stage completes successfully.
image: npm:latest
script: script:
- cd ./app
- echo "Running unit tests..." - echo "Running unit tests..."
- npm test - npm test
- echo "Code coverage is 90%" - echo "Code coverage is 90%"
deploy-job: # This job runs in the deploy stage. deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully. stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
image: docker:latest
environment: production environment: production
script: script:
- cd ./app
- echo "Deploying application..." - echo "Deploying application..."
- docker compose up - docker compose up
- echo "Application successfully deployed." - echo "Application successfully deployed."