Skip to content

Commit

Permalink
Merge pull request #529 from WISDEM/develop
Browse files Browse the repository at this point in the history
Fix pypi release scripts and pip-based workflow
  • Loading branch information
gbarter committed May 2, 2024
2 parents b522f82 + 761e0c4 commit d0632f8
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 53 deletions.
10 changes: 10 additions & 0 deletions .github/tools/cibw_repair_wheel_command_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e
set -x

WHEEL=$1
DEST_DIR=$2

python -m pip install delvewheel
python -m delvewheel show "$WHEEL" && python -m delvewheel repair -w "$DEST_DIR" "$WHEEL" --no-mangle-all
72 changes: 38 additions & 34 deletions .github/workflows/CI_WISDEM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
strategy:
fail-fast: False
matrix:
os: [ubuntu-latest, windows-latest] #macos-latest,
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: checkout repository
Expand Down Expand Up @@ -54,44 +54,28 @@ jobs:
which -a gfortran
which pip
# Install WISDEM with setup
# Note: For some reason, pip --no-deps doesn't find conda packages and downloads everything
- name: Install WISDEM with setup
run: |
python setup.py install
# Install WISDEM with pip
#- name: Install WISDEM with pip for Unix
# if: false == contains( matrix.os, 'windows')
# run: |
# python setup.py install

# Install WISDEM with pip
#- name: Install WISDEM with pip for Windows
# if: contains( matrix.os, 'windows')
# run: |
# python setup.py install
pip install --no-build-isolation --no-deps -e . -v
# Debugging session
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

# Run all tests
- name: Run tests
if: false == contains( matrix.os, 'windows')
- name: Run all tests
if: contains( matrix.os, 'ubuntu')
run: |
pytest -p no:warnings --disable-warnings --cov=wisdem
# Run limited test on WINDOWS
- name: Limited Windows test
if: contains( matrix.os, 'windows')
- name: Limited test for non Linux
if: false == contains( matrix.os, 'ubuntu')
run: |
cd wisdem/test/test_gluecode
pytest -p no:warnings --disable-warnings test_g*
# Run coveralls
- name: Run coveralls
if: contains( matrix.os, 'ubuntu') && contains( matrix.python-version, '3.10')
if: contains( matrix.os, 'ubuntu') && contains( matrix.python-version, '3.11')
#uses: coverallsapp/github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -109,33 +93,53 @@ jobs:
strategy:
fail-fast: False
matrix:
os: [ubuntu-latest] #, windows-latest, macos-latest,
python-version: ["3.10"]
os: [ubuntu-latest, windows-latest, macos-13] #mac-13 intel, mac-latest is arm
python-version: ["3.11"]

steps:
- name: Setup GNU Fortran
if: false == contains( matrix.os, 'windows')
uses: awvwgk/setup-fortran@v1
#with:
# compiler: intel-classic

- name: Install compiler
if: false == contains( matrix.os, 'windows')
id: install_cc
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang

- name: Install mingw-w64 on Windows
if: contains( matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: |
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-fortran
- name: checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
id: cp
with:
python-version: ${{ matrix.python-version }}
update-environment: true

# Install WISDEM with setup
# Note: For some reason, pip --no-deps doesn't find conda packages and downloads everything
- name: Set compilers
if: false == contains( matrix.os, 'windows')
run: |
echo "CC=${{ steps.install_cc.outputs.cc }}" >> $GITHUB_ENV
echo "CXX=${{ steps.install_cc.outputs.cxx }}" >> $GITHUB_ENV
- name: Install WISDEM with setup
env:
MESON_ARGS: "-Dpython_target=${{ steps.cp.outputs.python-path }}"
run: |
'${{ steps.cp.outputs.python-path }}' -m pip install --upgrade pip install pytest
'${{ steps.cp.outputs.python-path }}' -m pip install -vv .
'${{ steps.cp.outputs.python-path }}' -m pip install --upgrade pip install pytest numpy
'${{ steps.cp.outputs.python-path }}' -m pip install -v .
# Run limited tests
- name: Limited test
run: |
cd wisdem/test/test_gluecode
Expand Down
37 changes: 22 additions & 15 deletions .github/workflows/Publish_WISDEM.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
name: Build and upload to PyPI
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
# Best comparable example: https://github.com/pdfo/pdfo

# Build on every pull request (no need for every push) and release change:
on: [pull_request, release]

# Build on every branch push, tag push, and pull request change:
#on: [push, pull_request]
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
on:
push:
branches:
- master
release:
types:
- published

jobs:
build_wheels:
Expand All @@ -19,29 +13,42 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-14] #windows-latest,
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- name: Setup GNU Fortran
if: false == contains( matrix.os, 'windows')
uses: awvwgk/setup-fortran@v1

