update build action #110
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 PYPI wheels for pyshtools | |
on: [repository_dispatch, push, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
permissions: | |
id-token: write | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest, macos-latest] | |
include: | |
- os: macos-latest | |
platform: universal2 | |
- os: ubuntu-latest | |
platform: x86_64 | |
env: | |
REPO_DIR: SHTOOLS | |
BUILD_COMMIT: master | |
PROJECT_SPEC: pyshtools | |
UNICODE_WIDTH: 32 | |
MB_PYTHON_VERSION: ${{ matrix.python-version }} | |
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} | |
MB_ML_VER: 2014 | |
NP_BUILD_DEP: numpy | |
NP_TEST_DEP: numpy | |
TRAVIS_BUILD_DIR: ${{ github.workspace }} | |
PLAT: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Update submodules | |
run: | | |
git submodule update --remote | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Environment variables | |
run: | | |
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $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 "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV; | |
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; | |
- name: Build and Install Wheels | |
run: | | |
python -m pip install --upgrade pip | |
pip install virtualenv | |
pip install jupyter | |
pip install twine | |
source multibuild/common_utils.sh | |
source multibuild/travis_steps.sh | |
before_install | |
build_index_wheel $PROJECT_SPEC # download source from pypi | |
# build_wheel $REPO_DIR $PLAT # versioneer does not work with submodules | |
install_run $PLAT | |
- name: Upload release to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: ${TRAVIS_BUILD_DIR}/wheelhouse/ | |
skip-existing: true |