From ae32d3399a320c5e72be77faae967eddab1ec8ae Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen <louistw@uab.edu> Date: Wed, 4 May 2022 10:40:55 -0500 Subject: [PATCH 1/3] Update gitlab-ci.yml --- .gitlab-ci.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d93cd99..d591c66 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,15 +1,34 @@ -image: "python:3.7" +image: "python:3.6" + +# Change pip's cache directory to be inside the project directory since we can +# only cache local items. +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +cache: + paths: + - .cache/pip + - venv/ before_script: - python --version - - pip install pylint + - python3 -m venv venv + - source venv/bin/activate + - pip install black==22.3.0 flake8==4.0.1 stages: - lint -linting: +black: + tags: + - lint + stage: lint + script: + - black --check --diff . + +flake8: tags: - lint stage: lint script: - - pylint --ignore=tests.py --max-line-length=120 *.py app + - flake8 . -- GitLab From a77bbcf5c3e960057fa9528600de03d1cfffcd8f Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen <louistw@uab.edu> Date: Wed, 4 May 2022 12:06:54 -0500 Subject: [PATCH 2/3] Add pylint to gitlab-ci --- .gitlab-ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d591c66..6a3f1c4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ before_script: - python --version - python3 -m venv venv - source venv/bin/activate - - pip install black==22.3.0 flake8==4.0.1 + - pip install black==22.3.0 flake8==4.0.1 pylint==2.13.8 stages: - lint @@ -32,3 +32,10 @@ flake8: stage: lint script: - flake8 . + +pylint: + tags: + - lint + stage: lint + script: + - pylint app *.py -- GitLab From 7c5d62bf740ccfb6299f828a656118a640b72883 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen <louistw@uab.edu> Date: Fri, 13 May 2022 16:13:08 -0500 Subject: [PATCH 3/3] Make lint jobs only run on merge requests --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a3f1c4..b813433 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,6 +25,8 @@ black: stage: lint script: - black --check --diff . + only: + - merge_requests flake8: tags: @@ -32,6 +34,8 @@ flake8: stage: lint script: - flake8 . + only: + - merge_requests pylint: tags: @@ -39,3 +43,5 @@ pylint: stage: lint script: - pylint app *.py + only: + - merge_requests -- GitLab