.gitlab-ci.yml 2.3 KB
Newer Older
Jgiannelos's avatar
Jgiannelos committed
1
2
3
4
stages:
  - lint
  - test
  - package
Jgiannelos's avatar
Jgiannelos committed
5
  - release
Jgiannelos's avatar
Jgiannelos committed
6
7
8
9
10
11
12
13

lint:
  stage: lint
  image: python:latest
  before_script:
    - pip install flake8
  script:
    - flake8 .
Jgiannelos's avatar
Jgiannelos committed
14
15
  tags:
    - maps
Jgiannelos's avatar
Jgiannelos committed
16
17
18
19
20
21
22

test:
  stage: test
  image: python:latest
  script:
    - pip install .
    - python -m unittest discover -v
Jgiannelos's avatar
Jgiannelos committed
23
24
  tags:
    - maps
Jgiannelos's avatar
Jgiannelos committed
25
26
27
28
29
30

build_python:
  stage: package
  image: python:latest
  script:
    - python setup.py sdist
Jgiannelos's avatar
Jgiannelos committed
31
    - cp dist/maps-deduped-tilelist*.tar.gz .
Jgiannelos's avatar
Jgiannelos committed
32
33
  artifacts:
    paths:
Jgiannelos's avatar
Jgiannelos committed
34
      - maps-deduped-tilelist*.tar.gz
Jgiannelos's avatar
Jgiannelos committed
35
36
  tags:
    - maps
Jgiannelos's avatar
Jgiannelos committed
37
38
39
40
41
42
43
44

build_debian:
  stage: package
  image: debian:stable
  script:
    - apt-get update
    - apt-get -y install python3-all python3-setuptools dh-make dh-python
    - dpkg-buildpackage -b -us -uc
45
    - mv ../python3-maps-deduped-tilelist*.deb .
Jgiannelos's avatar
Jgiannelos committed
46
47
48
  artifacts:
    paths:
      - python3-maps-deduped-tilelist*.deb
Jgiannelos's avatar
Jgiannelos committed
49
50
  tags:
    - maps
Jgiannelos's avatar
Jgiannelos committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

publish_debian_package:
  rules:
    - if: $CI_COMMIT_TAG
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  script:
    - echo "Ensure debian artifacts don't expire for $CI_COMMIT_TAG"
  needs:
    - job: build_debian
      artifacts: true
  artifacts:
    paths:
      - python3-maps-deduped-tilelist*.deb
    expire_in: never
Jgiannelos's avatar
Jgiannelos committed
66
67
  tags:
    - maps
Jgiannelos's avatar
Jgiannelos committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

publish_python_package:
  rules:
    - if: $CI_COMMIT_TAG
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  script:
    - echo "Ensure python artifacts don't expire for $CI_COMMIT_TAG"
  needs:
    - job: build_python
      artifacts: true
  artifacts:
    paths:
      - maps-deduped-tilelist*.tar.gz
    expire_in: never
Jgiannelos's avatar
Jgiannelos committed
83
84
  tags:
    - maps
Jgiannelos's avatar
Jgiannelos committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

release:
  rules:
    - if: $CI_COMMIT_TAG
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  needs:
    - job: publish_debian_package
    - job: publish_python_package
  script:
    - echo 'Create a new release for $CI_COMMIT_TAG'
  release:
    tag_name: "$CI_COMMIT_TAG"
    description: "$CI_COMMIT_TAG"
    assets:
      links:
        - name: Debian package
          url: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/$CI_COMMIT_TAG/download?job=publish_debian_package"
          link_type: package
        - name: Python package
          url: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/$CI_COMMIT_TAG/download?job=publish_python_package"
          link_type: package
Jgiannelos's avatar
Jgiannelos committed
107
108
  tags:
    - maps