Skip to content
.gitlab-ci.yml 1.78 KiB
Newer Older
variables:
Josh Asplund's avatar
Josh Asplund committed
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pypoetry"
    POETRY_VIRTUALENVS_IN_PROJECT: "true"

cache:
Josh Asplund's avatar
Josh Asplund committed
  key:
    files:
Josh Asplund's avatar
Josh Asplund committed
      - .gitlab-ci.yml
Josh Asplund's avatar
Josh Asplund committed
      - poetry.lock
Josh Asplund's avatar
Josh Asplund committed
    prefix: relate
  paths:
    - ".cache/pypoetry"
    - ".cache/pip"
    - ".venv"

stages:
Josh Asplund's avatar
Josh Asplund committed
  - setup
  - lint
  - tests
  - docs

.install-deps-template: &install-deps
  image: inducer/ci-base-image
Josh Asplund's avatar
Josh Asplund committed
  tags:
    - docker-runner
  before_script:
    - curl -sSL https://install.python-poetry.org | python3 -
    - export PATH="$HOME/.local/bin:$PATH"
Josh Asplund's avatar
Josh Asplund committed
    - poetry install

.quality-template: &quality
  <<: *install-deps
  stage: lint
Andreas Klöckner's avatar
Andreas Klöckner committed
  except:
    - tags
.test-template: &test
  <<: *install-deps
    - "bash ./.ci/run-tests-for-ci.sh"
  stage: tests
    - tags
  coverage: "/TOTAL.+ ([0-9]{1,3}%)/"
Josh Asplund's avatar
Josh Asplund committed
  <<: *install-deps
  stage: setup
Josh Asplund's avatar
Josh Asplund committed
  script: poetry config --list
Josh Asplund's avatar
Josh Asplund committed

  <<: *quality
    poetry run ruff check

mypy:
  <<: *quality
  variables:
    RELATE_LOCAL_TEST_SETTINGS: './local_settings_example.py'
  script: poetry run ./.ci/run-mypy.sh
  script: poetry run ./.ci/run-safety.sh
Python 3:
  <<: *test
  needs: [setup]

Python 3 Expensive:
  <<: *test
  variables:
    RL_CI_TEST: expensive
  needs: [setup]
Python 3 CLI Tool:
  <<: *test
    - git clone https://github.com/inducer/relate-sample
    - cd relate-sample
Josh Asplund's avatar
Josh Asplund committed
    - poetry run relate validate .
    - poetry run relate test-code questions/autograded-python-example.yml
    - poetry run relate expand-yaml flows/quiz-test.yml > /dev/null
  needs: [setup]
Documentation:
  <<: *install-deps
  stage: docs
  variables:
    RELATE_LOCAL_TEST_SETTINGS: './local_settings_example.py'
  script:
    - poetry run bash ./doc/build-docs.sh
  needs: [setup]