Skip to content

Try to create Windows CLI wheels #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions .github/workflows/capi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches-ignore:
- pycli
- bump-pyo3-version
- windows-cli-wheels

jobs:
capi:
Expand Down
54 changes: 37 additions & 17 deletions .github/workflows/cli-wheels-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ 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:
push:
workflow_dispatch:

jobs:
cli-wheels-windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64]
defaults:
run:
shell: msys2 {0}
Expand All @@ -26,12 +24,12 @@ jobs:
gcc
make
autoconf
python3
curl
tar
mingw-w64-ucrt-x86_64-pkg-config
mingw-w64-rust
mingw-w64-python-maturin
patch
mingw-w64-ucrt-x86_64-pkgconf
mingw-w64-ucrt-x86_64-rust
mingw-w64-ucrt-x86_64-python-maturin
- uses: actions/setup-python@v5
with:
# WARNING: be careful with the ordering - the last version is the
Expand All @@ -50,25 +48,47 @@ jobs:
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
export LHAPDF_V=6.5.4
wget "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${LHAPDF_V}.tar.gz" -O- | tar xzf -
cd LHAPDF-${LHAPDF_V}
# add missing header
patch -l -p0 <<EOF
--- src/Paths.cc 2023-03-10 18:35:19.000000000 +0100
+++ src/Paths.cc.new 2025-03-19 19:42:02.330512613 +0100
@@ -35,7 +35,8 @@


void setPaths(const string& pathstr) {
- setenv("LHAPDF_DATA_PATH", pathstr.c_str(), 1);
+ string arg = "LHAPDF_DATA_PATH=" + pathstr;
+ putenv(arg.data());
}


EOF
# compiling with Python gives errors, but we also don't need Python
./configure --disable-python --disable-shared
./configure --disable-python --disable-shared --prefix=/ucrt64/
make -j
make install
- name: Test pkg-config
run: |
# 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}
command -v pkgconf
# show LHAPDF's .pc file
pkg-config lhapdf --path
cat $(pkg-config lhapdf --path)
echo ${PKG_CONFIG_PATH}
echo "PKG_CONFIG_PATH=/ucrt64/lib/pkgconfig:${PKG_CONFIG_PATH}" >> ${GITHUB_ENV}
echo "${PKG_CONFIG_PATH}"
- name: Patch pineappl_cli/pyproject.toml
run: |
# on Windows we can't build with all features (yet)
sed -i '/all-features/d' pineappl_cli/pyproject.toml
- name: Build wheels
run:
maturin build --release --out dist --find-interpreter --manifest-path pineappl_cli/Cargo.toml --target ${{ matrix.target }}
maturin build --release --out dist --find-interpreter --manifest-path pineappl_cli/Cargo.toml --features=static -- -Ctarget-feature=+crt-static
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.target }}
name: ${{ github.job }}
path: dist
1 change: 1 addition & 0 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches-ignore:
- pycli
- bump-pyo3-version
- windows-cli-wheels

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches-ignore:
- pycli
- windows-cli-wheels

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches-ignore:
- pycli
- bump-pyo3-version
- windows-cli-wheels

defaults:
run:
Expand Down