From 2727dbcee0ab223f37892b2a445bde1c4dff1163 Mon Sep 17 00:00:00 2001 From: duyanhehe <duyanhex@gmail.com> Date: Sat, 26 Apr 2025 21:51:59 +0700 Subject: [PATCH] fix gitlab ci yml --- .gitlab-ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..fc3f7fc --- /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 -- GitLab