Skip to content

Commit

Permalink
Distribute CLI in a Python package (#266)
Browse files Browse the repository at this point in the history
* Add nix files

* Add maturin, update nixos distribution

* Add lhapdf dependency, setup shell to ease its usage

* Propagate Python version to the LHAPDF package

* Use PATH variable from module system

If taken directly from the environment, it will lose all the additions made by the Nix packages

Accessing the value from the configuration will always improve self-consistency

* Drop path extension, temporarily

* Set pineappl PATH in the trivial way

Just run a shell export command right before entering the shell

* Document Nix files added to the repo

* feat: Add Python CLI packaging workflow

* Switch from maturin action to manual maturin usage

* Patch CLI wheels with auditwheel and delocate

* Add LHAPDF installation in the CI

* Set bash as default shell for all jobs

* Write curl output on file

* Add LHAPDF installation script

* Replace shell LHAPDF installation with Python-based one

It ensures that the tools are available on every platform, since the
script only makes use of Python standard library.
Otherwise it was not even possible to rely on `wget` or `realpath`...

* Downgrade checkout action to run within container

* Downgrade setup python action as well

* Drop PyPy 3.7 on Linux

Apparently not available, t least with the given container.

* Add MacOS wheel patching script

* Fix typo in script name

* Set suitable targets for macos

* Use cibuildwheel on Linux, disable Windows

* Attempt building macos wheels on native runners

* Restore Node 20 version of actions on Linux

* Drop architecture specification from setup python

* Skip building wheels for CPython 3.6

* Skip PyPy 3.7 on macos

* Skip CPython 3.7 as well

* Attempt exporting env var for cibuildwheel

* Fix cibuildwheel invocation, drop one Python 3.8 as well on macos

* Install Rust toolchain on Linux

* Restore maturin action on linux

* Temporary ignore macos arm

* Back to maturin action for macos

* Ignore macos aarch64 once more

* Disambiguate python major in command

* Restore python versions and target

* Remove again some Python 3.7

* Install g++ in manylinux containers

* Add even more packages to manylinux container

* Unlock windows wheels

* Install cygwin for windows LHAPDF compilation

* Propagate scripts' names fix

* Avoid autoreconf during LHAPDF installation

Currently failing on Windows, and not part of the official LHAPDF instructions

* Replace cygwin with msys2

* Consistently use msys2 to run windows

* Disambiguate python major in windows

* Explicitly add tools to msys2

* Change make version in msys2

* Link binary statically

* Use a different container when building CLI on Linux

* Try fixing macOS CLI wheel generation

* Do not cross-compile macOS targets

* Fix YAML error in `cli-wheels.yml`

* Print `config.log` to debug Windows build

* Move CLI building for Linux and macOS to Release workflow

* Debug LHAPDF installation on Windows

* Use same `actions/upload-artifact` version everywhere

* Disable workflows temporarily

* Fix printing `config.log`

* Disable LHAPDF Python CLI

* Use standard gcc and make

* Add `pkgconf` dependency

* Make and install LHAPDF

* Print path of `pkgconf`

* Try using `pkgconfig` instead of `pkg-config`

* Use `pkg-config` instead `pkgconf`

* Try a different name for `pkg-config`

* Set the path to `pkg-config` explicitly

* Disable shared library generation for LHAPDF

* Debug `pkg-config` paths

* Rename jobs

* Activate converters on Linux

* Build CLI with all features enabled

* Install CLI dependencies on macOS

* Export environment variables properly

* Add cosmetic changes

* Try running `maturin` manually

* Remove binary patching

* Correct names of Rust and maturin packages

* Remove obsolete/unrelated files

* Rename CLI wheel for Windows workflow file

* Publish also CLI wheels

* Make wheels-only release

* Release v0.8.0-alpha.1.testwheels.1

* Release v0.8.0-alpha.2

* Allow prereleases from every branch

* Try to fix cli-wheels not being downloaded in CI

* Release v0.8.0-alpha.3

* Upload wheels and cli-wheels separately

* Release v0.8.0-alpha.4

---------

Co-authored-by: Christopher Schwan <[email protected]>
  • Loading branch information
alecandido and cschwan authored Jun 29, 2024
1 parent 93db089 commit 8665233
Show file tree
Hide file tree
Showing 14 changed files with 367 additions and 167 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/capi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CAPI

on:
push:
branches-ignore:
- pycli

jobs:
capi:
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/cli-wheels-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Generate CLI wheels for Windows

# this workflow doesn't do (yet) what it promises; we keep this file to not lose the progress

on:
workflow_dispatch:

jobs:
cli-wheels-windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64]
defaults:
run:
shell: msys2 {0}

steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
git
gcc
make
autoconf
python3
curl
tar
mingw-w64-ucrt-x86_64-pkg-config
mingw-w64-rust
mingw-w64-python-maturin
- uses: actions/setup-python@v5
with:
# WARNING: be careful with the ordering - the last version is the
# default one. Apparently maturin doesn't find all Python versions
# when one chooses a PyPy version instead of CPython as default
python-version: |
pypy3.7
pypy3.8
pypy3.9
pypy3.10
3.7
3.8
3.9
3.11
3.12
3.10
- name: Install LHAPDF
run: |
curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-6.5.4.tar.gz" | tar xzf -
cd LHAPDF-6.5.4
# compiling with Python gives errors, but we also don't need Python
./configure --disable-python --disable-shared
make -j
make install
# print the path of `pkgconf`
command -v pkg-config
- name: Set pkg-config paths
run: |
# for some reason `pkg-config` isn't properly found by Rust
echo "PKG_CONFIG=$(command -v pkg-config)" >> ${GITHUB_ENV}
echo "PKG_CONFIG_PATH=/ucrt64/lib/pkgconfig:${PKG_CONFIG_PATH}" >> ${GITHUB_ENV}
echo "${PKG_CONFIG_PATH}"
- name: Build wheels
run:
maturin build --release --out dist --find-interpreter --manifest-path pineappl_cli/Cargo.toml --target ${{ matrix.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.target }}
path: dist
2 changes: 2 additions & 0 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: MSRV

on:
push:
branches-ignore:
- pycli

env:
CARGO_TERM_COLOR: always
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Python

on:
push:
branches-ignore:
- pycli

jobs:
test:
Expand Down
Loading

0 comments on commit 8665233

Please sign in to comment.