-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
91 lines (81 loc) · 2.23 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# NOTE: The following variables are required for this pipeline to work
# GIT_COMMIT_USER: The username of the gitlab user that will be used to push tags
# GIT_COMMIT_EMAIL: The email of the gitlab user that will be used to push tags
include:
- local: '.gitlab/templates.yml'
image: python:3.12
stages:
- general
- trigger
# Pipeline rules
workflow:
rules:
# Skip CI if commit message contains with [skip-ci]
- if: '$CI_COMMIT_MESSAGE =~ /\[skip-ci\]/'
when: never
# Prevent running a push pipeline for a release commit that's not a tag
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):.*/ && $CI_COMMIT_TAG == null
when: never
# If a push to branch with open merge request then ignore
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
# If source is push and no open merge request then run
- if: $CI_COMMIT_BRANCH
# Run tag pipelines
- if: $CI_COMMIT_TAG
variables:
VERSION_ENV_FILE: .version
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"
build-env:
stage: .pre
script:
- python -m venv .venv/
- source .venv/bin/activate
- pip install -U pip
- pip install uv
- uv sync --refresh
- uv cache prune --ci
# Install go-task
- sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b .
rules:
# If project dependencies were changed then run
- changes:
- pyproject.toml
- manifest
when: always
# If .venv exists then skip
- exists:
- .venv/
when: never
# Default to manual, but continue
# pipeline if not run
- when: manual
allow_failure: true
default-pipeline:
stage: general
trigger:
include: .gitlab/default.yml
strategy: depend
rules:
- if: !reference [.is_side_branch, if]
when: on_success
- when: never
stable-pipeline:
stage: trigger
trigger:
include: .gitlab/stable.yml
strategy: depend
rules:
- if: !reference [.is_main_branch, if]
when: on_success
- when: never
release-pipeline:
stage: trigger
trigger:
include: .gitlab/release.yml
strategy: depend
rules:
- if: !reference [.is_tag_pipeline, if]
when: on_success
- when: never