diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a9c0cc3..6d57448 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,24 +1,31 @@ stages: - build + - test - deploy -workflow: - rules: - - if: '$CI_COMMIT_BRANCH == "main"' - -build: +build-job: stage: build script: - - echo "Building Docker image..." - - docker build -t travelmarine-frontend:latest . + - echo "Compiling the code..." + - echo "Compile complete." -deploy: - stage: deploy - needs: ["build"] +unit-test-job: + stage: test script: - - 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 + - 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: + stage: deploy + environment: production + script: + - echo "Deploying application..." + - echo "Application successfully deployed."