8
8
description : The version to build
9
9
10
10
env :
11
+ PYPI_NAME : tongsuopy
11
12
TONGSUO_VERSION : 8.3.2
13
+ INNER_WORKSPACE : /workspace
14
+ INNER_BUILD_DIR : /build
12
15
13
16
jobs :
14
17
sdist :
62
65
63
66
with :
64
67
name : tongsuopy-sdist
65
- - name : Set TONGSUO_HOME
66
- shell : bash
67
- run : echo "TONGSUO_HOME=${GITHUB_WORKSPACE}/tongsuo${TONGSUO_VERSION}" >> $GITHUB_ENV
68
- - name : Build Tongsuo
69
- working-directory : ${{ runner.temp }}
70
- run : |
71
- wget "https://github.com/Tongsuo-Project/Tongsuo/archive/refs/tags/${TONGSUO_VERSION}.tar.gz"
72
- tar zxf "${TONGSUO_VERSION}.tar.gz"
73
- cd "Tongsuo-${TONGSUO_VERSION}"
74
- ./config no-shared enable-ntls --release --prefix=${TONGSUO_HOME}
75
- make -s -j4
76
- make install_sw
77
- cd -
78
68
- run : /opt/python/${{ matrix.PYTHON.VERSION }}/bin/python -m venv .venv
79
69
- name : Install Python dependencies
80
70
run : .venv/bin/pip install -U pip wheel cffi
97
87
else
98
88
exit 0
99
89
fi
100
- - run : .venv/bin/pip install tongsuopy --no-index -f wheelhouse/
90
+ - run : .venv/bin/pip install ${{ env.PYPI_NAME }} --no-index -f wheelhouse/
101
91
- run : |
102
92
.venv/bin/python -c "from tongsuopy.backends.tongsuo.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))"
103
93
- run : mkdir tongsuopy-wheelhouse
@@ -108,7 +98,97 @@ jobs:
108
98
password : ${{ secrets.PYPI_API_TOKEN }}
109
99
packages_dir : tongsuopy-wheelhouse/
110
100
print_hash : true
111
- # repository_url: https://test.pypi.org/legacy/
101
+
102
+ manylinux-aarch64 :
103
+ needs : [ sdist ]
104
+ runs-on : ubuntu-latest
105
+ strategy :
106
+ fail-fast : false
107
+ matrix :
108
+ PYTHON :
109
+ - { VERSION: "cp36-cp36m", ABI_VERSION: 'cp36' }
110
+ - { VERSION: "pp38-pypy38_pp73" }
111
+ - { VERSION: "pp39-pypy39_pp73" }
112
+ MANYLINUX :
113
+ - { NAME: "manylinux2014_aarch64", CONTAINER: "tongsuopy-manylinux2014:aarch64" }
114
+ - { NAME: "manylinux_2_24_aarch64", CONTAINER: "tongsuopy-manylinux_2_24:aarch64" }
115
+ - { NAME: "manylinux_2_28_aarch64", CONTAINER: "tongsuopy-manylinux_2_28:aarch64" }
116
+ - { NAME: "musllinux_1_1_aarch64", CONTAINER: "tongsuopy-musllinux_1_1:aarch64" }
117
+ exclude :
118
+ # There are no readily available PyPy distributions
119
+ - PYTHON : { VERSION: "pp38-pypy38_pp73" }
120
+ MANYLINUX : { NAME: "musllinux_1_1_aarch64", CONTAINER: "tongsuopy-musllinux_1_1:aarch64" }
121
+ - PYTHON : { VERSION: "pp39-pypy39_pp73" }
122
+ MANYLINUX : { NAME: "musllinux_1_1_aarch64", CONTAINER: "tongsuopy-musllinux_1_1:aarch64" }
123
+
124
+
125
+ name : " ${{ matrix.PYTHON.VERSION }} for ${{ matrix.MANYLINUX.NAME }}"
126
+ steps :
127
+
128
+ with :
129
+ name : tongsuopy-sdist
130
+ path : ${{ github.workspace }}
131
+
132
+ - uses : uraimo/run-on-arch-action@v2
133
+ name : Build artifact
134
+ with :
135
+ arch : none
136
+ distro : none
137
+ base_image : --platform=linux/arm64 ghcr.io/tongsuo-project/${{ matrix.MANYLINUX.CONTAINER }}
138
+
139
+ # Not required, but speeds up builds
140
+ githubToken : ${{ secrets.PAT }}
141
+
142
+ # Mount the artifacts directory as /artifacts in the container
143
+ dockerRunArgs : |
144
+ --volume "${{ github.workspace }}:${{ env.INNER_WORKSPACE }}"
145
+ --volume "${{ runner.temp }}:${{ env.INNER_BUILD_DIR }}"
146
+
147
+ # Pass some environment variables to the container
148
+ env : |
149
+ INNER_WORKSPACE: "${{ env.INNER_WORKSPACE }}"
150
+ INNER_BUILD_DIR: "${{ env.INNER_BUILD_DIR }}"
151
+ PYTHON_VERSION: "${{ matrix.PYTHON.VERSION }}"
152
+ PYTHON_ABI_VERSION: "${{ matrix.PYTHON.ABI_VERSION }}"
153
+ MANYLINUX_NAME: "${{ matrix.MANYLINUX.NAME }}"
154
+
155
+ # Produce a binary artifact and place it in the mounted volume
156
+ run : |
157
+ cd ${INNER_BUILD_DIR}
158
+ /opt/python/${PYTHON_VERSION}/bin/python -m venv .venv
159
+ .venv/bin/pip install -U pip wheel cffi
160
+
161
+ cd ${INNER_WORKSPACE}
162
+ tar zxvf tongsuopy*.tar.gz && rm tongsuopy*.tar.gz && mkdir tmpwheelhouse
163
+ PY_LIMITED_API=""
164
+ if [ -n "${PYTHON_ABI_VERSION}" ]; then
165
+ PY_LIMITED_API="--py-limited-api=${PYTHON_ABI_VERSION}"
166
+ fi
167
+ cd tongsuopy*
168
+ ${INNER_BUILD_DIR}/.venv/bin/python setup.py bdist_wheel ${PY_LIMITED_API} && mv dist/tongsuopy*.whl ../tmpwheelhouse
169
+
170
+ cd ${INNER_WORKSPACE}
171
+ auditwheel repair --plat ${MANYLINUX_NAME} tmpwheelhouse/tongsuopy*.whl -w wheelhouse/
172
+ unzip wheelhouse/*.whl -d execstack.check
173
+ results=$(readelf -lW execstack.check/tongsuopy/backends/*.so)
174
+ count=$(echo "$results" | grep -c 'GNU_STACK.*[R ][W ]E' || true)
175
+ echo "count -> ${count}"
176
+ if [ "$count" -ne 0 ]; then
177
+ exit 1
178
+ fi
179
+
180
+ cd ${INNER_WORKSPACE}
181
+ ${INNER_BUILD_DIR}/.venv/bin/pip install ${{ env.PYPI_NAME }} --no-index -f wheelhouse/
182
+ ${INNER_BUILD_DIR}/.venv/bin/python -c "from tongsuopy.backends.tongsuo.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))"
183
+ mkdir tongsuopy-wheelhouse
184
+ mv wheelhouse/tongsuopy*.whl tongsuopy-wheelhouse/
185
+
186
+ - name : Publish tongsuopy to PyPI
187
+ uses : pypa/gh-action-pypi-publish@release/v1
188
+ with :
189
+ password : ${{ secrets.PYPI_API_TOKEN }}
190
+ packages_dir : ${{ github.workspace }}/tongsuopy-wheelhouse/
191
+ print_hash : true
112
192
113
193
macos :
114
194
needs : [sdist]
@@ -191,7 +271,7 @@ jobs:
191
271
MACOSX_DEPLOYMENT_TARGET : ${{ matrix.PYTHON.DEPLOYMENT_TARGET }}
192
272
ARCHFLAGS : ${{ matrix.PYTHON.ARCHFLAGS }}
193
273
_PYTHON_HOST_PLATFORM : ${{ matrix.PYTHON._PYTHON_HOST_PLATFORM }}
194
- - run : venv/bin/pip install -f wheelhouse --no-index tongsuopy
274
+ - run : venv/bin/pip install -f wheelhouse --no-index ${{ env.PYPI_NAME }}
195
275
- name : Show the wheel's minimum macOS SDK and architectures
196
276
run : |
197
277
find venv/lib/*/site-packages/tongsuopy/backends -name '*.so' -exec vtool -show {} \;
@@ -270,7 +350,7 @@ jobs:
270
350
- run : tar zxvf tongsuopy*.tar.gz && mkdir wheelhouse
271
351
shell : bash
272
352
- run : cd tongsuopy* && python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/tongsuopy*.whl ../wheelhouse
273
- - run : pip install -f wheelhouse --no-index tongsuopy
353
+ - run : pip install -f wheelhouse --no-index ${{ env.PYPI_NAME }}
274
354
- name : Print the OpenSSL we built and linked against
275
355
run : |
276
356
python -c "from tongsuopy.backends.tongsuo.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))"
0 commit comments