diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..fc3f7fc2c104c4b2e7dabbc0f76ffaf14b9ee615 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +stages: + - install + - test + - run + +variables: + VIRTUAL_ENV: .venv + PATH: $VIRTUAL_ENV/bin:$PATH + +before_script: + - python --version + - pip --version + # Create virtual environment + - python -m venv $VIRTUAL_ENV + - pip install --upgrade pip + - pip install -r requirements.txt + # Copy environment file + - cp .env.example .env + # Wait for MySQL (optional if already running) + - until mysqladmin ping -h"$DATABASE_HOST" --silent; do echo "Waiting for MySQL..."; sleep 2; done + # Optionally create database if it doesn't exist + - | + mysql -h"$DATABASE_HOST" -u"$DATABASE_USERNAME" -p"$DATABASE_PASSWORD" -e "CREATE DATABASE IF NOT EXISTS shopping;" + +install_dependencies: + stage: install + script: + - echo "Dependencies installed." + +test: + stage: test + script: + - pytest + +run_app: + stage: run + script: + - python run_app.py + when: manual