summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 42f39328ac1a2d5b28e298fc5afa01e6af8a9bc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
image: python:latest

stages:
  - lint
  - test
  - deploy

before_script:
  - pip install poetry
  - poetry install --no-root

lint:
  stage: lint
  script:
    - poetry run ruff check
    - poetry run ruff format --check

test:
  stage: test
  script:
    - poetry run pytest -v --cov=. --cov-report=xml
  after_script:
    - bash <(curl -s https://codecov.io/bash)
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml

deploy_to_pypi:
  stage: deploy
  only:
    refs:
      - master
    changes:
      - pyproject.toml
  except:
    - tags
  script:
    - POETRY_PYPI_TOKEN_PYPI=$PYPI_PASSWORD poetry publish --build

deploy_to_dockerhub:
  stage: deploy
  needs:
    - deploy_to_pypi
  only:
    refs:
      - master
    changes:
      - pyproject.toml
      - Dockerfile
  except:
    - tags
  image: docker:latest
  services:
    - docker:dind
  before_script:
    - docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
    - docker buildx create --use
  script:
    - docker buildx build --push --tag rogsme/subscleaner:latest .