Skip to content

Commit 106a923

Browse files
naveen521kklazka
authored andcommitted
CI: test the build and add some mingw specific tests
- Use actions/setup-python for setting up correct version in cross build - CI: add cross llvm-mingw jobs - CI: fix sed pattern for python-config.py shebang The shebang (`#!`) does not include `${pkgdir}` so this sed did nothing - CI: remove --without-c-locale-coercion No longer needed since the default now works on Windows - Make sure we always use the stdlib distutils - CI: update actions and images ubuntu-18.04 is gone now - CI: updates for mstorsjo/llvm-mingw moving to 20.04 - CI: 3.10 -> 3.11
1 parent c94b7ab commit 106a923

File tree

3 files changed

+641
-0
lines changed

3 files changed

+641
-0
lines changed

.github/workflows/mingw.yml

+294
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
name: Build
2+
on: [push, pull_request, workflow_dispatch]
3+
4+
jobs:
5+
build:
6+
runs-on: windows-2022
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
msystem: ['MINGW64','MINGW32','UCRT64','CLANG64','CLANG32']
11+
include:
12+
- msystem: MINGW64
13+
prefix: mingw-w64-x86_64
14+
- msystem: MINGW32
15+
prefix: mingw-w64-i686
16+
- msystem: UCRT64
17+
prefix: mingw-w64-ucrt-x86_64
18+
- msystem: CLANG64
19+
prefix: mingw-w64-clang-x86_64
20+
- msystem: CLANG32
21+
prefix: mingw-w64-clang-i686
22+
steps:
23+
- name: Setup git
24+
run: |
25+
git config --global core.autocrlf false
26+
git config --global core.eol lf
27+
- uses: actions/checkout@v3
28+
- uses: msys2/setup-msys2@v2
29+
with:
30+
msystem: ${{ matrix.msystem }}
31+
release: false
32+
update: true
33+
install: >-
34+
make
35+
binutils
36+
autoconf
37+
autoconf-archive
38+
automake-wrapper
39+
tar
40+
gzip
41+
${{ matrix.prefix }}-toolchain
42+
${{ matrix.prefix }}-expat
43+
${{ matrix.prefix }}-bzip2
44+
${{ matrix.prefix }}-libffi
45+
${{ matrix.prefix }}-mpdecimal
46+
${{ matrix.prefix }}-ncurses
47+
${{ matrix.prefix }}-openssl
48+
${{ matrix.prefix }}-sqlite3
49+
${{ matrix.prefix }}-tcl
50+
${{ matrix.prefix }}-tk
51+
${{ matrix.prefix }}-zlib
52+
${{ matrix.prefix }}-xz
53+
${{ matrix.prefix }}-tzdata
54+
55+
- name: Build Python
56+
shell: msys2 {0}
57+
run: |
58+
set -ex
59+
60+
if [[ "${{ matrix.msystem }}" == "CLANG64" ]] || [[ "${{ matrix.msystem }}" == "CLANG32" ]]; then
61+
export CC=clang
62+
export CXX=clang++
63+
fi
64+
autoreconf -vfi
65+
66+
rm -Rf _build && mkdir _build && cd _build
67+
68+
../configure \
69+
--prefix=${MINGW_PREFIX} \
70+
--host=${MINGW_CHOST} \
71+
--build=${MINGW_CHOST} \
72+
--enable-shared \
73+
--with-system-expat \
74+
--with-system-ffi \
75+
--with-system-libmpdec \
76+
--without-ensurepip \
77+
--enable-loadable-sqlite-extensions \
78+
--with-tzpath=${MINGW_PREFIX}/share/zoneinfo \
79+
--enable-optimizations
80+
81+
make -j8
82+
83+
- name: Run Smoke Test (build)
84+
shell: msys2 {0}
85+
run: |
86+
export SETUPTOOLS_USE_DISTUTILS=stdlib
87+
SMOKETESTS="$(pwd)/mingw_smoketests.py"
88+
cd _build
89+
./python.exe "$SMOKETESTS"
90+
MSYSTEM= ./python.exe "$SMOKETESTS"
91+
92+
- name: Run tests
93+
shell: msys2 {0}
94+
run: |
95+
export SETUPTOOLS_USE_DISTUTILS=stdlib
96+
IGNOREFILE="$(pwd)/mingw_ignorefile.txt"
97+
cd _build
98+
MSYSTEM= ./python.exe -m test -j8 --ignorefile "$IGNOREFILE" -W
99+
100+
- name: Run broken tests
101+
continue-on-error: true
102+
shell: msys2 {0}
103+
run: |
104+
export SETUPTOOLS_USE_DISTUTILS=stdlib
105+
IGNOREFILE="$(pwd)/mingw_ignorefile.txt"
106+
cd _build
107+
MSYSTEM= ./python.exe -m test -j8 --matchfile "$IGNOREFILE" -W
108+
109+
- name: Install
110+
shell: msys2 {0}
111+
run: |
112+
set -ex
113+
cd _build
114+
115+
pkgdir=python_pkgdir
116+
117+
make -j1 install DESTDIR="${pkgdir}"
118+
119+
# Fix shebangs
120+
_pybasever=$(./python.exe -c "import sys; print(f'{sys.version_info[0]}.{sys.version_info[1]}');")
121+
for fscripts in 2to3 2to3-${_pybasever} idle3 idle${_pybasever} pydoc3 pydoc${_pybasever}; do
122+
sed -i "s|$(cygpath -w ${MINGW_PREFIX} | sed 's|\\|\\\\|g')/bin/python${_pybasever}.exe|/usr/bin/env python${_pybasever}.exe|g" "${pkgdir}${MINGW_PREFIX}"/bin/${fscripts}
123+
done
124+
sed -i "s|#!${MINGW_PREFIX}/bin/python${_pybasever}.exe|#!/usr/bin/env python${_pybasever}.exe|" "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config-${_pybasever}/python-config.py
125+
126+
# Create version-less aliases
127+
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3.exe "${pkgdir}${MINGW_PREFIX}"/bin/python.exe
128+
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3w.exe "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe
129+
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3-config "${pkgdir}${MINGW_PREFIX}"/bin/python-config
130+
cp "${pkgdir}${MINGW_PREFIX}"/bin/idle3 "${pkgdir}${MINGW_PREFIX}"/bin/idle
131+
cp "${pkgdir}${MINGW_PREFIX}"/bin/pydoc3 "${pkgdir}${MINGW_PREFIX}"/bin/pydoc
132+
133+
- name: Run Smoke Test (installed)
134+
shell: msys2 {0}
135+
run: |
136+
export SETUPTOOLS_USE_DISTUTILS=stdlib
137+
export PYTHONTZPATH="${MINGW_PREFIX}/share/zoneinfo"
138+
SMOKETESTS="$(pwd)/mingw_smoketests.py"
139+
cd _build
140+
cd python_pkgdir/${MINGW_PREFIX}/bin
141+
./python.exe "$SMOKETESTS"
142+
MSYSTEM= ./python.exe "$SMOKETESTS"
143+
144+
- name: Compress
145+
if: always()
146+
shell: msys2 {0}
147+
run: |
148+
cd _build
149+
tar -zcf python.tar.gz python_pkgdir/
150+
151+
- name: Upload
152+
uses: actions/upload-artifact@v3
153+
if: always()
154+
with:
155+
name: build-${{ matrix.msystem }}
156+
path: _build/python.tar.gz
157+
158+
cross-gcc-x86_64:
159+
runs-on: ubuntu-latest
160+
container:
161+
image: archlinux:base-devel
162+
steps:
163+
- uses: actions/checkout@v3
164+
- name: Install deps
165+
run: |
166+
pacman --noconfirm -Suuy
167+
pacman --needed --noconfirm -S mingw-w64-gcc autoconf-archive autoconf automake zip
168+
169+
- uses: actions/setup-python@v4
170+
with:
171+
python-version: '3.11'
172+
173+
- name: Check Python Version
174+
run: |
175+
which python
176+
python --version
177+
178+
- name: Build
179+
run: |
180+
autoreconf -vfi
181+
182+
mkdir _build && cd _build
183+
184+
../configure \
185+
--host=x86_64-w64-mingw32 \
186+
--build=x86_64-pc-linux-gnu \
187+
--enable-shared \
188+
--with-system-expat \
189+
--with-system-ffi \
190+
--with-system-libmpdec \
191+
--without-ensurepip \
192+
--enable-loadable-sqlite-extensions \
193+
--with-build-python=python3.11
194+
195+
make -j8
196+
197+
make install DESTDIR="$(pwd)/install"
198+
199+
- name: 'Zip files'
200+
run: |
201+
zip -r install.zip _build/install
202+
203+
- name: Upload
204+
uses: actions/upload-artifact@v3
205+
with:
206+
name: build-cross-gcc-x86_64
207+
path: install.zip
208+
209+
cross-gcc-x86_64-test:
210+
needs: [cross-gcc-x86_64]
211+
runs-on: windows-latest
212+
steps:
213+
- uses: actions/download-artifact@v3
214+
with:
215+
name: build-cross-gcc-x86_64
216+
217+
- name: 'Run tests'
218+
run: |
219+
7z x install.zip
220+
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())"
221+
222+
223+
cross-llvm-mingw:
224+
runs-on: ubuntu-latest
225+
container:
226+
image: mstorsjo/llvm-mingw:latest
227+
strategy:
228+
fail-fast: false
229+
matrix:
230+
arch: ['x86_64', 'i686', 'aarch64', 'armv7']
231+
steps:
232+
- uses: actions/checkout@v3
233+
234+
- name: Install deps
235+
run: |
236+
export DEBIAN_FRONTEND=noninteractive
237+
apt-get update -qq
238+
apt-get install -qqy software-properties-common
239+
add-apt-repository --yes ppa:deadsnakes/ppa
240+
apt-get update -qq
241+
apt-get install -qqy autoconf-archive python3.11-dev python3.11
242+
243+
- name: Build
244+
run: |
245+
autoreconf -vfi
246+
247+
mkdir _build && cd _build
248+
249+
export CC=${{ matrix.arch }}-w64-mingw32-clang
250+
export CXX=${CC}++
251+
../configure \
252+
--host=${{ matrix.arch }}-w64-mingw32 \
253+
--build=x86_64-pc-linux-gnu \
254+
--enable-shared \
255+
--with-system-expat \
256+
--with-system-ffi \
257+
--with-system-libmpdec \
258+
--without-ensurepip \
259+
--without-c-locale-coercion \
260+
--enable-loadable-sqlite-extensions \
261+
--with-build-python=python3.11
262+
263+
make -j8
264+
265+
make install DESTDIR="$(pwd)/install"
266+
267+
- name: 'Zip files'
268+
run: |
269+
zip -r install.zip _build/install
270+
271+
- name: Upload
272+
uses: actions/upload-artifact@v3
273+
with:
274+
name: build-cross-llvm-mingw-${{ matrix.arch }}
275+
path: install.zip
276+
277+
cross-llvm-mingw-test:
278+
needs: [cross-llvm-mingw]
279+
runs-on: windows-latest
280+
strategy:
281+
fail-fast: false
282+
matrix:
283+
arch: ['x86_64', 'i686']
284+
steps:
285+
- uses: actions/download-artifact@v3
286+
with:
287+
name: build-cross-llvm-mingw-${{ matrix.arch }}
288+
289+
- name: 'Run tests'
290+
run: |
291+
7z x install.zip
292+
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())"
293+
294+

