Skip to content

Commit

Permalink
testing ui
Browse files Browse the repository at this point in the history
  • Loading branch information
SwayamInSync committed Sep 16, 2024
1 parent ac51015 commit ef28753
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 311 deletions.
246 changes: 52 additions & 194 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,243 +3,110 @@ name: Build Wheels
on:
push:
branches:
- main
- quaddtype-packaging
tags:
- "v*"
- 'v*'
pull_request:

jobs:
build_wheels_linux:
name: Build wheels on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ">=3.10.0"

- name: Install cibuildwheel
run: pip install cibuildwheel==2.20.0

- name: Build wheels
env:
CIBW_BUILD: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD_VERBOSITY: "3"
CIBW_BEFORE_ALL: |
yum install -y wget
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p /root/miniconda
export PATH="/root/miniconda/bin:$PATH"
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda info -a
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -n build_env python=3.10
source activate build_env
conda install -y sleef
CIBW_ENVIRONMENT: >
LD_LIBRARY_PATH="/root/miniconda/envs/build_env/lib:$LD_LIBRARY_PATH"
LIBRARY_PATH="/root/miniconda/envs/build_env/lib:$LIBRARY_PATH"
CFLAGS="-I/root/miniconda/envs/build_env/include $CFLAGS"
CXXFLAGS="-I/root/miniconda/envs/build_env/include $CXXFLAGS"
LDFLAGS="-L/root/miniconda/envs/build_env/lib $LDFLAGS"
SLEEF_PATH="/root/miniconda/envs/build_env"
CIBW_REPAIR_WHEEL_COMMAND: >
auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel}
CIBW_TEST_COMMAND: |
python -c "import os; print('SLEEF_PATH:', os.environ.get('SLEEF_PATH', 'Not set'))"
python -c "import platform; print('Python version:', platform.python_version())"
python -c "import sys; print('sys.platform:', sys.platform)"
python -c "import quaddtype; print('quaddtype imported successfully')"
pip install {package}[test]
pytest {project}/tests
CIBW_TEST_EXTRAS: "test"
run: |
python -m cibuildwheel --output-dir wheelhouse
working-directory: ./quaddtype

