makesetup: generalize the MINGW
case
#184
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
msystem: ['MINGW64','MINGW32','UCRT64','CLANG64','CLANG32'] | |
include: | |
- msystem: MINGW64 | |
prefix: mingw-w64-x86_64 | |
- msystem: MINGW32 | |
prefix: mingw-w64-i686 | |
- msystem: UCRT64 | |
prefix: mingw-w64-ucrt-x86_64 | |
- msystem: CLANG64 | |
prefix: mingw-w64-clang-x86_64 | |
- msystem: CLANG32 | |
prefix: mingw-w64-clang-i686 | |
steps: | |
- name: Setup git | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- uses: actions/checkout@v3 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.msystem }} | |
release: false | |
update: true | |
install: >- | |
make | |
binutils | |
autoconf | |
autoconf-archive | |
automake-wrapper | |
tar | |
gzip | |
${{ matrix.prefix }}-toolchain | |
${{ matrix.prefix }}-expat | |
${{ matrix.prefix }}-bzip2 | |
${{ matrix.prefix }}-libffi | |
${{ matrix.prefix }}-mpdecimal | |
${{ matrix.prefix }}-ncurses | |
${{ matrix.prefix }}-openssl | |
${{ matrix.prefix }}-sqlite3 | |
${{ matrix.prefix }}-tcl | |
${{ matrix.prefix }}-tk | |
${{ matrix.prefix }}-zlib | |
${{ matrix.prefix }}-xz | |
${{ matrix.prefix }}-tzdata | |
- name: Build Python | |
shell: msys2 {0} | |
run: | | |
set -ex | |
if [[ "${{ matrix.msystem }}" == "CLANG64" ]] || [[ "${{ matrix.msystem }}" == "CLANG32" ]]; then | |
export CC=clang | |
export CXX=clang++ | |
fi | |
autoreconf -vfi | |
rm -Rf _build && mkdir _build && cd _build | |
../configure \ | |
--prefix=${MINGW_PREFIX} \ | |
--host=${MINGW_CHOST} \ | |
--build=${MINGW_CHOST} \ | |
--enable-shared \ | |
--with-system-expat \ | |
--with-system-libmpdec \ | |
--without-ensurepip \ | |
--enable-loadable-sqlite-extensions \ | |
--with-tzpath=${MINGW_PREFIX}/share/zoneinfo \ | |
--enable-optimizations | |
make -j8 | |
- name: Run Smoke Test (build) | |
shell: msys2 {0} | |
run: | | |
SMOKETESTS="$(pwd)/mingw_smoketests.py" | |
cd _build | |
./python.exe "$SMOKETESTS" | |
MSYSTEM= ./python.exe "$SMOKETESTS" | |
- name: Run tests | |
shell: msys2 {0} | |
run: | | |
IGNOREFILE="$(pwd)/mingw_ignorefile.txt" | |
IGNOREFILE_EXTRA="$IGNOREFILE" | |
if [[ "${{ matrix.msystem }}" == "MINGW32" ]] || [[ "${{ matrix.msystem }}" == "MINGW64" ]]; then | |
IGNOREFILE_EXTRA="$(pwd)/mingw_ignorefile_msvcrt.txt" | |
fi | |
cd _build | |
MSYSTEM= ./python.exe -m test -j8 --ignorefile "$IGNOREFILE" --ignorefile "$IGNOREFILE_EXTRA" -W | |
- name: Run broken tests | |
continue-on-error: true | |
shell: msys2 {0} | |
run: | | |
IGNOREFILE="$(pwd)/mingw_ignorefile.txt" | |
IGNOREFILE_EXTRA="$IGNOREFILE" | |
if [[ "${{ matrix.msystem }}" == "MINGW32" ]] || [[ "${{ matrix.msystem }}" == "MINGW64" ]]; then | |
IGNOREFILE_EXTRA="$(pwd)/mingw_ignorefile_msvcrt.txt" | |
fi | |
cd _build | |
MSYSTEM= ./python.exe -m test -j8 --matchfile "$IGNOREFILE" --matchfile "$IGNOREFILE_EXTRA" -W | |
- name: Install | |
shell: msys2 {0} | |
run: | | |
set -ex | |
cd _build | |
pkgdir=python_pkgdir | |
make -j1 install DESTDIR="${pkgdir}" | |
# Fix shebangs | |
_pybasever=$(./python.exe -c "import sys; print(f'{sys.version_info[0]}.{sys.version_info[1]}');") | |
for fscripts in 2to3 2to3-${_pybasever} idle3 idle${_pybasever} pydoc3 pydoc${_pybasever}; do | |
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} | |
done | |
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 | |
# Create version-less aliases | |
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3.exe "${pkgdir}${MINGW_PREFIX}"/bin/python.exe | |
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3w.exe "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe | |
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3-config "${pkgdir}${MINGW_PREFIX}"/bin/python-config | |
cp "${pkgdir}${MINGW_PREFIX}"/bin/idle3 "${pkgdir}${MINGW_PREFIX}"/bin/idle | |
cp "${pkgdir}${MINGW_PREFIX}"/bin/pydoc3 "${pkgdir}${MINGW_PREFIX}"/bin/pydoc | |
# copy to / | |
cp -rf "${pkgdir}"/* / | |
- name: Run Smoke Test (installed) | |
shell: msys2 {0} | |
run: | | |
SMOKETESTS="$(pwd)/mingw_smoketests.py" | |
${MINGW_PREFIX}/bin/python.exe "$SMOKETESTS" | |
MSYSTEM= ${MINGW_PREFIX}/bin/python.exe "$SMOKETESTS" | |
- name: Compress | |
if: always() | |
shell: msys2 {0} | |
run: | | |
cd _build | |
tar -zcf python.tar.gz python_pkgdir/ | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: build-${{ matrix.msystem }} | |
path: _build/python.tar.gz | |
cross-gcc-x86_64: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:base-devel | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: | | |
pacman --noconfirm -Suuy | |
pacman --needed --noconfirm -S mingw-w64-gcc autoconf-archive autoconf automake zip | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Check Python Version | |
run: | | |
which python | |
python --version | |
- name: Build | |
run: | | |
autoreconf -vfi | |
mkdir _build && cd _build | |
../configure \ | |
--host=x86_64-w64-mingw32 \ | |
--build=x86_64-pc-linux-gnu \ | |
--enable-shared \ | |
--with-system-expat \ | |
--with-system-ffi \ | |
--with-system-libmpdec \ | |
--without-ensurepip \ | |
--enable-loadable-sqlite-extensions \ | |
--with-build-python=yes | |
make -j8 | |
make install DESTDIR="$(pwd)/install" | |
- name: 'Zip files' | |
run: | | |
zip -r install.zip _build/install | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-cross-gcc-x86_64 | |
path: install.zip | |
cross-gcc-x86_64-test: | |
needs: [cross-gcc-x86_64] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-cross-gcc-x86_64 | |
- name: 'Run tests' | |
run: | | |
7z x install.zip | |
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())" | |
cross-llvm-mingw: | |
runs-on: ubuntu-latest | |
container: | |
image: mstorsjo/llvm-mingw:latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: ['x86_64', 'i686', 'aarch64', 'armv7'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update -qq | |
apt-get install -qqy software-properties-common | |
add-apt-repository --yes ppa:deadsnakes/ppa | |
apt-get update -qq | |
apt-get install -qqy autoconf-archive python3.12-dev python3.12 | |
- name: Build | |
run: | | |
autoreconf -vfi | |
mkdir _build && cd _build | |
export CC=${{ matrix.arch }}-w64-mingw32-clang | |
export CXX=${CC}++ | |
../configure \ | |
--host=${{ matrix.arch }}-w64-mingw32 \ | |
--build=x86_64-pc-linux-gnu \ | |
--enable-shared \ | |
--without-ensurepip \ | |
--without-c-locale-coercion \ | |
--enable-loadable-sqlite-extensions \ | |
--with-build-python=yes | |
make -j8 | |
make install DESTDIR="$(pwd)/install" | |
- name: 'Zip files' | |
run: | | |
zip -r install.zip _build/install | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-cross-llvm-mingw-${{ matrix.arch }} | |
path: install.zip | |
cross-llvm-mingw-test: | |
needs: [cross-llvm-mingw] | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: ['x86_64', 'i686'] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-cross-llvm-mingw-${{ matrix.arch }} | |
- name: 'Run tests' | |
run: | | |
7z x install.zip | |
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())" | |