mingw_ignorefile.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
ctypes.test.test_loading.LoaderTest.test_load_dll_with_flags
2+
distutils.tests.test_bdist_dumb.BuildDumbTestCase.test_simple_built
3+
distutils.tests.test_cygwinccompiler.CygwinCCompilerTestCase.test_get_versions
4+
distutils.tests.test_util.UtilTestCase.test_change_root
5+
test.datetimetester.TestLocalTimeDisambiguation_Fast.*
6+
test.datetimetester.TestLocalTimeDisambiguation_Pure.*
7+
test.test_cmath.CMathTests.test_specific_values
8+
test.test_cmd_line_script.CmdLineTest.test_consistent_sys_path_for_direct_execution
9+
test.test_compileall.CommandLineTestsNoSourceEpoch.*
10+
test.test_compileall.CommandLineTestsWithSourceEpoch.*
11+
test.test_compileall.CompileallTestsWithoutSourceEpoch.*
12+
test.test_compileall.CompileallTestsWithSourceEpoch.*
13+
test.test_import.ImportTests.test_dll_dependency_import
14+
test.test_math.MathTests.*
15+
test.test_ntpath.NtCommonTest.test_import
16+
test.test_os.StatAttributeTests.test_stat_block_device
17+
test.test_os.TestScandir.test_attributes
18+
test.test_os.UtimeTests.test_large_time
19+
test.test_platform.PlatformTest.test_architecture_via_symlink
20+
test.test_regrtest.ProgramsTestCase.test_pcbuild_rt
21+
test.test_regrtest.ProgramsTestCase.test_tools_buildbot_test
22+
test.test_site._pthFileTests.*
23+
test.test_site.HelperFunctionsTests.*
24+
test.test_site.StartupImportTests.*
25+
test.test_ssl.*
26+
test.test_strptime.CalculationTests.*
27+
test.test_strptime.StrptimeTests.test_weekday
28+
test.test_strptime.TimeRETests.test_compile
29+
test.test_tools.test_i18n.Test_pygettext.test_POT_Creation_Date
30+
test.test_venv.BasicTest.*
31+
test.test_venv.EnsurePipTest.*
32+
# flaky
33+
test.test__xxsubinterpreters.*
34+
test.test_asyncio.test_subprocess.SubprocessProactorTests.test_stdin_broken_pipe

0 commit comments

Comments
 (0)