Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 96 additions & 109 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,138 +4,125 @@ on: [push, pull_request, workflow_dispatch]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
name: Build wheels on windows python 3.${{ matrix.python-version-minor }} np ${{ matrix.numpy-version }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ['3.8', "3.9", "3.10", "3.11", "3.12"]
numpy-version: ['2.0']
#, "1.23", '1.24', '1.25', '1.26']
python-version-minor: [9, 10, 11, 12, 13]
numpy-version: [2.1, 2.2]
exclude:
- os: ubuntu-latest
- os: ubuntu-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "pypy3.9"
- os: ubuntu-latest
python-version: "pypy3.10"
- os: ubuntu-latest
numpy-version: "1.24"
python-version: "3.12"
- numpy-version: "2.0"
python-version: '3.8'
- numpy-version: '1.25'
python-version: '3.8'
- numpy-version: '1.26'
python-version: '3.8'
- python-version: '3.12'
numpy-version: '1.25'
- python-version: '3.12'
numpy-version: '1.24'
- python-version: '3.12'
numpy-version: '1.26'
- python-version: '3.12'
numpy-version: '1.23'
- os: windows-latest
python-version: '3.12'

- python-version-minor: 9
numpy-version: 2.2
- python-version-minor: 9
numpy-version: 2.1
- python-version-minor: 12
numpy-version: 1.25
- numpy-version: 2.0
include:
- python-version-minor: 8
numpy-version: 1.23.5
- numpy-version: 2.0
python-version-minor: 9
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- uses: ilammy/msvc-dev-cmd@v1 # to get cl.exe

- name: Set up Python 3.8
if: ${{ matrix.python-version-minor == 8}}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{matrix.python-version}}
auto-update-conda: true
python-version: 3.8.5

- name: Install mingw-w64 on Windows
if: ${{ runner.os == 'Windows' }}
- name: Install older netcdf4 for python 3.8
if: ${{ matrix.python-version-minor == 8}}
run: |
python -m pip install pip==24.2
pip install netCDF4==1.6.2 contourpy==1.1.1 cycler==0.12.1 fonttools==4.55.3 joblib==1.4.2 llvmlite==0.39.1 matplotlib==3.6.2 numba==0.56.4 packaging==24.2 wheel==0.44.0

- name: Install hdf5 for python 3.8 deps
if: ${{ matrix.python-version-minor == 8}}
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: |
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-hdf5
# mingw-w64-x86_64-ninja

# - name: unignore libraries windows
# if: contains(matrix.os, 'windows')
# run: |
# type .gitignore_extra >> .gitignore

# - name: unignore libraries linux
# if: contains(matrix.os, 'ubuntu')
# run: |

install: mingw-w64-x86_64-hdf5

- name: Set up Python > 3.11
if: ${{ matrix.python-version-minor > 11}}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.${{ matrix.python-version-minor }}

- name: setup 3.8 < python < 3.12
if: ${{matrix.python-version-minor != 8 && matrix.python-version-minor <= 11}}
uses: actions/setup-python@v5
with:
python-version: 3.${{matrix.python-version-minor}}

# - name: Install GFortran, GCC Linux
# if: contains(matrix.os, 'ubuntu')
# run: |
# # sudo add-apt-repository ppa:ubuntu-toolchain-r/test
# sudo apt-get update
# sudo apt-get install -y gcc gfortran libhdf5-serial-dev
- name: Install mingw-w64 on Windows for python < 3.12
if: ${{ matrix.python-version-minor <= 11}}
uses: msys2/setup-msys2@v2
with:
install: mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-toolchain base-devel

# - name: find fort loc
# if: contains(matrix.os, 'windows')
# run: |
# pip install numpy==${{matrix.numpy-version}}
# # pip install .
# cd src/pyraingen/fortran_daily
# python -m numpy.f2py -m regionalised_dailyT -c regionalised_dailyT.for -I $PWD
# # cd ../../..
# tree
- name: Install dependencies for python > 3.11
if: ${{ matrix.python-version-minor > 11}}
run: |
conda config --add channels conda-forge
pip install numpy==${{matrix.numpy-version}} build==1.2.2.post1
conda install -y meson gcc gfortran delvewheel

