Debian Codegraph @

.github/workflows/wheels.yml

raw symbols SCIP
1 name: Wheels
2
3 on:
4 push:
5 tags:
6 - '*'
7
8 jobs:
9 build_source:
10 name: Build source package
11 runs-on: [ ubuntu-latest ]
12 steps:
13 - uses: actions/checkout@v3
14
15 - uses: actions/setup-python@v4
16 name: Install Python
17 with:
18 python-version: '3.x'
19
20 - name: Build source package (.tar.gz)
21 run: |
22 python -m pip install setuptools
23 python setup.py sdist
24
25 - uses: actions/upload-artifact@v3
26 with:
27 name: source
28 path: ./dist/*.tar.gz
29
30 build_python3_wheels:
31 name: Build Python 3 wheels on ${{ matrix.os }}
32 runs-on: ${{ matrix.os }}
33 strategy:
34 matrix:
35 os: [ubuntu-20.04, windows-latest, macos-12]
36
37 if: github.actor == 'Legrandin'
38
39 steps:
40 - uses: actions/checkout@v3
41
42 - name: Select architecture for MacOS
43 run: |
44 echo 'CIBW_ARCHS=x86_64 universal2' >> $GITHUB_ENV
45 if: runner.os == 'macOS'
46
47 - uses: pypa/[email protected]
48 name: Build wheels
49 env:
50 # cibuildwheel will build wheel once and test it for each CPython version
51 # and for PyPy > 3.8.
52 CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* pp39-* pp310-*"
53 CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
54 CIBW_MANYLINUX_I686_IMAGE: "manylinux2014"
55 CIBW_MANYLINUX_PYPY_X86_64_IMAGE: "manylinux2014"
56 CIBW_MANYLINUX_PYPY_I686_IMAGE: "manylinux2014"
57 CIBW_BEFORE_TEST_LINUX: "(ldd /bin/ls | grep -q musl && apk add gmp) || true"
58
59 # Set pycryptodome/x test command according to built package
60 CIBW_TEST_COMMAND:
61 "${{ endsWith(github.ref, 'x') == true &&
62 'python -m Cryptodome.SelfTest --skip-slow-tests' ||
63 'python -m Crypto.SelfTest --skip-slow-tests' }}"
64
65 - name: Delete manylinux1 wheels
66 if: runner.os == 'Linux'
67 run: |
68 rm -f wheelhouse/*-manylinux1_i686.whl
69 rm -f wheelhouse/*-manylinux1_x86_64.whl
70
71 - uses: actions/upload-artifact@v3
72 with:
73 name: wheels
74 path: ./wheelhouse/*.whl
75
76 # Test ABI3 wheels on Python 3 versions no longer supported by cibuildwheel
77 # and/or by manylinux2014
78 test_abi3_wheels_old_python:
79 name: Test (legacy) Python 3 wheels on ${{ matrix.os }}
80 needs: build_python3_wheels
81 runs-on: ${{ matrix.os }}
82 strategy:
83 matrix:
84 os: [ubuntu-20.04, windows-latest, macos-12]
85 python-version: ['3.5']
86
87 if: github.actor == 'Legrandin'
88
89 steps:
90 - name: Set up Python ${{ matrix.python-version }}
91 uses: actions/setup-python@v4
92 with:
93 python-version: ${{ matrix.python-version }}
94
95 - uses: actions/download-artifact@v3
96 with:
97 name: wheels
98 path: wheels/
99
100 - name: Install GMP on musllinux
101 if: runner.os == 'Linux'
102 run: |
103 (ldd /bin/ls | grep -q musl && apk add gmp) || true
104
105 - name: Install and test pycryptodome wheel
106 if: endsWith(github.ref, 'x') == false
107 run: |
108 pip install pycryptodome --no-index -f wheels/
109 python -m Crypto.SelfTest --skip-slow-tests
110
111 - name: Install pycryptodomex wheel
112 if: endsWith(github.ref, 'x') == true
113 run: |
114 pip install pycryptodomex --no-index -f wheels/
115 python -m Cryptodome.SelfTest --skip-slow-tests
116
117 build_legacy_wheels:
118 name: Build legacy Python wheels on ${{ matrix.os }} (${{ matrix.arch }})
119 runs-on: ${{ matrix.os }}
120 strategy:
121 matrix:
122 os: [ ubuntu-20.04, windows-latest, macos-12 ]
123 arch: [ multi-arch ]
124 # Python 2 on Windows requires manual toolchain setup (per-arch) due to newer MSVC used here
125 exclude:
126 - os: windows-latest
127 arch: multi-arch
128 include:
129 - os: windows-latest
130 arch: x86
131 - os: windows-latest
132 arch: x64
133
134 if: github.actor == 'Legrandin'
135
136 steps:
137 - uses: actions/checkout@v3
138
139 - name: Install MSVC
140 if: runner.os == 'Windows'
141 uses: ilammy/msvc-dev-cmd@v1
142 with:
143 toolset: 14.0
144 arch: ${{ matrix.arch }}
145
146 - name: Set Windows build environment variables
147 if: runner.os == 'Windows'
148 run: |
149 echo "DISTUTILS_USE_SDK=1" >> $env:GITHUB_ENV
150 echo "MSSdk=1" >> $env:GITHUB_ENV
151
152 if ( '${{ matrix.arch }}' -eq 'x86' )
153 {
154 echo "CIBW_ARCHS=x86" >> $env:GITHUB_ENV
155 }
156 else
157 {
158 echo "CIBW_ARCHS=AMD64" >> $env:GITHUB_ENV
159 }
160
161 - uses: pypa/[email protected]
162 name: Build wheels
163 env:
164 CIBW_BUILD: "cp27-* pp27-*"
165 CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2010"
166 CIBW_MANYLINUX_I686_IMAGE: "manylinux2010"
167 CIBW_MANYLINUX_PYPY_X86_64_IMAGE: "manylinux2010"
168 CIBW_MANYLINUX_PYPY_I686_IMAGE: "manylinux2010"
169
170 # Set pycryptodome/x test command according to built package
171 CIBW_TEST_COMMAND:
172 "${{ endsWith(github.ref, 'x') == true &&
173 'python -m Cryptodome.SelfTest --skip-slow-tests' ||
174 'python -m Crypto.SelfTest --skip-slow-tests' }}"
175
176 - name: Delete manylinux1 wheels
177 if: runner.os == 'Linux'
178 run: |
179 rm -f wheelhouse/*-manylinux1_i686.whl
180 rm -f wheelhouse/*-manylinux1_x86_64.whl
181
182 - uses: actions/upload-artifact@v3
183 with:
184 name: wheels
185 path: ./wheelhouse/*.whl