feat(CI): add custom docker for CI
Refs: #4 Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -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:
|
||||
|
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM python:3.9-slim
|
||||
LABEL maintener="Rémi Heredero <remi.heredero@hevs.ch>"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends curl && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 -
|
||||
|
||||
ENV PATH="/root/.local/bin:$PATH" \
|
||||
PDM_USE_VENV=false
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY src/pyproject.toml src/pdm.lock ./
|
||||
|
||||
RUN pdm config python.use_venv false && \
|
||||
pdm install -G:all
|
||||
|
||||
ENV PATH="/root/.local/bin:$PATH" \
|
||||
PDM_USE_VENV=false \
|
||||
PYTHONPATH="/app/__pypackages__/3.9/lib" \
|
||||
PATH="/app/__pypackages__/3.9/bin:$PATH"
|
Reference in New Issue
Block a user