From 700659d7ab2d894b2eec326cd2ed46f79fc0dc82 Mon Sep 17 00:00:00 2001 From: Alexis GAMELIN <alexis.gamelin@synchrotron-soleil.fr> Date: Mon, 24 Jun 2024 13:56:14 +0200 Subject: [PATCH] Update .gitlab-ci.yml For each commit in develop branch: + Add tests + Add docker build image --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b4601a..b562ced 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,9 +14,10 @@ testing: extends: .python_job stage: test rules: - - if: '$CI_COMMIT_BRANCH == "stable"' - - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "stable"' - - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"' + - if: '$CI_COMMIT_BRANCH == "stable"' + - if: '$CI_COMMIT_BRANCH == "develop"' + - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "stable"' + - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"' script: - cd tests - poetry run pytest --junitxml=report.xml @@ -29,14 +30,29 @@ formatters: extends: .python_job stage: test rules: - - if: '$CI_COMMIT_BRANCH == "stable"' - - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "stable"' - - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"' + - if: '$CI_COMMIT_BRANCH == "stable"' + - if: '$CI_COMMIT_BRANCH == "develop"' + - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "stable"' + - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"' script: - poetry run isort --check --diff mbtrack2/ - poetry run yapf -d -r mbtrack2/ -docker: +docker_develop: + stage: build_docker + rules: + - if: '$CI_COMMIT_BRANCH == "develop"' + image: docker:latest + services: + - docker:dind + variables: + CONTAINER_RELEASE_IMAGE: ${CI_REGISTRY_IMAGE}:develop + script: + - echo "${CI_REGISTRY_PASSWORD}" | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY} + - docker build --pull -t ${CONTAINER_RELEASE_IMAGE} . + - docker push ${CONTAINER_RELEASE_IMAGE} + +docker_stable: stage: build_docker rules: - if: '$CI_COMMIT_TAG' @@ -53,7 +69,7 @@ docker: - docker push ${CONTAINER_RELEASE_IMAGE} - docker push ${CONTAINER_TAG_IMAGE} -pip: +pip_stable: extends: .python_job stage: build_pip rules: -- GitLab