-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
157 lines (139 loc) · 3.42 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
variables:
RELEASE_NAME: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-g${CI_COMMIT_SHORT_SHA}-b${CI_PIPELINE_ID}"
include:
- project: "devops/support"
ref: master
file:
- "includes/variables/pypi-gitlab.yml"
- "includes/build/rust/crates-io-mirror.yml"
- "includes/reports/pytest-junit.yml"
- "includes/docs/python-pdoc.yml"
default:
tags:
- linux-docker
image: ${PLG_CI_DOCKER_TAG}/rusty-python:latest
stages:
- check
- build
- test
- wheels
- publish-test
- install-test
- deploy
fmt:
stage: check
script:
- cargo fmt -- --check
clippy:
stage: check
script:
- cargo clippy -- --deny warnings
black:
stage: check
script:
- black --check tests
compile:
stage: build
script:
- cargo build --release
artifacts:
name: "${RELEASE_NAME}-bin-lin64"
paths:
- target/release/*.so
compile-win64:
stage: build
script:
- cargo build --release --target x86_64-pc-windows-gnu
artifacts:
name: "${RELEASE_NAME}-bin-win64"
paths:
- target/x86_64-pc-windows-gnu/release/*.dll
package:
stage: wheels
script:
- maturin build --release --zig
- mkdir -p dist
- cp -t dist target/wheels/*.whl
artifacts:
name: "${RELEASE_NAME}-wheel-lin64"
paths:
- dist
package-win64:
stage: wheels
script:
- maturin build --release --target x86_64-pc-windows-gnu
- mkdir -p dist
- cp -t dist target/wheels/*.whl
artifacts:
name: "${RELEASE_NAME}-wheel-win64"
paths:
- dist
package-sdist:
stage: wheels
script:
- maturin sdist
- mkdir -p dist
- cp -t dist target/wheels/*.tar.gz
artifacts:
name: "${RELEASE_NAME}-sdist"
paths:
- dist
typecheck:
stage: test
script:
- python3 -m venv --system-site-packages mypy_venv
- . mypy_venv/bin/activate
- maturin develop
- python3 -m pylint tests
- python3 -m mypy tests
runtests:
stage: test
variables:
PIP_INDEX_URL: "${PLG_CI_PYPI_INDEX_URL}"
script:
- tox
pubtest:
stage: publish-test
variables:
MATURIN_REPOSITORY_URL: "${PYPI_SERVER}"
MATURIN_USERNAME: "${PYPI_USER}"
MATURIN_PASSWORD: "${PYPI_PASSWORD}"
script:
- maturin upload --skip-existing dist/*
test-install:
stage: install-test
image: ${PLG_CI_DOCKER_TAG}/python:latest
variables:
PIP_INDEX_URL: "${PYPI_INDEX_URL}"
script:
- pip3 install ${CI_PROJECT_NAME}
- python3 -m unittest
test-install-win64:
stage: install-test
tags:
- ltsc2022-docker
image: ${PLG_CI_DOCKER_TAG}/python:3.11
variables:
PIP_INDEX_URL: "${PYPI_INDEX_URL}"
ErrorActionPreference: stop
script:
- pip3 install ${CI_PROJECT_NAME}
- python -m unittest
test-install-sdist:
stage: install-test
image: ${PLG_CI_DOCKER_TAG}/rusty-python:latest
variables:
PIP_INDEX_URL: "${PYPI_INDEX_URL}"
script:
- pip3 install "${CI_PROJECT_NAME}" --no-binary "${CI_PROJECT_NAME}"
- python3 -m unittest
publish-wheels:
stage: deploy
only:
- tags
variables:
MATURIN_REPOSITORY_URL: "${PLG_CI_PYPI_SERVER}"
MATURIN_USERNAME: "${PLG_CI_PYPI_USER}"
MATURIN_PASSWORD: "${PLG_CI_PYPI_PASSWORD}"
script:
- maturin upload dist/*