[damned-lies] chore: update ci jobs to match new flake/prospector config



commit 00f17313e076bc7a2289f7c3d09ef25ea16b5356
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Fri Jun 25 08:33:56 2021 +0200

    chore: update ci jobs to match new flake/prospector config

 .gitlab-ci.yml | 113 ++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 71 insertions(+), 42 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c1cde790..c79c141a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,73 +1,102 @@
-image: python:latest
-
 stages:
   - build
   - test
 
-before_script:
-  - apt update -qq && apt install -y -qq libicu-dev libxml2-dev python3-icu python3-aeidon gettext intltool 
itstool yelp-tools yelp-xsl gnome-doc-utils python3-libxml2
-  - pip install -r requirements.txt
+
+workflow:
+  rules:
+    # A merge request pipeline
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+      when: always
+    # A push event on a merge request should not be triggered to avoid duplicate pipelines
+    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_MERGE_REQUEST_ID != null'
+      when: never
+    - when: always
+
+
+.debian-based-job:
+  image: python:latest
+  before_script:
+    - apt update -qq
+    - apt install -y -qq libicu-dev python3-icu python3-aeidon gettext intltool itstool yelp-tools yelp-xsl 
gnome-doc-utils
+    - pip install -r requirements.txt
+
 
 pages:
   stage: build
+  extends: .debian-based-job
   script:
-    - pip3 install -r ./docs/requirements.txt
+    - pip install -r ./docs/requirements.txt
     - make -C docs html
   after_script:
     - mv docs/build/html/ public/
   artifacts:
     paths:
       - public
-    expire_in: "5 min"
+    expire_in: "5 days"
   rules:
-    # When job is triggered after a push event, run only when code files changed
-    - if: $CI_PIPELINE_SOURCE == "push"
-      changes:
-        - po/*  # po files are committed by l10n itself
-      when: manual
-    # Otherwise, always run job.
-    - when: always
+    # Run the job on the default branch only.
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+      when: always
       allow_failure: false
+    - when: never
+      allow_failure: true
+
 
 test:
   stage: test
+  extends: .debian-based-job
   script:
     - pip install coverage
     - python manage.py compile-trans --settings=damnedlies.settings_tests
     - coverage run manage.py test --settings=damnedlies.settings_tests -v2
+  after_script:
     - coverage xml
-    - coverage report
+    - coverage report | tee coverage.txt
   coverage: /^TOTAL.*\s+(\d+\%)$/
   artifacts:
-    name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
-    expire_in: 2 days
+    name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}"
+    expire_in: "2 days"
+    expose_as: "Unit tests coverage"
+    paths:
+      - coverage.txt
     reports:
       cobertura: coverage.xml
-  rules:
-    # When job is triggered after a push event, run only when code files changed
-    - if: $CI_PIPELINE_SOURCE == "push"
-      changes:
-        - po/*  # po files are committed by l10n itself
-        - docs/*
-        - "*.md"
-      when: manual
-    # Otherwise, always run job.
-    - when: always
-      allow_failure: false
 
-linter:
+
+.static-analysis:
   stage: test
+  allow_failure: true
+
+
+static-analysis:prospector:
+  extends:
+    - .static-analysis
+    - .debian-based-job
   script:
-    - pip install prospector[with_bandit]
-    - prospector
-  rules:
-    # When job is triggered after a push event, run only when code files changed
-    - if: $CI_PIPELINE_SOURCE == "push"
-      changes:
-        - po/*  # po files are committed by l10n itself
-        - docs/*
-        - "*.md"
-      when: manual
-    # Otherwise, always run job.
-    - when: always
-      allow_failure: true
+    - pip install prospector[with_pyroma,with_bandit]
+    - prospector | tee prospector.txt
+  artifacts:
+    name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}"
+    expire_in: 2 days
+    expose_as: "Prospector Analysis"
+    paths:
+      - prospector.txt
+    when: always
+
+
+static-analysis:flake8:
+  image: python:alpine
+  extends:
+    - .static-analysis
+  before_script:
+    - pip install flake8
+  script:
+    - flake8 | tee flake8.txt
+  artifacts:
+    name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}"
+    expire_in: 2 days
+    expose_as: "Flake8 Analysis"
+    paths:
+      - flake8.txt
+    when: always


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]