From abb539edcba8eefc42fcbd33cb9f9f456b3a6cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Wed, 22 Oct 2025 22:26:19 +0300 Subject: [PATCH] test cicd --- .gitlab-ci.yml | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d57448..a9c0cc3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,31 +1,24 @@ stages: - build - - test - deploy -build-job: +workflow: + rules: + - if: '$CI_COMMIT_BRANCH == "main"' + +build: stage: build script: - - echo "Compiling the code..." - - echo "Compile complete." + - echo "Building Docker image..." + - docker build -t travelmarine-frontend:latest . -unit-test-job: - stage: test - script: - - echo "Running unit tests... This will take about 60 seconds." - - sleep 60 - - echo "Code coverage is 90%" - -lint-test-job: - stage: test - script: - - echo "Linting code... This will take about 10 seconds." - - sleep 10 - - echo "No lint issues found." - -deploy-job: +deploy: stage: deploy - environment: production + needs: ["build"] script: - - echo "Deploying application..." - - echo "Application successfully deployed." + - echo "Restarting container..." + - docker rm -f travelmarine-frontend || true + - docker run -d --name travelmarine-frontend --restart unless-stopped \ + -p 127.0.0.1:3000:3000 \ + travelmarine-frontend:latest + when: on_success