Skip to content

Fix download-artifact usage #24

Fix download-artifact usage

Fix download-artifact usage #24

Workflow file for this run

name: Cross-only compilation environment
concurrency:
group: nonative-${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- ci-cross
permissions:
contents: read
jobs:
cross_conda_aarch64_build:
name: Cross x86-64 to aarch64
if: "github.repository == 'rgommers/scipy' || github.repository == ''"
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: true
use-only-tar-bz2: false
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
auto-activate-base: true
activate-environment: ""
- name: Set up x86-64 build env (native)
run: |
mamba create -n build-env gxx_linux-aarch64 gfortran_linux-aarch64 python=3.12 meson-python build numpy pythran cython pkg-config pybind11
- name: Patch meson and meson-python
run: |
# We need some fixes that aren't yet merged, to ensure we get the right paths
python -m pip install git+https://github.com/rgommers/meson.git@cross-python-ext-suffix
# TODO: meson-python fix
- name: Set up aarch64 host env (cross)
run: |
CONDA_SUBDIR=linux-aarch64 mamba create -n host-env python=3.12 numpy openblas libstdcxx-ng libgfortran-ng
- name: Cross-compile SciPy
run: |
conda activate build-env
# We're cross-compiling, so unset these environment variables that the
# activate scripts define:
unset CFLAGS
unset CXXFLAGS
unset FFLAGS
unset LDFLAGS
# NOTE: without this export, I see:
# Determining dependency 'openblas' with pkg-config executable '/usr/share/miniconda3/envs/build-env/bin/pkg-config'
# env[PKG_CONFIG_PATH]:
# env[PKG_CONFIG_SYSROOT_DIR]: /usr/share/miniconda3/envs/host-env/
# env[PKG_CONFIG_LIBDIR]: /usr/share/miniconda3/envs/host-env/lib/pkgconfig
# Called `/usr/share/miniconda3/envs/build-env/bin/pkg-config --modversion openblas` -> 1
# stderr:
# Package openblas was not found in the pkg-config search path.
# Perhaps you should add the directory containing `openblas.pc'
# to the PKG_CONFIG_PATH environment variable
# No package 'openblas' found
# NOTE: the sys_root and pkg_config_libdir in the cross file (as per
# the Meson docs) are ineffective, both in CI and locally.
# In addition, using `sys_root` breaks including Python.h
export PKG_CONFIG_PATH=/usr/share/miniconda3/envs/host-env/lib/pkgconfig
# `-wnx` means: `--wheel --no-isolation --skip-dependency-check`
python -m build -wnx -Cbuild-dir=build -Csetup-args=--cross-file=$PWD/ci/cross_aarch64.ini
# meson-python doesn't yet know about cross builds, so we get a wheel
# with a `_x86_64` tag - fix that:
pushd dist
for f in *.whl; do mv "$f" "$(echo "$f" | sed s/x86_64/aarch64/)"; done
popd
# FIXME: Meson gets the extensions of the individual extension modules
# wrong and puts x86_64-linux-gnu.so in there. This needs fixing, it
# confuses `auditwheel` (it looks only at this file extension, not at
# dist-info/WHEEL nor at the contents of the extension modules to
# determine architecture (would be easy to do though with `file` or
# `readelf`). Issue: meson#7049. PR: meson#12190.
#
# FIXME: architecture in `dist-info/WHEEL` says:
# Tag: cp312-cp312-linux_x86_64
- name: auditwheel show
run: |
python -m pip install auditwheel
auditwheel show dist/*.whl
- name: Show meson-log.txt
if: always()
run: |
cat build/meson-logs/meson-log.txt
- uses: actions/upload-artifact@v4
with:
name: aarch64-wheel
path: dist
cross_conda_aarch64_test:
name: Test on aarch64 (QEMU)
needs: cross_conda_aarch64_build
if: "github.repository == 'rgommers/scipy' || github.repository == ''"
runs-on: ubuntu-22.04
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: actions/download-artifact@v4
with:
name: aarch64-wheel
path: dist
# TODO: run next steps in Docker container (a la cibuildwheel or numpy's `linux_qemu.yml`)
- name: Set up aarch64 host env (cross)
run: |
mamba create -n aarch64-native-env python=3.12 numpy openblas pytest hypothesis