From befb8f42be3afd7586387e2c5dfedb08624e6614 Mon Sep 17 00:00:00 2001 From: Anton Tetov <anton@tetov.se> Date: Thu, 7 Apr 2022 17:26:31 +0200 Subject: [PATCH] clean up gitlab-ci.yml --- .gitlab-ci.yml | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cf2bf1c..a418e36 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,43 +19,31 @@ stages: # Jobs templates -.set-executor: &executor +default: tags: - docker-executor - -.install-deps-template: &install-deps - <<: *executor before_script: - - apt update && apt install make -y + - apt update && apt install make git -y - pip install poetry - poetry --version - poetry config virtualenvs.in-project true - poetry install -vv - -.quality-template: &quality - <<: *install-deps image: python:3.9-slim-bullseye - stage: quality .test-template: &test - <<: *install-deps stage: tests + image: "python:$PYTHON_VER-slim-bullseye" script: make test # Quality jobs run-pre-commit: - <<: *quality + stage: quality script: make check allow_failure: true after_script: - mkdir -pv changed - - | - test $CI_JOB_STATUS -eq "failed" && - apt install git -y && - git status --porcelain - | awk 'match($1,"M"){print $2}' - | xargs -r cp -vt changed + - git status --porcelain | awk 'match($1,"M"){print $2}' | xargs -r cp -vt changed artifacts: name: "$CI_JOB_NAME" expire_in: 7 days @@ -65,20 +53,20 @@ run-pre-commit: # Tests jobs -python3.9: - <<: *test - image: python:3.9-slim-bullseye +"Run tests with Python 3.9": + extends: .test + variables: + PYTHON_VER: "3.9" -python3.10: - <<: *test - image: python:3.10-slim-bullseye +"Run tests with Python 3.10": + extends: .test + variables: + PYTHON_VER: "3.10" # Publish jobs publish: - <<: *install-deps stage: publish - image: python:3.10-slim-bullseye only: - /^v(\d+\.)(\d+\.)(\d+)$/ script: -- GitLab