Commit 306d4ba9 authored by seydou.faye's avatar seydou.faye
Browse files
parents 522d683b 74ed40b2
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+51 −0
Original line number Diff line number Diff line
stages:          # List of stages for jobs, and their order of execution
  - lint
  - test
  - deploy

default:
  image:
    name: labinfo.ing.he-arc.ch:5050/igib/shared/ci-docker/poetry1.2.0-python3.10
    entrypoint: [ "" ]

lint-black:
  stage: lint
  tags:
    - docker
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: always
      allow_failure: false
  script:
    - poetry install --only lint
    - poetry run black --check spj/

lint-pylint:
  stage: lint
  tags:
    - docker
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: always
      allow_failure: false
  script:
    - poetry install --only lint
    - poetry run pylint --fail-under=8 spj/


deploy-job:      # This job runs only when the merge is accepted
  stage: deploy  # It only runs when *both* jobs in the test stage complete successfully.
  tags:
    - docker
  environment: production
  rules:
    - if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
      when: always
    - when: never

  script:
    - poetry install --only main
    - poetry config repositories.gitlab https://labinfo.ing.he-arc.ch/gitlab/api/v4/projects/$CI_PROJECT_ID/packages/pypi
    - poetry config http-basic.gitlab gitlab-ci-token "$CI_JOB_TOKEN"
    - poetry build
    - poetry publish --repository gitlab