-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy path.gitlab-ci.yml
158 lines (145 loc) · 6.93 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
158
stages:
- build
- deploy
include: '/.gitlab-ci-windows.yml'
python39:
image: python:3.9
when: always
stage: build
script:
- apt-get update -q -y
- apt-get install -y swig libssl-dev python3-dev python3-pip python3-wheel openssl python3-setuptools python3-twisted python3-pip
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --user -r dev-requirements.txt
- python3 -mbuild .
- python3 -mpip install -v --upgrade --target build/lib.linux-x86_64-cpython-39 --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- PYTHONPATH=build/lib.linux-x86_64-cpython-39 python3 -munittest -b -v tests.alltests.suite
python3:
image: python:3
when: always
stage: build
script:
- apt-get update -q -y
- apt-get install -y swig libssl-dev python3-dev python3-pip openssl python3-setuptools python3-twisted python3-pip
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --break-system-packages --user -r dev-requirements.txt
- python3 -mbuild .
- python3 -mpip install --break-system-packages -v --upgrade --target $(readlink -f build/lib.*) --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- PYTHONPATH=$(readlink -f build/lib.*) python3 -munittest -b -v tests.alltests.suite
python3-doctest:
image: python:3
when: always
stage: build
script:
- apt-get update -q -y
- apt-get install -y swig libssl-dev python3-dev python3-pip openssl python3-setuptools python3-twisted python3-pip
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --break-system-packages --user -r dev-requirements.txt -r doc/requirements.txt
- python3 -mbuild .
- python3 -mpip install --break-system-packages -v --upgrade --target $(readlink -f build/lib.*) --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- cd doc/
- PYTHONPATH=$(readlink -f ../build/lib.*) make doctest
fedora:
image: fedora:latest
when: always
stage: build
script:
- dnf makecache
- dnf install -y @development-tools fedora-packager rpmdevtools
- dnf install -y swig python3-devel python3-pip openssl-devel openssl python3-setuptools python3-twisted
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --user -r dev-requirements.txt
- python3 -mbuild .
- python3 -mpip install -v --upgrade --target $(readlink -f build/lib.*) --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- PYTHONPATH=$(readlink -f build/lib.*) python3 -munittest -b -v tests.alltests.suite
fedora-rawhide:
image: registry.fedoraproject.org/fedora:rawhide
when: always
stage: build
script:
- dnf makecache
- dnf install -y @development-tools fedora-packager rpmdevtools
- dnf install -y swig python3-devel python3-pip openssl-devel openssl python3-setuptools python3-twisted
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --break-system-packages --user -r dev-requirements.txt
- python3 -mbuild .
- python3 -mpip install --break-system-packages -v --upgrade --target $(readlink -f build/lib.*) --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- PYTHONPATH=$(readlink -f build/lib.*) python3 -munittest -b -v tests.alltests.suite
centos7:
image: centos:7
when: always
stage: build
script:
- yum install -y epel-release
- yum makecache
- yum groups install -y "Development Tools"
- yum install -y swig python36-devel python36-pip python36-wheel openssl openssl-devel python36-service-identity python36-setuptools python36-pip python36-Twisted
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --user -r dev-requirements.txt
- python3 -mpip wheel --verbose --no-deps --wheel-dir ./dist .
- python3 -mpip install -v --upgrade --target build/lib.* --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- PYTHONPATH=build/lib.* python3 -munittest -b -v tests.alltests.suite
leap:
# image: registry.suse.com/bci/bci-base:latest
image: opensuse/leap
when: always
stage: build
script:
- zypper refresh
- zypper install -y pattern:devel_rpm_build pattern:devel_C_C++ osc
- zypper install -y swig python3-devel python3-pip libopenssl-devel openssl python3-service_identity python3-setuptools python3-Twisted
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --user -r dev-requirements.txt
- python3 -mbuild .
- python3 -mpip install -v --upgrade --target $(readlink -f build/lib.*) --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- PYTHONPATH=$(readlink -f build/lib.*) python3 -munittest -b -v tests.alltests.suite
opensuse:
image: opensuse/tumbleweed
when: always
stage: build
script:
- zypper refresh
- zypper install -y pattern:devel_rpm_build pattern:devel_C_C++ osc
- zypper install -y swig python3-devel python3-pip libopenssl-devel openssl python3-service_identity python3-setuptools python3-Twisted
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --user --break-system-packages -r dev-requirements.txt
- python3 -mbuild .
- python3 -mpip install -v --upgrade --target $(readlink -f build/lib.*) --no-compile --ignore-installed --no-deps --no-index dist/M2Crypto*.whl
- PYTHONPATH=$(readlink -f build/lib.*) python3 -munittest -b -v tests.alltests.suite
build-sdist:
image: python:3
when: always
stage: build
artifacts:
paths:
- "dist/*.tar.gz"
script:
- apt-get update -q -y
- apt-get install -y swig libssl-dev python3-dev python3-pip openssl python3-setuptools python3-twisted python3-pip
- export PATH=$PATH:$HOME/.local/bin
- python3 -mpip install --break-system-packages --user -r dev-requirements.txt
- python3 -mbuild . --sdist
release-pypi:
stage: deploy
image: python:latest
dependencies:
- build-test-windows
- build-sdist
id_tokens:
PYPI_ID_TOKEN:
aud: pypi
script:
- echo "Built artifacts:"
- ls dist/
# Install dependencies
- apt update && apt install -y jq
- python -m pip install -U twine id
# Retrieve the OIDC token from GitLab CI/CD, and exchange it for a PyPI API token
- oidc_token=$(python -m id PYPI)
- resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\":\"${oidc_token}\"}")
- api_token=$(jq --raw-output '.token' <<< "${resp}")
# Upload wheel to PyPI authenticating via the newly-minted token
- twine upload -u __token__ -p "${api_token}" dist/*
rules:
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ # Job enabled only when pushing tags for versions, e.g: 0.40.1
when: manual # Can only be triggered manually