Skip to content

add working simplex solver #84

add working simplex solver

add working simplex solver #84

Workflow file for this run

name: Build and Release
on:
push:
branches: ["*"]
tags: ["v*"]
jobs:
build-wheel:
name: Build wheels on ${{ matrix.os }}
strategy:
matrix:
buildplat:
- [ubuntu-latest, manylinux_x86_64]
- [macos-14, macosx_arm64]
# - [macos-13, macosx_x86_64]
python:
- ["cp310", "3.10"]
- ["cp311", "3.11"]
- ["cp312", "3.12"]
runs-on: ${{ matrix.buildplat[0] }}
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
- name: Setup micromamba
uses: mamba-org/[email protected]
with:
environment-name: pyensmallen
create-args: armadillo ensmallen
init-shell: bash
generate-run-shell: true
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD: |
export PKG_CONFIG_PATH="/Users/runner/micromamba/envs/pyensmallen/lib/pkgconfig:$PKG_CONFIG_PATH"
export CMAKE_PREFIX_PATH="/Users/runner/micromamba/envs/pyensmallen"
ls -la /Users/runner/micromamba/envs/pyensmallen/lib/pkgconfig || echo "pkgconfig dir not found"
python -m pip install -v build
python -c "import os; print('Environment:', os.environ)"
CIBW_ENVIRONMENT_LINUX: >-
MAMBA_ROOT_PREFIX="/host/home/runner/micromamba"
CMAKE_PREFIX_PATH="/host/home/runner/micromamba/envs/pyensmallen"
VERBOSE=1
CIBW_ENVIRONMENT_MACOS: >-
PKG_CONFIG_PATH="/Users/runner/micromamba/envs/pyensmallen/lib/pkgconfig"
CMAKE_PREFIX_PATH="/Users/runner/micromamba/envs/pyensmallen"
VERBOSE=1
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
CIBW_BUILD_VERBOSITY: 3
continue-on-error: true # Let it complete even if there's an error
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: cibuildwheel-logs
path: |
~/.local/share/cibuildwheel/**/*.log
/tmp/cibw*/**/*.log
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
path: wheelhouse/*.whl
build-sdist:
name: Build source distribution
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake libarmadillo-dev libensmallen-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools build meson meson-python pybind11
- name: Build sdist
run: python -m build --sdist --outdir wheelhouse/
- uses: actions/upload-artifact@v3
with:
name: sdist
path: ./wheelhouse/*.tar.gz
publish-to-pypi:
name: Publish Python distribution to PyPI
needs: [build-wheel, build-sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/pyensmallen
permissions:
id-token: write
steps:
# Download all artifacts to a consolidated directory
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
# Move everything from wheelhouse to dist if they exist in separate dirs
- name: Consolidate distribution files
run: |
mkdir -p dist
if [ -d "dist/wheelhouse" ]; then
mv dist/wheelhouse/* dist/
rm -rf dist/wheelhouse
fi
ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
verbose: true
upload_release:
needs: [build-wheel, build-sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4 # Updated to v4
with:
path: ./wheelhouse
merge-multiple: true # Downloads all artifacts
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub
- name: Create Release and Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python - <<EOF
import os
from github import Github
g = Github(os.environ['GITHUB_TOKEN'])
repo = g.get_repo(os.environ['GITHUB_REPOSITORY'])
tag_name = os.environ['GITHUB_REF'].split('/')[-1]
release = repo.create_git_release(tag_name, f"Release {tag_name}", f"Release {tag_name}")
for asset in os.listdir('./wheelhouse'):
release.upload_asset(f"./wheelhouse/{asset}")
print("Release created and assets uploaded successfully")
EOF