- uses: actions/upload-artifact@v3
with:
path: ./quaddtype/wheelhouse/*.whl
name: wheels-linux

build_wheels_macos:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, macos-14]
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
include:
- os: ubuntu-latest
cibw_archs: 'x86_64'
- os: macos-13
cibw_archs: 'x86_64'
- os: macos-14
cibw_archs: 'arm64'
- os: windows-latest
cibw_archs: 'AMD64'

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ">=3.10.0"
python-version: '3.10'

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.10"
python-version: '3.10'
channels: conda-forge

- name: Install SLEEF
shell: bash -l {0}
run: |
conda install -y -c conda-forge sleef
echo $CONDA_PREFIX
echo "SLEEF_PATH=$CONDA_PREFIX" >> $GITHUB_ENV
- name: Install cibuildwheel
run: pip install cibuildwheel==2.20.0

- name: Build wheels
env:
CIBW_BUILD_VERBOSITY: "1"
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-* cp313-*"
CIBW_ENVIRONMENT: >
SLEEF_PATH="${{ env.SLEEF_PATH }}"
DYLD_LIBRARY_PATH="${{ env.SLEEF_PATH }}/lib:$DYLD_LIBRARY_PATH"
LIBRARY_PATH="${{ env.SLEEF_PATH }}/lib:$LIBRARY_PATH"
CFLAGS="-I${{ env.SLEEF_PATH }}/include $CFLAGS"
CXXFLAGS="-I${{ env.SLEEF_PATH }}/include $CXXFLAGS"
LDFLAGS="-L${{ env.SLEEF_PATH }}/lib $LDFLAGS"
MACOSX_DEPLOYMENT_TARGET="10.13"
CIBW_REPAIR_WHEEL_COMMAND: "delocate-wheel -w {dest_dir} -v {wheel}"
CIBW_TEST_COMMAND: |
python -c "import os; print('SLEEF_PATH:', os.environ.get('SLEEF_PATH', 'Not set'))"
python -c "import platform; print('Python version:', platform.python_version())"
python -c "import sys; print('sys.platform:', sys.platform)"
python -c "import quaddtype; print('quaddtype imported successfully')"
pip install {package}[test]
pytest {project}/tests
CIBW_TEST_EXTRAS: "test"
run: |
echo "SLEEF_PATH: $SLEEF_PATH"
ls $SLEEF_PATH/include/sleef*
echo "PATH: $PATH"
which python
python --version
which pip
pip --version
cd quaddtype
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
path: ./quaddtype/wheelhouse/*.whl
name: wheels-${{ matrix.os }}

build_wheels_windows:
name: Build wheels on Windows
runs-on: windows-latest
strategy:
matrix:
architecture: [x64]

steps:
- uses: actions/checkout@v3

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.architecture }}

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: ${{ matrix.architecture }}

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.10"
architecture: ${{ matrix.architecture }}

- name: Install SLEEF and other dependencies
shell: bash -l {0}
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install -y sleef numpy
conda list
if [ ! -f "$CONDA_PREFIX/Library/include/sleef.h" ]; then
if [ ! -f "$CONDA_PREFIX/include/sleef.h" ] && [ ! -f "$CONDA_PREFIX/Library/include/sleef.h" ]; then
echo "sleef.h not found. Installation may have failed."
exit 1
fi
ls -l "$CONDA_PREFIX/Library/include/sleef.h"
ls -l "$CONDA_PREFIX/Library/lib/sleef"*
- name: Set environment variables
shell: pwsh
run: |
echo "CONDA_PREFIX=$env:CONDA_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$numpy_path = python -c "import numpy; import os; print(os.path.abspath(numpy.get_include()).replace(os.sep, '/'))"
echo "NUMPY_INCLUDE_DIR=$numpy_path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install build dependencies
shell: bash -l {0}
run: |
pip install -U pip
pip install cibuildwheel==2.20.0 ninja meson meson-python numpy delvewheel pytest
if [ "${{ runner.os }}" == "Windows" ]; then
echo "SLEEF_PATH=$CONDA_PREFIX/Library" >> $GITHUB_ENV
echo "NUMPY_INCLUDE_DIR=$(python -c "import numpy; import os; print(os.path.abspath(numpy.get_include()).replace(os.sep, '/'))")" >> $GITHUB_ENV
else
echo "SLEEF_PATH=$CONDA_PREFIX" >> $GITHUB_ENV
fi
- name: Install cibuildwheel
run: pip install cibuildwheel==2.20.0

- name: Build wheels
env:
CONDA_PREFIX: ${{ env.CONDA_PREFIX }}
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-* cp313-*"
CIBW_ARCHS_WINDOWS: ${{ matrix.architecture == 'x86' && 'x86' || 'AMD64' }}
CIBW_BUILD_VERBOSITY: "1"
SLEEF_INCLUDE_DIR: ${{ env.CONDA_PREFIX }}\Library\include
SLEEF_LIBRARY: ${{ env.CONDA_PREFIX }}\Library\lib
DISTUTILS_USE_SDK: "1"
MSSdk: "1"
NUMPY_INCLUDE_DIR: ${{ env.NUMPY_INCLUDE_DIR }}
CIBW_BUILD: 'cp310-* cp311-* cp312-*'
CIBW_SKIP: 'pp* *-win32 *-manylinux_i686'
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_BUILD_VERBOSITY: '1'
CIBW_ENVIRONMENT: >-
SLEEF_PATH="${{ env.SLEEF_PATH }}"
NUMPY_INCLUDE_DIR="${{ env.NUMPY_INCLUDE_DIR }}"
SLEEF_INCLUDE_DIR="${{ env.CONDA_PREFIX }}/Library/include"
SLEEF_LIBRARY="${{ env.CONDA_PREFIX }}/Library/lib"
CIBW_BEFORE_BUILD: pip install meson meson-python ninja numpy
CIBW_REPAIR_WHEEL_COMMAND: "delvewheel repair -w {dest_dir} {wheel}"
PATH="${{ env.SLEEF_PATH }}/bin:$PATH"
${{ runner.os == 'Windows' && 'DISTUTILS_USE_SDK=1 MSSdk=1' || '' }}
CIBW_BEFORE_BUILD: >-
pip install -U pip &&
pip install meson meson-python ninja numpy
CIBW_REPAIR_WHEEL_COMMAND: >-
${{ runner.os == 'Windows' && 'delvewheel repair -w {dest_dir} {wheel}' ||
runner.os == 'macOS' && 'delocate-wheel -w {dest_dir} -v {wheel}' ||
'auditwheel repair -w {dest_dir} {wheel}' }}
CIBW_TEST_COMMAND: |
python -c "import platform; print('Python version:', platform.python_version())"
python -c "import sys; print('sys.platform:', sys.platform)"
python -c "import quaddtype; print('quaddtype imported successfully')"
python -c "import os, platform, sys, quaddtype; print(f'Python {platform.python_version()} on {sys.platform}')"
pip install {package}[test]
pytest {project}\tests -v || (echo "Tests failed" && exit 1)
CIBW_TEST_EXTRAS: "test"
pytest {project}/tests -v
CIBW_TEST_EXTRAS: 'test'
CIBW_TEST_FAIL_FAST: 1
shell: pwsh
run: |
python -m cibuildwheel --output-dir wheelhouse
if (-not (Test-Path wheelhouse/*.whl)) { throw "Wheel was not created" }
run: python -m cibuildwheel --output-dir wheelhouse
working-directory: ./quaddtype

- uses: actions/upload-artifact@v3
with:
path: ./quaddtype/wheelhouse/*.whl
name: wheels-windows-${{ matrix.architecture }}
name: wheels-${{ matrix.os }}

publish_to_testpypi:
name: Publish to TestPyPI
needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows]
needs: [build_wheels]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- uses: actions/download-artifact@v2
with:
path: dist
- name: Publish to TestPyPI
uses: pypa/[email protected]
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Expand All @@ -248,32 +115,23 @@ jobs:

create_release:
name: Create Release
needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows]
needs: [build_wheels]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
path: artifacts

- name: Create Release
id: create_release
uses: actions/create-release@v1
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Assets
uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./artifacts/**/*.whl
Expand Down
Loading

0 comments on commit ef28753

Please sign in to comment.