Skip to content
Snippets Groups Projects
.gitlab-ci.yml 7.69 KiB
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.12-slim

default:
  tags:
    - docker

.python-container:
  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    PYTHONPATH: "$CI_PROJECT_DIR"
    CLOWM_UI_URI: "http://localhost"
    CLOWM_S3__URI: "http://localhost"
    CLOWM_S3__ACCESS_KEY: "nonempty"
    CLOWM_S3__SECRET_KEY: "nonempty"
    CLOWM_LIFESCIENCE_OIDC__CLIENT_SECRET: "nonempty"
    CLOWM_LIFESCIENCE_OIDC__CLIENT_ID: "nonempty"
    CLOWM_CLUSTER__SLURM__TOKEN: "nonempty"
    CLOWM_CLUSTER__SLURM__URI: "http://localhost"
    CLOWM_DEV_SYSTEM: true
    CLOWM_CLUSTER__JOB_MONITORING: "LINEAR"
    CLOWM_CLUSTER__ACTIVE_WORKFLOW_EXECUTION_LIMIT: 3
    CLOWM_CLUSTER__TOWER_SECRET: "nonempty"
  before_script:
    - python --version  # For debugging
    - pip install --disable-pip-version-check virtualenv
    - virtualenv venv
    - source venv/bin/activate
    - python -m pip install --disable-pip-version-check --upgrade -r requirements.txt -r requirements-dev.txt
  cache:
    paths:
      - .cache/pip
      - venv/


stages: # List of stages for jobs, and their order of execution
  - lint
  - test
  - publish

lint-test-job: # Runs linters checks on code
  extends: .python-container
  stage: lint
  before_script:
    - python --version  # For debugging
    - pip install --disable-pip-version-check virtualenv
    - virtualenv venv
    - source venv/bin/activate
    - python -m pip install --disable-pip-version-check --upgrade -r requirements.txt -r requirements-dev.txt --upgrade-strategy=eager
  script:
    - ./scripts/lint.sh


integration-test-job: # Runs integration tests with the database
  extends: .python-container
  stage: test
  variables:
    FF_NETWORK_PER_BUILD: 1
    CLOWM_DB__PASSWORD: "$TEST_DB_PASSWORD"
    CLOWM_DB__USER: "test_api_user"
    CLOWM_DB__NAME: "integration-test-db"
    CLOWM_DB__HOST: "integration-test-db"
    CLOWM_S3__URI: "http://integration-test-mock-s3:8000"
  services:
    - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/mysql:8
      alias: integration-test-db
      variables:
        MYSQL_RANDOM_ROOT_PASSWORD: "yes"
        MYSQL_DATABASE: "$CLOWM_DB__NAME"
        MYSQL_USER: "$CLOWM_DB__USER"
        MYSQL_PASSWORD: "$CLOWM_DB__PASSWORD"