Newer
Older
# This file is based a sample GitLab CI/CD configuration file that demonstrates a basic 3 stage CI/CD pipeline.
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
# Python-specific template is located at
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: python:3.10 #Otherwise use 'latest'
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# https://pip.pypa.io/en/stable/topics/caching/
cache:
paths:
- .cache/pip
#include:
# - template: Jobs/Code-Quality.gitlab-ci.yml
before_script:
- python --version ; pip --version # For debugging
- virtualenv venv
- source venv/bin/activate
- pip install --upgrade pip setuptools wheel
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
script:
- echo "Running unit tests..."
rules:
- changes:
- src/**/*
- tests/**/*
when: always
# Build the pages
# All necessary files need to be moved or build in the 'public' folder
- apt-get -y install dvipng texlive-latex-extra texlive-fonts-recommended cm-super
- pip install -U sphinx m2r2 furo pyUML pydot==2.0.0 gprof2dot latex
- mkdir public
- cd public
- mkdir diagrams
- mkdir examples
- cd examples
- mkdir user_guide
- cd ../../
# Copy and build the diagrams
- cp docs/diagrams/* public/diagrams
# Copy and build the needed examples
- cp examples/user_guide/* public/examples/user_guide
- cd public/examples/user_guide
- python example_user_guide.py
- cd ../../../
# Build the html-pages
artifacts:
paths:
- public
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production
script:
- echo "Deploying application..."
- echo "Application successfully deployed."