41 lines
828 B
YAML
41 lines
828 B
YAML
default:
|
|
tags:
|
|
- universal
|
|
|
|
stages:
|
|
- build
|
|
- tests
|
|
- deploy
|
|
|
|
build_job1:
|
|
stage: build
|
|
image: docker:latest
|
|
script:
|
|
- docker build -t quote-bot:v1 .
|
|
|
|
tests_job1:
|
|
stage: tests
|
|
image: python:3.11-slim
|
|
variables:
|
|
PYTHONPATH: "."
|
|
before_script:
|
|
- pip install --no-cache-dir -r requirements.txt
|
|
- pip install pytest
|
|
script:
|
|
- pytest tests/
|
|
|
|
deploy_to_server:
|
|
stage: deploy
|
|
image: ghcr.io/ansible/creator-ee:v0.22.0
|
|
variables:
|
|
ANSIBLE_HOST_KEY_CHECKING: "False"
|
|
before_script:
|
|
- mkdir -p ~/.ssh
|
|
- chmod 700 ~/.ssh
|
|
- echo "$ANSIBLE_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
|
- chmod 600 ~/.ssh/id_ed25519
|
|
- ansible-galaxy collection install community.docker
|
|
script:
|
|
- cd auto-deployment/
|
|
- ansible-playbook -i inventory.ini A_deploy.yml
|