- name: Install compiler
if: false == contains( matrix.os, 'windows')
id: install_cc
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang

- name: Install mingw-w64 on Windows
if: contains( matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: |
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-fortran
- name: Checkout
uses: actions/checkout@v4

- name: Build wheels
- name: Build wheels mac and linux
if: false == contains( matrix.os, 'windows')
uses: pypa/cibuildwheel@v2.17.0
env:
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}
CIBW_SKIP: pp* cp36-* cp37-* cp38-* *-musllinux*
#CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"
#CIBW_ARCHS: ${{ matrix.architecture }}

- name: Build wheels windows
if: contains( matrix.os, 'windows')
uses: pypa/cibuildwheel@v2.17.0

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/10_ccblade/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ First, define the geometry and atmospheric properties.
:end-before: # 1 ---

Airfoil aerodynamic data is specified using the :class:`CCAirfoil` class.
Rather than use the default constructor, this example uses the special constructor designed to read AeroDyn files directly :meth:`CCAirfoil.initFromAerodynFile`.
The airfoil data is pulled directly from the geometry-yaml file.

.. literalinclude:: ../../../examples/10_ccblade/example.py
:start-after: # 2 ---
Expand Down
23 changes: 20 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "wisdem"
version = "3.15.2"
version = "3.15.3"
description = "Wind-Plant Integrated System Design & Engineering Model"
readme = "README.md"
requires-python = ">=3.9"
Expand Down Expand Up @@ -40,14 +40,18 @@ classifiers = [ # Optional
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: C",
"Programming Language :: Fortran",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
]

dependencies = [
"dearpygui",
"jsonschema",
"marmot-agents>=0.2.5",
"moorpy",
"nlopt",
"numpy>=1.26",
"openmdao>=3.31",
"openpyxl",
Expand All @@ -74,7 +78,7 @@ dependencies = [
dev = ["meson", "ninja", "swig"]
test = ["coveralls", "pytest", "pytest-cov"]
docs = ["sphinx", "sphinxcontrib-bibtex", "sphinx_rtd_theme>=1.3", "sphinx-jsonschema"]
opt = ["pyoptsparse"]
opt = ["pyoptsparse","nlopt"]

# List URLs that are relevant to your project
#
Expand Down Expand Up @@ -153,3 +157,16 @@ atomic = true
source = ["wisdem"]
omit = ["wisdem/test/*", "wisdem/floating/visualize.py"]

[tool.cibuildwheel]
skip = ["pp*", "cp36-*", "cp37-*", "cp38-*", "*-win32", "*-win_arm64"] #, "*-musllinux*"]
build-frontend = { name = "build", args = ["-w","-n"] }
before-build = "pip install numpy ninja meson meson-python"
build-verbosity = "3"

# https://github.com/pdfo/pdfo
[[tool.cibuildwheel.overrides]]
select = "*-win_amd64"
environment = { PKG_CONFIG_PATH="c:/opt/64/lib/pkgconfig" }

[tool.cibuildwheel.windows]
repair-wheel-command = "bash .github/tools/cibw_repair_wheel_command_windows.sh {wheel} {dest_dir}"

0 comments on commit d0632f8

Please sign in to comment.