Skip to content

use macos-13 for x86_64, macos-lates for arm64 #198

use macos-13 for x86_64, macos-lates for arm64

use macos-13 for x86_64, macos-lates for arm64 #198

# This workflow will install Python dependencies, run tests and build
# manylinux wheels for a variety of python versions and architectures.
name: Build and upload linux wheels
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
create:
tags:
# schedule:
# - cron: '0 0 * * 0,3' # 2/weekly
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
#python-version: [ "3.11"]
#os: [ubuntu-latest]
#platform: [x64]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
#python-version: [ "3.12" ]
os: [ubuntu-latest]
platform: [x64, x32]
include:
- python-version: "3.8"
os: ubuntu-latest
platform: aarch64
- python-version: "3.9"
os: ubuntu-latest
platform: aarch64
- python-version: "3.10"
os: ubuntu-latest
platform: aarch64
- python-version: "3.11"
os: ubuntu-latest
platform: aarch64
- python-version: "3.12"
os: ubuntu-latest
platform: aarch64
env:
REPO_DIR: netcdf4-python
PKG_NAME: netcdf4-python
MB_ML_VER: 2014
BUILD_COMMIT: v1.7.0rel
UNICODE_WIDTH: 32
MB_PYTHON_VERSION: ${{ matrix.python-version }}
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_BRANCH: ${{ github.head_ref }}
TRAVIS_PULL_REQUEST: ${{ github.event.number }}
TRAVIS_BUILD_DIR: ${{ github.workspace }}
MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup QEMU
if: ${{ matrix.platform == 'aarch64' }}
uses: docker/setup-qemu-action@v3
- name: Setup Environment variables
run: |
if [ "schedule" == "${{ github.event_name }}" ] || [ "master" == "$BUILD_COMMIT" ]; then echo "TOKEN=$SCIPY_WHEELS_NIGHTLY_ACCESS" >> $GITHUB_ENV; else echo "TOKEN=$MULTIBUILD_WHEELS_STAGING_ACCESS" >> $GITHUB_ENV; fi
if [ "x32" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; elif [ "aarch64" == "${{ matrix.platform }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; else echo "PLAT=x86_64" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
#echo "NETCDF_PLUGIN_DIR=/usr/local/hdf5/lib/plugin" >> $GITHUB_ENV
- name: Setup Special Environment variables for Linux AArch64
if: ${{ matrix.platform == 'aarch64' }}
run: |
echo "DOCKER_TEST_IMAGE=$(echo multibuild/focal_arm64v8)" >> $GITHUB_ENV
- name: Pin Numpy version
run: |
if [ "$MB_PYTHON_VERSION" == '3.6' ]; then
echo "NP_DEP=$(echo numpy==1.17.3)" >> $GITHUB_ENV;
elif [ "$MB_PYTHON_VERSION" == '3.7' ]; then
echo "NP_DEP=$(echo numpy==1.17.3)" >> $GITHUB_ENV;
else
echo "NP_DEP=$(echo oldest-supported-numpy)" >> $GITHUB_ENV;
fi
- name: Print some Environment variable
run: |
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}"
echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}"
echo "TRAVIS_EVENT_TYPE: ${TRAVIS_EVENT_TYPE}"
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
echo "PLAT: ${PLAT}"
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
- name: Install VirtualEnv
run: |
python -m pip install --upgrade pip
pip install virtualenv
- name: Build and Install Wheels
run: |
BUILD_DEPENDS="$NP_DEP cython setuptools"
TEST_DEPENDS="$NP_DEP nose cython"
source multibuild/common_utils.sh
source multibuild/travis_steps.sh
echo "------- BEFORE INSTALL --------"
before_install
echo "------- CLEAN CODE --------"
clean_code $REPO_DIR $BUILD_COMMIT
echo "------- BUILD WHEEL --------"
build_wheel $REPO_DIR $PLAT
echo "------- INSTALL_RUN --------"
echo "check wheel"
ls -l ${{ github.workspace }}/wheelhouse
unzip -l ${{ github.workspace }}/wheelhouse/netCDF4*whl
install_run $PLAT
- name: Upload wheels to release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'create'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/wheelhouse/netCDF4*whl
tag: ${{ github.ref }}
overwrite: true
file_glob: true