test cicd
This commit is contained in:
parent
074567b74f
commit
abb539edcb
|
|
@ -1,31 +1,24 @@
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
build-job:
|
workflow:
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
||||||
|
|
||||||
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- echo "Compiling the code..."
|
- echo "Building Docker image..."
|
||||||
- echo "Compile complete."
|
- docker build -t travelmarine-frontend:latest .
|
||||||
|
|
||||||
unit-test-job:
|
deploy:
|
||||||
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:
|
|
||||||
stage: deploy
|
stage: deploy
|
||||||
environment: production
|
needs: ["build"]
|
||||||
script:
|
script:
|
||||||
- echo "Deploying application..."
|
- echo "Restarting container..."
|
||||||
- echo "Application successfully deployed."
|
- 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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue