only lint if python has been updated

This commit is contained in:
Luke Robles 2022-02-02 17:18:55 -08:00
parent 67cb3a8aa6
commit 84f30e5383
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,37 @@
image: docker:19.03.12-dind
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
stages:
- test
- deploy
lint_python_on_merge_request:
image: python:alpine
stage: test
script:
- echo "Linting Python code"
- pip install --upgrade -q pip && pip install -q black && black --fast --check .
rules:
- changes:
- app/*
build_and_push_container:
stage: deploy
script:
- echo "Wait for Docker daemon at tcp://localhost:2375"
- while ! nc -z localhost 2375; do sleep 0.1; done # Wait until docker socket is available
- docker login -u ldooks -p $DOCKER_ACCESS_TOKEN
- docker build -t ldooks/dragon-bot:$CI_PIPELINE_ID -t ldooks/dragon-bot:latest .
- docker push ldooks/dragon-bot:latest
- docker push ldooks/dragon-bot:$CI_PIPELINE_ID
rules:
- changes:
- app/*
- Dockerfile

3
.gitlab-ci.yml Executable file → Normal file
View File

@ -18,6 +18,9 @@ lint_python_on_merge_request:
script:
- echo "Linting Python code"
- pip install --upgrade -q pip && pip install -q black && black --fast --check .
rules:
- changes:
- app/*
build_and_push_container:
stage: deploy