-
Florian Bruhin authoredFlorian Bruhin authored
This GitLab CI configuration is valid.
Learn more
.gitlab-ci.yml 2.06 KiB
default:
before_script: &poetry_setup
- curl -sSL https://install.python-poetry.org | python3 -
- export PATH="/root/.local/bin:$PATH"
# - poetry config virtualenvs.create false
- poetry config virtualenvs.in-project true # for caching
- poetry install --no-interaction --no-ansi
image: python:3.11
cache:
key: "project-${CI_JOB_NAME}"
paths:
- .cache/pip
- .venv
stages:
- lint
- test
- build
format:
stage: lint
script: poetry run ruff format --diff *.py tests
mypy:
stage: lint
script: poetry run mypy *.py tests
ruff:
stage: lint
script: poetry run ruff check *.py tests/
shellcheck:
image: koalaman/shellcheck-alpine:latest
stage: lint
before_script: [""]
script: shellcheck init.sh
pytest:
stage: test
script:
- rm /etc/python3.11/sitecustomize.py # WORKAROUND for coverage picking it up
- poetry run pytest -v --junit-xml=pytest.xml
artifacts:
reports:
junit: pytest.xml
build:
stage: build
before_script: []
cache: {}
# see https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --snapshotMode=redo
only:
- master
build_dev:
stage: build
before_script: []
cache: {}
# see https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script: