Commit eba4cad7 authored by Gallacchi Mattia's avatar Gallacchi Mattia
Browse files

Merge branch '1-add-ci-cd' into 'main'

Add CI/CD YAML

Closes #1

See merge request igib/public/rsvp/rsvp-python!1
parents 1f382bb2 2ca490cb
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+50 −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 pyrsvp/

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 pyrsvp/

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
 No newline at end of file