Update .gitlab-ci.yml file
This commit is contained in:
+6
-7
@@ -17,35 +17,34 @@
|
||||
# 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
|
||||
- prepare
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
|
||||
prepare-job:
|
||||
stage: prepare
|
||||
script:
|
||||
- apt install docker
|
||||
- apt install npm
|
||||
|
||||
build-job: # This job runs in the build stage, which runs first.
|
||||
stage: build
|
||||
image: docker:latest
|
||||
script:
|
||||
- cd ./app
|
||||
- echo "Compiling the code..."
|
||||
- docker compose build
|
||||
- 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.
|
||||
image: npm:latest
|
||||
script:
|
||||
- cd ./app
|
||||
- echo "Running unit tests..."
|
||||
- npm test
|
||||
- echo "Code coverage is 90%"
|
||||
|
||||
deploy-job: # This job runs in the deploy stage.
|
||||
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
|
||||
image: docker:latest
|
||||
environment: production
|
||||
script:
|
||||
- cd ./app
|
||||
- echo "Deploying application..."
|
||||
- docker compose up
|
||||
- echo "Application successfully deployed."
|
||||
|
||||
Reference in New Issue
Block a user