Files

159 lines
4.9 KiB
YAML

name: macOS tests
on:
pull_request:
branches:
- main
- maintenance/**
paths-ignore:
- '**.pyi'
- '**.md'
- '**.rst'
- 'tools/stubtest/**'
permissions:
contents: read # to fetch code (actions/checkout)
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
aarch64_conda:
name: macOS aarch64 conda
# To enable this workflow on a fork, comment out:
if: github.repository == 'numpy/numpy'
runs-on: macos-26
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
fetch-tags: true
persist-credentials: false
- name: Prepare cache dirs and timestamps
id: prep-ccache
shell: bash -l {0}
run: |
mkdir -p "${CCACHE_DIR}"
echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
NOW=$(date -u +"%F-%T")
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Setup compiler cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache-ccache
with:
path: ${{ steps.prep-ccache.outputs.dir }}
key: ${{ github.workflow }}-${{ matrix.python-version }}-ccache-macos-${{ steps.prep-ccache.outputs.timestamp }}
restore-keys: |
${{ github.workflow }}-${{ matrix.python-version }}-ccache-macos-
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: true
activate-environment: numpy-dev
use-only-tar-bz2: false
miniforge-variant: Miniforge3
miniforge-version: latest
use-mamba: true
# Updates if `environment.yml` or the date changes. The latter is needed to
# ensure we re-solve once a day (since we don't lock versions). Could be
# replaced by a conda-lock based approach in the future.
- name: Cache conda environment
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 1
with:
path: ${{ env.CONDA }}/envs/numpy-dev
key:
${{ runner.os }}--${{ steps.prep-ccache.outputs.today }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
id: envcache
- name: Update Conda Environment
run: mamba env update -n numpy-dev -f environment.yml
if: steps.envcache.outputs.cache-hit != 'true'
- name: Build and Install NumPy
shell: bash -l {0}
run: |
conda activate numpy-dev
CC="ccache ${CC:-clang}" CXX="ccache ${CXX:-clang++}" spin build -j2 -- -Dallow-noblas=false
- name: Run test suite (full)
shell: bash -l {0}
run: |
conda activate numpy-dev
export OMP_NUM_THREADS=2
spin test -j2 -m full -- --durations=10
- name: Ccache statistics
shell: bash -l {0}
run: |
conda activate numpy-dev
ccache -s
accelerate:
name: Accelerate - ${{ matrix.build_runner[1] }} - ${{ matrix.version }}
# To enable this workflow on a fork, comment out:
if: github.repository == 'numpy/numpy'
runs-on: ${{ matrix.build_runner[0] }}
strategy:
fail-fast: false
matrix:
build_runner:
- [ macos-15-intel, "macos_x86_64" ]
- [ macos-15, "macos_arm64" ]
version: ["3.12", "3.15t"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
fetch-tags: true
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.version }}
- name: Install dependencies
run: |
pip install --group dev-cli --group test
- name: Build against Accelerate (LP64)
run: spin build -- -Ddisable-optimization=true -Dallow-noblas=false
- name: Test (linalg only)
run: spin test -j2 -- numpy/linalg --timeout=600 --durations=10
- name: Build NumPy against Accelerate (ILP64)
run: |
rm -r build build-install
spin build -- -Duse-ilp64=true -Ddisable-optimization=true -Dallow-noblas=false
- name: Test (fast tests)
if: ${{ matrix.version != '3.14t' || matrix.build_runner[0] != 'macos-15' }}
run: spin test -j2 -- --timeout=600 --durations=10
- name: Test in multiple threads
if: ${{ matrix.version == '3.14t' && matrix.build_runner[0] == 'macos-15' }}
run: |
pip install pytest-run-parallel==0.8.2
spin test -p 4 -- -sv --timeout=600 --durations=10