- name: install numpy
- name: finish build on 3.8 < python < 3.12
if: ${{ matrix.python-version-minor <= 11 && matrix.python-version-minor != 8}}
run: |
pip install numpy==${{matrix.numpy-version}}
pip install numpy==${{matrix.numpy-version}} build==1.2.2.post1 ninja meson delvewheel
cd src/pyraingen/fortran_daily
python -m numpy.f2py -c regionalised_dailyT4.for -m regionalised_dailyT4 -I $PWD --fcompiler=gfortran --compiler=msvc --backend distutils
Get-ChildItem -Force -R
cd ../../..
python -m build --wheel .

- name: build fortran
- name: finish build on >3.11
if: ${{ matrix.python-version-minor > 11}}
run: |
cat .gitignore_extra >> .gitignore
cd src/pyraingen/fortran_daily
echo $PWD
ls
# pip install meson
python -m numpy.f2py -m regionalised_dailyT -c regionalised_dailyT.for -I $PWD
ls
cd src\pyraingen\fortran_daily
$env:FC = "gfortran"
$env:CC = "gcc"
python -m numpy.f2py -m regionalised_dailyT4 -c regionalised_dailyT4.for -I $PWD
cd ../../..
python -m build --wheel .

- name: move files for numpy 2.0
if: contains(matrix.numpy-version, '2.0')
- name: finish build on python 3.8
if: ${{ matrix.python-version-minor == 8}}
run: |
cat .gitignore_extra >> .gitignore
pip install numpy==${{matrix.numpy-version}} ninja meson setuptools==59.8.0 build delvewheel # wheel
cd src/pyraingen/fortran_daily
mv regionalised_dailyT/.libs/* .
rm -r regionalised_dailyT
python -m numpy.f2py -c regionalised_dailyT4.for -m regionalised_dailyT4 --fcompiler=gnu95 --compiler=mingw32
Get-ChildItem -Force -R
cd ../../..
python -m build
pip list

- name: finish build
- name: Fix Wheel filename
run: |
pip install build
python -m build

# - name: test install
# run: |
# pip install ./dist/*.whl --force-reinstall
# python -c "from pyraingen.regionaliseddailysim import regionaliseddailysim"
mv dist\pyraingen-1.0.2-py3-none-any.whl dist\pyraingen-1.0.2-cp3${{matrix.python-version-minor}}-cp3${{matrix.python-version-minor}}-win_amd64.whl

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-x86_64-${{matrix.os}}-python-${{matrix.python-version}}-numpy-${{matrix.numpy-version}}
path: dist/

- name: Compress build
- name: repair wheel to add dlls
if: ${{ matrix.python-version-minor == 8 || matrix.python-version-minor > 11}}
run: |
cd dist
Compress-Archive . ../release-x86_64-${{matrix.os}}-python-${{matrix.python-version}}-numpy-${{matrix.numpy-version}}.zip

- name: Release Nightly
delvewheel repair dist\pyraingen-1.0.2-cp3${{matrix.python-version-minor}}-cp3${{matrix.python-version-minor}}-win_amd64.whl -w dist/

- name: repair wheel to add dlls for python 3.9, 3.10, 3.11
if: ${{ matrix.python-version-minor != 8 && matrix.python-version-minor <= 11}}
run: |
delvewheel repair dist\pyraingen-1.0.2-cp3${{matrix.python-version-minor}}-cp3${{matrix.python-version-minor}}-win_amd64.whl -w dist/ --add-path $PWD\src\pyraingen\fortran_daily\regionalised_dailyT4\.libs

- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{matrix.os}}-Release
files: release-x86_64-${{matrix.os}}-python-${{matrix.python-version}}-numpy-${{matrix.numpy-version}}.zip
fail_on_unmatched_files: true
tag_name: Release-${{matrix.os}}



name: windows-latest
files: ./dist/pyraingen-1.0.2-cp3${{matrix.python-version-minor}}-cp3${{matrix.python-version-minor}}-win_amd64.whl
tag_name: windows-latest
fail_on_unmatched_files: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ __pycache__/

# C extensions
*.so
*.dll
# *.dll
!regional*

# Distribution / packaging
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[project]
[tool.poetry]
name = "pyraingen"
version = "1.0.2"
description = "A package for stochastically generating daily and subdaily rainfall in Australia with ifd constraining."
authors = [
{name = "Caleb Dykman"}
"Caleb Dykman"
]
license = "None"
readme = "README.md"
Expand Down
Loading