Skip to content
Snippets Groups Projects
Commit 5c7b9e53 authored by Fortune Iriaye's avatar Fortune Iriaye
Browse files

Update .gitlab-ci.yml file

parent 7808d11a
No related branches found
No related tags found
No related merge requests found
Pipeline #12187 failed with stages
in 1 minute and 11 seconds
default:
image: python:3.12-slim
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
- if: '$CI_COMMIT_BRANCH == "main"'
variables:
PACKAGE_NAME: "pak"
REPO_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
PIP_INDEX_URL: "https://__token__:${CI_JOB_TOKEN}@gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple"
PIP_EXTRA_INDEX_URL: "https://pypi.org/simple"
stages:
- build
- test
- publish
build_package:
stage: build
script:
- pip install --upgrade pip
- pip install setuptools wheel build
- python -m build
artifacts:
paths:
- dist/*
cache:
paths:
- ${PIP_CACHE_DIR}
test_package:
stage: test
script:
- pip install .
- pip install pytest
- pytest
publish_pip:
stage: publish
script:
- pip install twine
- twine upload -u gitlab-ci-token -p ${CI_JOB_TOKEN} --repository-url ${REPO_URL} dist/*
build_and_push_docker_image:
stage: publish
image: docker:latest
services:
- docker:dind
variables:
DOCKER_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${PACKAGE_NAME}
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- echo "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin ${CI_REGISTRY}
script:
- echo "Building docker image and tagging as latest"
- docker pull ${DOCKER_IMAGE_NAME}:latest || true
- docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${DOCKER_IMAGE_NAME}:latest -t ${DOCKER_IMAGE_NAME}:latest .
- docker push ${DOCKER_IMAGE_NAME}:latest
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment