Skip to content

Commit 4a5004d

Browse files
authored
Update package.yml
1 parent 303adba commit 4a5004d

1 file changed

Lines changed: 47 additions & 30 deletions

File tree

.github/workflows/package.yml

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python Package
1+
name: Python package
22

33
on: [push]
44

@@ -15,40 +15,35 @@ jobs:
1515
build_type: [Release]
1616
c_compiler: [clang]
1717
python-version: ['3.11']
18-
gsl_version: ["2.6", "2.7", "2.8"] # Multiple GSL versions
19-
2018
steps:
2119
- uses: actions/checkout@v4
2220

2321
- uses: actions/setup-python@v5
2422
with:
2523
python-version: ${{ matrix.python-version }}
2624

27-
- name: Install cibuildwheel and Twine
28-
run: python -m pip install cibuildwheel==2.21.3 twine
25+
- name: Install cibuildwheel
26+
run: python -m pip install cibuildwheel==2.21.3
2927

30-
- name: Install GSL (MacOS)
31-
if: runner.os == 'macOS'
32-
run: |
33-
brew install gsl@${{ matrix.gsl_version }}
34-
brew install hdf5
28+
- name: Install Twine
29+
run: python -m pip install twine # Install Twine for uploading the package
3530

36-
- name: Install GSL (Linux)
37-
if: runner.os == 'Linux'
31+
- name: MacOS dependencies
32+
if: ${{ runner.os == 'macOS' }}
3833
run: |
39-
sudo apt-get update
40-
sudo apt-get -y install libgsl-dev libhdf5-dev
41-
42-
- name: Setup Micromamba (Windows)
43-
if: runner.os == 'Windows'
34+
brew uninstall pkg-config || echo "pkg-config not installed, skipping uninstallation."
35+
brew uninstall pkg-config@0.29.2 || echo "pkg-config@0.29.2 not available, skipping uninstallation."
36+
brew install gsl hdf5
37+
38+
- name: Windows dependencies
39+
if: ${{ runner.os == 'Windows' }}
4440
uses: mamba-org/setup-micromamba@v1
4541
with:
4642
environment-name: moose
4743
cache-environment: true
4844
cache-downloads: true
4945
create-args: >-
5046
python=${{ matrix.python-version }}
51-
gsl=${{ matrix.gsl_version }}
5247
pkg-config
5348
clang
5449
hdf5
@@ -65,45 +60,67 @@ jobs:
6560
meson
6661
ninja
6762
meson-python
63+
gsl
6864
cibuildwheel
6965
post-cleanup: all
7066
generate-run-shell: false
7167

72-
- name: Build Linux Wheel
68+
- name: Linux package
7369
if: runner.os == 'Linux'
7470
env:
71+
CIBW_BUILD_VERBOSITY: 1
72+
CIBW_BEFORE_ALL: 'uname -a'
7573
CIBW_BEFORE_ALL_LINUX: >
76-
yum install -y gsl-devel hdf5-devel
74+
yum install -y epel-release &&
75+
yum install -y pkgconfig &&
76+
yum install -y gsl-devel &&
77+
yum install -y hdf5-devel
7778
CIBW_BUILD: '*-manylinux_x86_64'
7879
CIBW_SKIP: 'pp*'
80+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
81+
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
7982
run: |
8083
python -m cibuildwheel --output-dir wheelhouse
8184
ls wheelhouse
82-
83-
- name: Build MacOS Wheel
85+
- name: MacOS package
8486
if: runner.os == 'macOS'
8587
env:
88+
CIBW_BUILD_VERBOSITY: 1
89+
CIBW_BEFORE_ALL: 'uname -a'
90+
CIBW_BEFORE_ALL_MACOS: >
91+
brew uninstall pkg-config || :
92+
brew uninstall pkg-config@0.29.2 || :
93+
brew install gsl hdf5 meson ninja cmake &&
94+
export PKG_CONFIG=`which pkg-config` &&
95+
echo "<<<<<<<<<<##########################################>>>>>>>>>>" &&
96+
echo "$$$$$ `pkg-config --libs gsl`" &&
97+
echo "@@@@@ `pkg-config --cflags gsl`"
98+
CIBW_ARCHS: 'arm64'
8699
CIBW_BUILD: '*-macosx_arm64'
87100
CIBW_SKIP: 'pp* cp38*'
88101
run: |
89-
export "MACOSX_DEPLOYMENT_TARGET=14.0"
102+
export "MACOSX_DEPLOYMENT_TARGET=$(echo ${{ matrix.os }} | cut -c 7-8).0" # required because gsl2.8 has minimum target of 14.0
90103
python -m cibuildwheel --output-dir wheelhouse
91104
ls wheelhouse
92-
93-
- name: Build Windows Wheel
94-
if: runner.os == 'Windows'
105+
- name: Windows package
106+
if: runner.os == 'Windows'
95107
env:
108+
CIBW_BEFORE_ALL: 'uname -a'
96109
CIBW_BUILD: '*-win_*'
97110
CIBW_SKIP: '*-win32 pp*'
98111
run: |
99112
micromamba shell hook -s powershell | Out-String | Invoke-Expression
100113
micromamba activate moose
101114
python -m cibuildwheel --output-dir wheelhouse
102115
dir wheelhouse
103-
104116
- name: Upload to PyPI
117+
if: always()
105118
env:
106-
TWINE_USERNAME: __token__
107-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
119+
TWINE_USERNAME: __token__ # Use __token__ as the username
120+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} # Use the secret with your PyPI token as the password
108121
run: |
109-
python -m twine upload wheelhouse/*.whl
122+
python -m pip install --upgrade twine # Ensure Twine is installed again
123+
python -m twine --version # Debug: Check Twine version
124+
which python # Debug: Ensure Python is available
125+
which twine # Debug: Check if Twine is correctly installed
126+
python -m twine upload wheelhouse/*.whl # Upload the built wheels to PyPI

0 commit comments

Comments
 (0)