Skip to content
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

Update workflows #20

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
da464c5
update actions in publish workflow
abrammer Apr 22, 2021
4fd4154
fix indent issue in yaml
abrammer Apr 22, 2021
8875c19
run on any push
abrammer Apr 22, 2021
dba1888
revert any push as we need tags
abrammer Apr 22, 2021
1804e4e
purge non manylinux wheels
abrammer Apr 22, 2021
37f8ae2
move manylinux to new directory for upload action
abrammer Apr 22, 2021
336d029
delete underscore from manylinux, ughhhhhh
abrammer Apr 22, 2021
d23fdee
only push pypi on master branch
abrammer Apr 22, 2021
ebc53ea
change to cibuildwheel
abrammer May 14, 2021
2b72768
dont version bump for now
abrammer May 14, 2021
2ca1b49
gotta install cibuildwheel
abrammer May 14, 2021
18267d8
change output dir try adding tests
abrammer May 14, 2021
ca99a59
add test deps
abrammer May 14, 2021
eaf2d72
try running on mac
abrammer May 14, 2021
7968367
this almost definitely wont work
abrammer May 14, 2021
627257e
fix frotran compilation for mac
abrammer May 14, 2021
934b28e
use the project variable like a sensible person
abrammer May 14, 2021
576e6d3
try arm64 aswell
abrammer May 14, 2021
3cddd5b
consolodate actions into matrix
abrammer May 14, 2021
cab69e7
skip pypy on mac for some reason
abrammer May 14, 2021
8c9a033
Merge branch 'master' into update_workflows
abrammer Jan 31, 2023
51274b7
update github actions
abrammer Jan 31, 2023
1c2e7f7
wrap 3.10 in quotes
abrammer Jan 31, 2023
e9ddcf6
update mac version and another 3.10 fix
abrammer Jan 31, 2023
60a44e8
update mac tests and work out gfortran issue
abrammer Jan 31, 2023
53ae2dd
try running without conda interference
abrammer Jan 31, 2023
1ff58b6
remove unneccessary workflow from unittests
abrammer Jan 31, 2023
90d56f5
update to 2_24 manylinux
abrammer Jan 31, 2023
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
146 changes: 47 additions & 99 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,122 +1,70 @@
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
on: [push]
# tags:
# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build-n-publish_linux:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-12 ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine flake8
python -m pip install --upgrade pip flake8 cibuildwheel

- name: Lint with flake8 for syntax errors
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
PLACEHOLDER='version = 0.0.0a0'
VERSION_FILE='setup.cfg'
# ensure the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/version = ${VERSION}/g" "$VERSION_FILE"
shell: bash

- name: Build manylinux Python wheels
uses: RalfG/[email protected]_x86_64
with:
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39'
build-requirements: ''
package-path: ''
- uses: actions/upload-artifact@v1
with:
name: wheelhouse
path: wheelhouse

# - name: Autobump version
# run: |
# # from refs/tags/v1.2.3 get 1.2.3
# VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
# PLACEHOLDER='version = 0.0.0a0'
# VERSION_FILE='setup.cfg'
# # ensure the placeholder is there. If grep doesn't find the placeholder
# # it exits with exit code 1 and github actions aborts the build.
# grep "$PLACEHOLDER" "$VERSION_FILE"
# sed -i "" "s/$PLACEHOLDER/version = ${VERSION}/g" "$VERSION_FILE"
# shell: bash

- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: build wheels
run: |
echo "$GITHUB_CONTEXT"
echo ${{ github.event.base_ref }}

- name: Publish wheels to PyPI
if: github.event.base_ref == 'refs/heads/master'
python -m cibuildwheel --output-dir wheelhouse
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_GLOBAL_PASSWORD }}
run: |
twine upload -u ${TWINE_USERNAME} -p ${TWINE_PASSWORD} wheelhouse/gripy*-manylinux*.whl
CIBW_BUILD: '{cp,pp}3*-*'
CIBW_SKIP: '*35-* pp??-macosx_x86_64'
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24
CIBW_ARCHS_LINUX: 'x86_64'
CIBW_BEFORE_ALL_MACOS: brew reinstall gcc
CIBW_TEST_REQUIRES: pytest hypothesis pupygrib
CIBW_TEST_COMMAND: pytest {project}/tests/

build-n-publish_macos:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
strategy:
matrix:
python: [3.6,3.7, 3.8]
runs-on: macos-latest
steps:

- uses: actions/checkout@v2
- name: purge old _linux_wheels
run: |
mkdir wheelupload
cp wheelhouse/*gripy* wheelupload/

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
- uses: actions/upload-artifact@v3
with:
python-version: ${{ matrix.python }}

- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
PLACEHOLDER='version = 0.0.0a0'
VERSION_FILE='setup.cfg'
# ensure the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "" "s/$PLACEHOLDER/version = ${VERSION}/g" "$VERSION_FILE"
shell: bash
name: wheelhouse
path: wheelupload

- name: Fix Conda permissions on macOS
run: |
sudo chown -R $UID $CONDA
echo $SHELL
$CONDA/bin/conda init bash
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
echo ${{ github.event.base_ref }}
- name: macos install dependencies
env:
DELOCATE_LIBRARY_PATH: /usr/local/miniconda/lib
run: |
$CONDA/bin/conda install python=${{ matrix.python }} gfortran_osx-64
$CONDA/bin/python -m pip install git+https://github.com/abrammer/delocate.git
$CONDA/bin/python --version
ln -s $CONDA/bin/gfortran /usr/local/bin/gfortran
$CONDA/bin/python -m pip install .
$CONDA/bin/python -m pip install -r requirements-test.txt
$CONDA/bin/python setup.py bdist_wheel
echo "Start delocate"
$CONDA/bin/delocate-wheel -w fixed_wheels -v dist/gripy-*
- name: Publish wheels to PyPI
- name: Publish a Python distribution to PyPI
if: github.event.base_ref == 'refs/heads/master'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_GLOBAL_PASSWORD }}
run: |
pip install twine
twine upload -u ${TWINE_USERNAME} -p ${TWINE_PASSWORD} fixed_wheels/gripy*-macosx*.whl
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_GLOBAL_PASSWORD }}
packages_dir: wheelupload/
34 changes: 8 additions & 26 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-10.15 ]
python: [3.7, 3.8, 3.9]
os: [ ubuntu-latest, macos-12 ]
python: [3.7, 3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: ubuntu install fortran
run: sudo apt install gfortran
if: matrix.os == 'ubuntu-latest'

- name: Fix Conda permissions on macOS
- name: macos install fortran
run: |
sudo chown -R $UID $CONDA
echo $SHELL
$CONDA/bin/conda init bash
if: matrix.os == 'macos-10.15'

- name: macos install dependencies
run: |
$CONDA/bin/conda install python=${{matrix.python}}
$CONDA/bin/python --version
$CONDA/bin/conda install gfortran_osx-64
ln -s $CONDA/bin/gfortran /usr/local/bin/gfortran
$CONDA/bin/python -m pip install .
$CONDA/bin/python -m pip install -r requirements-test.txt

if: matrix.os == 'macos-10.15'

- name: macos run tests
run: $CONDA/bin/pytest tests/
if: matrix.os == 'macos-10.15'
brew reinstall gcc
# reinstalling gcc installs gfortran which is missing by default
if: matrix.os == 'macos-12'

- name: windows install fortran
run: |
Expand All @@ -55,10 +39,8 @@ jobs:
python -m pip install --upgrade pip
pip install .
pip install -r requirements-test.txt
if: matrix.os != 'macos-10.15'

- name: Test with pytest
run: |
pip install pytest
pytest tests/
if: matrix.os != 'macos-10.15'
28 changes: 15 additions & 13 deletions gripy/libg2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ subroutine comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts, fld)
integer,intent(in) :: idrstmpl(*)
real,intent(out) :: fld(ndpts)

integer:: ival1(1), ival2(1), isign(1), minsd(1)
integer,allocatable :: ifld(:),ifldmiss(:)
integer(4) :: ieee

integer,allocatable :: gref(:),gwidth(:),glen(:)
real :: ref,bscale,dscale,rmiss1,rmiss2
real :: ref,bscale,dscale,rmiss1(1),rmiss2(1)
! real :: fldo(6045)
integer :: totBit, totLen, non
!f2py intent(in) cpack
Expand All @@ -145,8 +146,8 @@ subroutine comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts, fld)

ier=0
! print *,'IDRSTMPL: ',(idrstmpl(j),j=1,16)
ieee = idrstmpl(1)
call rdieee(ieee, ref, 1)
ref = real(idrstmpl(1))
! call rdieee(ieee, ref, 1)
bscale = 2.0**real(idrstmpl(2))
dscale = 10.0**real(-idrstmpl(3))
nbitsgref = idrstmpl(4)
Expand Down Expand Up @@ -211,7 +212,7 @@ subroutine comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts, fld)
iofst=iofst+1
call gbytes(cpack,minsd,iofst,nbitsd-1, 0, 1)
iofst=iofst+nbitsd-1
if (isign.eq.1) minsd=-minsd
if (isign(1).eq.1) minsd=-minsd
else
ival1=0
ival2=0
Expand Down Expand Up @@ -273,6 +274,7 @@ subroutine comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts, fld)
! Test to see if the group widths and lengths are consistent with number of
! values, and length of section 7.
!
non=1
totBit = 0
totLen = 0
do j=1,ngroups
Expand Down Expand Up @@ -363,26 +365,26 @@ subroutine comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts, fld)
! print*,' idrstmpl(17)', idrstmpl(17)
if (idrsnum.eq.3) then ! spatial differencing
if (idrstmpl(17).eq.1) then ! first order
ifld(1)=ival1
ifld(1)=ival1(1)
if ( idrstmpl(7).eq.0 ) then ! no missing values
itemp=ndpts
else
itemp=non-1
endif
do n=2,itemp
ifld(n)=ifld(n)+minsd
ifld(n)=ifld(n)+minsd(1)
ifld(n)=ifld(n)+ifld(n-1)
enddo
elseif (idrstmpl(17).eq.2) then ! second order
ifld(1)=ival1
ifld(2)=ival2
ifld(1)=ival1(1)
ifld(2)=ival2(1)
if ( idrstmpl(7).eq.0 ) then ! no missing values
itemp=ndpts
else
itemp=non-1
endif
do n=3,itemp
ifld(n)=ifld(n)+minsd
ifld(n)=ifld(n)+minsd(1)
ifld(n)=ifld(n)+(2*ifld(n-1))-ifld(n-2)
enddo
endif
Expand All @@ -407,9 +409,9 @@ subroutine comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts, fld)
!print *,'SAG ',n,fld(n),ifld(non),bscale,ref,dscale
non=non+1
elseif ( ifldmiss(n).eq.1 ) then
fld(n)=rmiss1
fld(n)=rmiss1(1)
elseif ( ifldmiss(n).eq.2 ) then
fld(n)=rmiss2
fld(n)=rmiss2(1)
endif
enddo
if ( allocated(ifldmiss) ) deallocate(ifldmiss)
Expand Down Expand Up @@ -454,7 +456,7 @@ subroutine rdieee(rieee, a, num)
!
!$$$

real(4),intent(in) :: rieee(num)
integer(4),intent(in) :: rieee(num)
real,intent(out) :: a(num)
integer,intent(in) :: num

Expand Down