1
1
# Change pip's cache directory to be inside the project directory since we can
2
2
# only cache local items.
3
+
4
+ stages :
5
+ - lint # Fastest check first
6
+ - test # Then test
7
+ - build # build package and documentation when verified correct
8
+
3
9
variables :
4
10
PIP_CACHE_DIR : " $CI_PROJECT_DIR/.cache/pip"
5
11
@@ -24,13 +30,13 @@ test:
24
30
- python --version
25
31
# Install dependencies
26
32
- python -m pip install --upgrade pip setuptools
27
- - python -m pip install --editable " .[dev]"
33
+ - python -m pip install --editable .[dev]
28
34
script :
29
35
# Run pytest
30
36
- python -m pytest -v --durations=0
31
37
32
38
cffconvert :
33
- stage : test
39
+ stage : lint
34
40
image :
35
41
name : " citationcff/cffconvert:2.0.0"
36
42
entrypoint : [""]
@@ -46,7 +52,7 @@ cffconvert:
46
52
- cffconvert --validate
47
53
48
54
markdown-link-check :
49
- stage : test
55
+ stage : lint
50
56
image :
51
57
name : " lycheeverse/lychee"
52
58
entrypoint : [""]
@@ -57,3 +63,64 @@ markdown-link-check:
57
63
- if : $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
58
64
script :
59
65
- lychee .
66
+
67
+ lint :
68
+ stage : lint
69
+ image : " python:3.12"
70
+ rules :
71
+ # Run on a Merge Request to the default branch
72
+ - if : $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
73
+ # Run on new commits to the default branch
74
+ - if : $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
75
+ before_script :
76
+ # Python info
77
+ - which python
78
+ - python --version
79
+ # Install dependencies
80
+ - python -m pip install ruff
81
+ script :
82
+ # Run pytest
83
+ - ruff check
84
+ - ruff format --check
85
+
86
+ build :
87
+ stage : build
88
+ image : " python:$VERSION"
89
+ rules :
90
+ # Run on a Merge Request to the default branch
91
+ - if : $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
92
+ # Run on new commits to the default branch
93
+ - if : $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
94
+ parallel :
95
+ matrix :
96
+ - VERSION : ['3.8', '3.9', '3.10', '3.11', '3.12']
97
+ before_script :
98
+ # Python info
99
+ - which python
100
+ - python --version
101
+ # Install dependencies
102
+ - python -m pip install --upgrade pip setuptools
103
+ - python -m pip install --editable .[publishing]
104
+ script :
105
+ # Run pytest
106
+ - python -m build
107
+
108
+ documentation :
109
+ stage : build
110
+ image : " python:3.12"
111
+ rules :
112
+ # Run on a Merge Request to the default branch
113
+ - if : $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
114
+ # Run on new commits to the default branch
115
+ - if : $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
116
+ before_script :
117
+ # Python info
118
+ - which python
119
+ - python --version
120
+ # Install dependencies
121
+ - python -m pip install .[docs]
122
+ - sudo apt install pandoc
123
+ script :
124
+ # Run pytest
125
+ - cd docs
126
+ - make coverage doctest html
0 commit comments