Skip to content

Commit

Permalink
Begin packaging effort
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Dec 31, 2024
1 parent f47735c commit d9665c5
Show file tree
Hide file tree
Showing 9 changed files with 583 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
112 changes: 112 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Deploy tagged releases.

name: Deploy Release

on:
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}

jobs:
build_wheels:
name: Build wheel for cp${{ matrix.python }}-${{ matrix.builder }}_${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails. Useful for
# debugging multiple problems in parallel.
fail-fast: false
matrix:
include:
# Linux 64 bit manylinux
- os: ubuntu-latest
arch: x86_64
python: 39
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 310
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 311
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 312
builder: manylinux

# MacOS x86_64. The macos-13 runner is the last
# Intel-based runner version. At some point we'll
# need to switch to macos-latest and test cross compiling.
- os: macos-13
arch: x86_64
python: 310
builder: macosx
deploy: 13.0
- os: macos-13
arch: x86_64
python: 311
builder: macosx
deploy: 13.0
- os: macos-13
arch: x86_64
python: 312
builder: macosx
deploy: 13.0

# MacOS arm64
- os: macos-latest
arch: arm64
python: 310
builder: macosx
deploy: 14.0
- os: macos-latest
arch: arm64
python: 311
builder: macosx
deploy: 14.0
- os: macos-latest
arch: arm64
python: 312
builder: macosx
deploy: 14.0
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.builder }}_${{ matrix.arch }}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.builder }}2014
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.builder }}2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX:
CIBW_ENVIRONMENT_MACOS: >
MACOSX_DEPLOYMENT_TARGET=${{ matrix.deploy }}
CIBW_BEFORE_BUILD_LINUX: ./packaging/wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./packaging/wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: export OMP_NUM_THREADS=1
CIBW_TEST_COMMAND: python3 -c 'import flacarray.tests; flacarray.tests.run()'
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'

- name: Install cibuildwheel
run: |
python -m pip install twine cibuildwheel==2.20.0
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload to PyPI
run: |
python -m twine upload wheelhouse/flacarray*cp${{ matrix.python }}-${{ matrix.builder }}*${{ matrix.arch }}*.whl
106 changes: 106 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# In general, we try to run on:
# - The oldest supported python
# - The latest stable python that is the common default on most systems and conda
# - (During transitions) The newly released bleeding edge python

name: Run Test Suite

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Tests on ${{ matrix.arch }} with Conda Python-${{ matrix.python }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python: "3.9"
arch: Linux-x86_64
ompdisable: 0
- os: ubuntu-latest
python: "3.10"
arch: Linux-x86_64
ompdisable: 0
- os: ubuntu-latest
python: "3.12"
arch: Linux-x86_64
ompdisable: 0
- os: macos-latest
python: "3.10"
arch: MacOSX-x86_64
ompdisable: 1
- os: macos-latest
python: "3.12"
arch: MacOSX-x86_64
ompdisable: 1
- os: macos-latest
python: "3.10"
arch: MacOSX-arm64
ompdisable: 1
- os: macos-latest
python: "3.12"
arch: MacOSX-arm64
ompdisable: 1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Conda Base
run: |
sudo rm -rf /usr/share/miniconda \
&& sudo rm -rf /usr/local/miniconda \
&& curl -SL -o miniforge.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-${{ matrix.arch }}.sh \
&& bash miniforge.sh -b -f -p ~/conda \
&& source ~/conda/etc/profile.d/conda.sh \
&& conda activate base \
&& conda update -n base --yes conda
- name: Check Conda Config
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate base \
&& conda info \
&& conda list \
&& conda config --show-sources \
&& conda config --show
- name: Install Dependencies
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate base \
&& conda install --file packaging/conda_build_requirements.txt
- name: Install
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate base \
&& pip install .
- name: Run Serial Tests
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate base \
&& export OMP_NUM_THREADS=2 \
&& python3 -c 'import flacarray.tests; flacarray.tests.run()'
- name: Run MPI Tests
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate base \
&& export OMP_NUM_THREADS=1 \
&& mpirun -np 2 python -c 'import flacarray.tests; flacarray.tests.run()'
108 changes: 108 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@

name: Test Binary Wheels

on: workflow_dispatch

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels:
name: Build wheel for cp${{ matrix.python }}-${{ matrix.builder }}_${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails. Useful for
# debugging multiple problems in parallel.
fail-fast: false
matrix:
include:
# Linux 64 bit manylinux
- os: ubuntu-latest
arch: x86_64
python: 39
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 310
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 311
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 312
builder: manylinux

# MacOS x86_64. The macos-13 runner is the last
# Intel-based runner version. At some point we'll
# need to switch to macos-latest and test cross compiling.
- os: macos-13
arch: x86_64
python: 310
builder: macosx
deploy: 13.0
- os: macos-13
arch: x86_64
python: 311
builder: macosx
deploy: 13.0
- os: macos-13
arch: x86_64
python: 312
builder: macosx
deploy: 13.0

# MacOS arm64
- os: macos-latest
arch: arm64
python: 310
builder: macosx
deploy: 14.0
- os: macos-latest
arch: arm64
python: 311
builder: macosx
deploy: 14.0
- os: macos-latest
arch: arm64
python: 312
builder: macosx
deploy: 14.0
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.builder }}_${{ matrix.arch }}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.builder }}2014
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.builder }}2014
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX:
CIBW_ENVIRONMENT_MACOS: >
MACOSX_DEPLOYMENT_TARGET=${{ matrix.deploy }}
CIBW_BEFORE_BUILD_LINUX: ./packaging/wheels/install_deps_linux.sh
CIBW_BEFORE_BUILD_MACOS: ./packaging/wheels/install_deps_osx.sh
CIBW_BEFORE_TEST: export OMP_NUM_THREADS=2
CIBW_TEST_COMMAND_LINUX: >
python -c 'import flacarray.tests; flacarray.tests.run()'
CIBW_TEST_COMMAND_MACOS: >
python -c 'import flacarray.tests; flacarray.tests.run()'
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.20.0
- name: Build wheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: wheels_cp${{ matrix.python }}-${{ matrix.builder }}_${{ matrix.arch }}
path: ./wheelhouse/flacarray*cp${{ matrix.python }}-${{ matrix.builder }}*${{ matrix.arch }}*.whl
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down
8 changes: 8 additions & 0 deletions packaging/conda_build_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
c_compiler
cmake
cython
meson
meson-python
libflac
h5py
zarr
7 changes: 7 additions & 0 deletions packaging/pip_build_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake
cython
meson
meson-python
libflac
h5py
zarr
Loading

0 comments on commit d9665c5

Please sign in to comment.