summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 04cd47e606e6994d9acf26865bf92afd74287bab (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
variables:
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - build
  - test
  - docs
  - publish

build:archlinux:
  stage: build
  image: "registry.gitlab.com/gerbolyze/build-containers/archlinux:latest"
  variables:
    GIT_SUBMODULE_STRATEGY: none
  script:
    - git config --global --add safe.directory "$CI_PROJECT_DIR"
    - pip3 install --user --break-system-packages wheel setuptools
    - python3 setup.py sdist bdist_wheel
  artifacts:
    name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
    paths:
      - dist/*

# FIXME: disable tests since (a) currenty kicad-cli is broken (aborts on start), and the workaround of using an older
# version from the KiCad project's kicad-cli containers does not work in gitlab CI. Pain.
#test:archlinux:
#  stage: test
#  image: "registry.gitlab.com/gerbolyze/build-containers/archlinux:latest"
#  script:
#    - git clone --depth 1 https://gitlab.com/kicad/libraries/kicad-symbols
#    - git clone --depth 1 https://gitlab.com/kicad/libraries/kicad-footprints
#    - env KICAD_SYMBOLS=kicad-symbols KICAD_FOOTPRINTS=kicad-footprints pytest -o 'testpaths=gerbonara/tests' -o 'norecursedirs=*'
#  dependencies:
#    - build:archlinux
#  cache:
#    key: test-image-cache
#    paths:
#      - gerbonara/tests/image_cache/*.svg
#      - gerbonara/tests/image_cache/*.png
#  artifacts:
#    name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
#    when: on_failure
#    paths:
#      - gerbonara_test_failures/*
#
#test:ubuntu-rolling:
#  stage: test
#  image: "registry.gitlab.com/gerbolyze/build-containers/ubuntu:rolling"
#  script:
#    - python3 -m pip install --break-system-packages pytest beautifulsoup4 pillow numpy slugify lxml click scipy
#    - git clone --depth 1 https://gitlab.com/kicad/libraries/kicad-symbols
#    - git clone --depth 1 https://gitlab.com/kicad/libraries/kicad-footprints
#    - env KICAD_SYMBOLS=kicad-symbols KICAD_FOOTPRINTS=kicad-footprints python3 -m pytest -o 'testpaths=gerbonara/tests' -o 'norecursedirs=*'
#  dependencies:
#    - build:archlinux
#  cache:
#    key: test-image-cache
#    paths:
#      - gerbonara/tests/image_cache/*.svg
#      - gerbonara/tests/image_cache/*.png
#  artifacts:
#    name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
#    when: on_failure
#    paths:
#      - gerbonara_test_failures/*

docs:archlinux:
  stage: test
  image: "registry.gitlab.com/gerbolyze/build-containers/archlinux:latest"
  script:
    - git config --global --add safe.directory "$CI_PROJECT_DIR"
    - sphinx-build -E docs docs/_build
  dependencies:
    - build:archlinux
  artifacts:
    name: "docs-gerbonara-$CI_COMMIT_REF_NAME"
    paths:
      - docs/_build

publish:gerbonara:
  stage: publish
  variables:
    GIT_SUBMODULE_STRATEGY: none
  image: "registry.gitlab.com/gerbolyze/build-containers/archlinux:latest"
  cache: {}
  script:
    - export TWINE_USERNAME TWINE_PASSWORD
    - pip3 install --user --break-system-packages twine rich
    - twine upload dist/*
  dependencies:
    - build:archlinux
  only:
    - /^v.*$/

pages:
  stage: publish
  variables:
    GIT_SUBMODULE_STRATEGY: none
  image: "registry.gitlab.com/gerbolyze/build-containers/archlinux:latest"
  script:
    - git config --global --add safe.directory "$CI_PROJECT_DIR"
    - sphinx-build -E docs public
  dependencies:
    - build:archlinux
  artifacts:
    paths:
      - public
  only:
    - /^v.*$/