2021-08-09 00:29:53 +02:00
|
|
|
stages:
|
|
|
|
- check
|
|
|
|
- build
|
2022-06-24 01:43:34 +00:00
|
|
|
- deploy
|
2021-08-09 00:29:53 +02:00
|
|
|
|
|
|
|
format:
|
|
|
|
stage: check
|
|
|
|
image: python
|
|
|
|
before_script:
|
|
|
|
- pip install yapf autoflake
|
|
|
|
script:
|
|
|
|
- ./format.sh --check
|
2021-08-09 00:42:05 +02:00
|
|
|
|
2022-02-18 06:42:25 +01:00
|
|
|
typecheck:
|
|
|
|
stage: check
|
|
|
|
image: python
|
|
|
|
before_script:
|
|
|
|
- pip install mypy
|
|
|
|
script:
|
|
|
|
- ./typecheck.sh --non-interactive --junit-xml mypy-report.xml
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
junit: mypy-report.xml
|
|
|
|
|
2022-08-15 19:53:08 +02:00
|
|
|
pytest:
|
|
|
|
stage: check
|
|
|
|
image: archlinux
|
|
|
|
before_script:
|
2022-08-20 04:59:55 +02:00
|
|
|
- pacman -Sy --noconfirm --needed archlinux-keyring && pacman -Su --noconfirm python python-pip sudo git base-devel
|
2022-09-11 01:32:59 +02:00
|
|
|
- pip install -r test_requirements.txt -r requirements.txt
|
2022-08-20 04:59:55 +02:00
|
|
|
- 'echo "kupfer ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/kupfer_all'
|
|
|
|
- useradd -m kupfer
|
|
|
|
- chmod 777 .
|
2022-08-15 19:53:08 +02:00
|
|
|
script:
|
2022-09-11 01:32:59 +02:00
|
|
|
- script -e -c 'su kupfer -s /bin/bash -c "./pytest.sh --junit-xml=pytest-report.xml --cov-report=xml:coverage.xml"'
|
2022-08-20 05:59:31 +02:00
|
|
|
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
|
2022-08-15 19:53:08 +02:00
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
junit: pytest-report.xml
|
2022-08-20 05:59:31 +02:00
|
|
|
coverage_report:
|
|
|
|
coverage_format: cobertura
|
|
|
|
path: coverage.xml
|
2022-09-11 01:32:59 +02:00
|
|
|
|
2021-08-09 00:42:05 +02:00
|
|
|
build_docker:
|
|
|
|
stage: build
|
|
|
|
image: docker:latest
|
|
|
|
services: ['docker:dind']
|
|
|
|
before_script:
|
|
|
|
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
|
|
|
|
script:
|
|
|
|
- docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}" -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}" .
|
|
|
|
- if [[ "$CI_COMMIT_REF_NAME" == "main" ]]; then docker image tag "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}" "${CI_REGISTRY_IMAGE}:latest"; fi
|
|
|
|
- docker push -a "${CI_REGISTRY_IMAGE}"
|
|
|
|
only:
|
|
|
|
- main
|
|
|
|
- dev
|
2022-06-24 01:43:34 +00:00
|
|
|
|
|
|
|
.docs:
|
|
|
|
image: "${CI_REGISTRY_IMAGE}:dev"
|
|
|
|
before_script:
|
2022-10-18 02:54:55 +02:00
|
|
|
- pip install -r docs/requirements.txt
|
2022-06-24 01:43:34 +00:00
|
|
|
script:
|
|
|
|
- (cd docs && make)
|
|
|
|
- mv docs/html public
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
|
|
|
|
build_docs:
|
|
|
|
stage: build
|
|
|
|
extends: .docs
|
|
|
|
except:
|
2022-07-09 14:54:10 +02:00
|
|
|
- main
|
2022-06-24 01:43:34 +00:00
|
|
|
|
|
|
|
pages:
|
|
|
|
stage: deploy
|
|
|
|
extends: .docs
|
|
|
|
only:
|
2022-07-09 14:54:10 +02:00
|
|
|
- main
|