feat(CI): add custom docker for CI

Refs: #4
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
2025-03-19 21:55:06 +01:00
parent 9897526b14
commit eda58ace70
2 changed files with 38 additions and 17 deletions

View File

@@ -1,33 +1,31 @@
variables:
DOCKER_IMAGE: registry.forge.hefr.ch/klagarge/mse2425-grp09/python-pdm:latest
default:
image: python:3.9
image: $DOCKER_IMAGE
stages:
- lint
- build
- test
build job:
stage: build
test job:
stage: test
script:
- cd src
# - apt-get update -qy
# - apt-get install -y python3-dev python3-pip python3.12-venv curl
- python3 -V
# - pip3 install --break-system-packages -r requirements.txt
- curl -sSL https://pdm-project.org/install-pdm.py | python3 -
- export PATH=/root/.local/bin:$PATH
- pdm install
- cp -r /app/__pypackages__ .
# Set environment variables for the tests
- export FLASK_SECRET_KEY=$FLASK_SECRET_KEY
# launch tests
- export PYTHONPATH=.
- export PYTHONPATH="/builds/Klagarge/mse2425-grp09/src:/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/lib"
- export PATH="/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/bin:$PATH"
- export FLASK_APP=app
- pdm run pytest tests --cov --cov-report term --cov-report html
artifacts:
paths:
- src/htmlcov/
paths:
- src/htmlcov/
lint job:
stage: lint
@@ -38,10 +36,10 @@ lint job:
allow_failure: true # Linter can fail, fixing it is for now outside of the projects scope
pages:
stage: build
stage: test
dependencies:
- build job
needs: ["build job"]
- test job
needs: ["test job"]
script:
- mv src/htmlcov/ public/
artifacts: