Skip to content

Commit b91710e

Browse files
committed
WIP
1 parent 4b2f4ff commit b91710e

File tree

1 file changed

+70
-3
lines changed

1 file changed

+70
-3
lines changed

template/.gitlab-ci.yml

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change pip's cache directory to be inside the project directory since we can
22
# 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+
39
variables:
410
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
511

@@ -24,13 +30,13 @@ test:
2430
- python --version
2531
# Install dependencies
2632
- python -m pip install --upgrade pip setuptools
27-
- python -m pip install --editable ".[dev]"
33+
- python -m pip install --editable .[dev]
2834
script:
2935
# Run pytest
3036
- python -m pytest -v --durations=0
3137

3238
cffconvert:
33-
stage: test
39+
stage: lint
3440
image:
3541
name: "citationcff/cffconvert:2.0.0"
3642
entrypoint: [""]
@@ -46,7 +52,7 @@ cffconvert:
4652
- cffconvert --validate
4753

4854
markdown-link-check:
49-
stage: test
55+
stage: lint
5056
image:
5157
name: "lycheeverse/lychee"
5258
entrypoint: [""]
@@ -57,3 +63,64 @@ markdown-link-check:
5763
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
5864
script:
5965
- 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

Comments
 (0)