chore: cleanup CI

This commit is contained in:
Alexis Métaireau 2023-12-22 00:30:37 +01:00 committed by Alexis Metaireau
parent dd1b28cc11
commit 37f320744d

View file

@ -1,7 +1,5 @@
stages:
- test
- docker
- deploy
tests:
stage: test
@ -26,40 +24,10 @@ tests:
- echo "Running tests..."
- source $CACHE_PATH/venv/bin/activate
- pip cache purge
- pip install -U -r requirements-dev.txt
- pip install -e ".[dev]"
- pytest --create-db --cov --cov-report=xml
- if [ "$CI_COMMIT_REF_NAME" = 'main' ] ; then exit 0 ; fi
- if [ "$CI_COMMIT_REF_NAME" = 'develop' ] ; then git fetch origin main ; diff-cover coverage.xml --fail-under=90 --compare-branch origin/main --diff-range-notation '..' && exit 0 ; fi
- git fetch origin develop ; diff-cover coverage.xml --fail-under=90 --compare-branch origin/develop --diff-range-notation '..'
- echo "Tests done."
build_docker_and_publish:
stage: docker
only:
- main
- develop
image: docker:git
tags:
- dind
services:
- docker:dind
script:
- docker build --pull --no-cache -f Dockerfile -t $CI_REGISTRY/hashbangfr/la_chariotte:${CI_COMMIT_REF_NAME}-latest .
- docker tag $CI_REGISTRY/hashbangfr/la_chariotte:${CI_COMMIT_REF_NAME}-latest $CI_REGISTRY/hashbangfr/la_chariotte:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CI_REGISTRY/hashbangfr/la_chariotte:${CI_COMMIT_REF_NAME}-latest
- docker push $CI_REGISTRY/hashbangfr/la_chariotte:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}
ansible:
only:
refs:
- main
- develop
stage: deploy
image: $CI_REGISTRY/hashbangfr/docker_archlinux:ansible
tags:
- ansible
script:
- cd /srv/ansible/
- ansible-playbook ./playbooks/hb_chariotte/play-${CI_COMMIT_REF_NAME}.yml --extra-vars="CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA}"