test cicd

This commit is contained in:
Иван 2025-10-22 22:15:50 +03:00
parent 5d21b4b32b
commit 074567b74f
1 changed files with 23 additions and 16 deletions

View File

@ -1,24 +1,31 @@
stages: stages:
- build - build
- test
- deploy - deploy
workflow: build-job:
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
build:
stage: build stage: build
script: script:
- echo "Building Docker image..." - echo "Compiling the code..."
- docker build -t travelmarine-frontend:latest . - echo "Compile complete."
deploy: unit-test-job:
stage: deploy stage: test
needs: ["build"]
script: script:
- echo "Restarting container..." - echo "Running unit tests... This will take about 60 seconds."
- docker rm -f travelmarine-frontend || true - sleep 60
- docker run -d --name travelmarine-frontend --restart unless-stopped \ - echo "Code coverage is 90%"
-p 127.0.0.1:3000:3000 \
travelmarine-frontend:latest lint-test-job:
when: on_success stage: test
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job:
stage: deploy
environment: production
script:
- echo "Deploying application..."
- echo "Application successfully deployed."