Skip to content

manual _build

manual _build #16

name: Build wheel and sdist for a non-pure Python package
on:
push:
jobs:
# build_sdist:
# defaults:
# run:
# shell: bash -l {0}
# name: Build pyobjcryst sdist
# runs-on: ubuntu-latest
# steps:
# - name: Check out pyobjcryst
# uses: actions/checkout@v4
# - name: Initialize miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# activate-environment: sdist
# channels: conda-forge
# auto-update-conda: true
# auto-activate-base: false
# python-version: 3.13
# - name: Conda config
# run: >-
# conda config --set always_yes yes
# --set changeps1 no
# - name: Build sdist
# run: |
# pip install --upgrade build
# python -m build --sdist
# - uses: actions/upload-artifact@v4
# with:
# name: cibw-sdist
# path: ./dist/*.tar.gz
build-wheels:
# needs: [build_sdist]
defaults:
run:
shell: bash -l {0}
name: cibw-wheels-${{ matrix.python[0] }}-${{ matrix.buildplat[0] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux_x86_64]
# - [macos-13, macosx_x86_64]
# - [macos-14, macosx_arm64]
# - [windows-latest, win_amd64]
python:
- ["3.11", "cp311"]
# - ["3.12", "cp312"]
# - ["3.13", "cp313"]
steps:
- name: Check out pyobjcryst
uses: actions/checkout@v4
# - name: Get sdist for CIBW
# uses: actions/download-artifact@v4
# with:
# name: cibw-sdist
# path: dist/
# - name: Initialize miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# activate-environment: build
# channels: conda-forge
# auto-update-conda: true
# auto-activate-base: false
# - name: Conda config
# run: >-
# conda config --set always_yes yes
# --set changeps1 no
# - name: Install pyobjcryst and requirements
# run: |
# conda install --file requirements/conda.txt
# conda install --file requirements/build.txt
- name: Build wheels from sdist
uses: pypa/cibuildwheel@v2.21.1
env:
PIP_NO_BUILD_ISOLATION: "1"
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"
CIBW_BUILD_VERBOSITY: "2"
CIBW_DEBUG_TRACEBACK: "1" # print the full Python traceback on error
CIBW_DEBUG_KEEP_CONTAINER: "1"
CIBW_BUILD: ${{ matrix.python[1] }}-${{ matrix.buildplat[1] }}
CIBW_BEFORE_BUILD: |
curl -sSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
-o miniconda.sh
bash miniconda.sh -b -p "$HOME/miniconda"
export PATH="$HOME/miniconda/bin:$PATH"
. "$HOME/miniconda/etc/profile.d/conda.sh"
conda config --set always_yes yes
conda config --set changeps1 no
conda config --set auto_update_conda true
conda config --set auto_activate_base false
conda create -n build -y --override-channels -c conda-forge \
python=${{ matrix.python[0] }}
conda activate build
conda install -n build -y --override-channels -c conda-forge \
--file requirements/conda.txt
conda install -n build -y --override-channels -c conda-forge \
--file requirements/build.txt
echo "Using CONDA_PREFIX=$CONDA_PREFIX"
python -m pip wheel --no-build-isolation --wheel-dir ./dist .
with:
output-dir: dist
- name: Upload wheels to GitHub
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[0] }}.whl
path: ./dist/*.whl
# test-wheels:
# needs: [build-wheels]
# defaults:
# run:
# shell: bash -l {0}
# name: test-wheels-${{ matrix.python }}-${{ matrix.buildplat }}
# runs-on: ${{ matrix.buildplat }}
# strategy:
# fail-fast: false
# matrix:
# buildplat:
# - ubuntu-latest
# - macos-13
# - macos-14
# - windows-latest
# python:
# - "3.11"
# - "3.12"
# - "3.13"
# steps:
# - name: Check out pyobjcryst
# uses: actions/checkout@v4
# - name: Download wheels
# uses: actions/download-artifact@v4
# with:
# name: ${{ matrix.python }}-${{ matrix.buildplat }}.whl
# path: ./dist
# - name: Initialize miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# activate-environment: test
# channels: conda-forge
# auto-update-conda: true
# auto-activate-base: false
# python-version: ${{ matrix.python }}
# - name: Conda config
# run: >-
# conda config --set always_yes yes
# --set changeps1 no
# - name: Install pyobjcryst and requirements
# run: |
# conda install --file requirements/conda.txt
# conda install --file requirements/test.txt
# - name: Install wheel and test
# run: |
# pip install ./dist/*.whl
# pytest