Skip to content

Commit

Permalink
Copy in the quagmire workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoresi committed Mar 18, 2020
1 parent 4c8e7e6 commit 68db177
Show file tree
Hide file tree
Showing 8 changed files with 394 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build_deploy_pdoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy docs to gh-pages

on:
push:
branches: [none]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'

# This is needed because we install stripy for litho1pt0 build for documentation
- name: Install gfortran
run: |
sudo apt-get install -y gfortran
- name: Install petsc
run: echo ""

# The numpy etc are needed because we install stripy for litho1pt0 build for documentation
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy
pip install scipy
pip install Cython
pip install sympy
pip install pint
pip install stripy
pip install pdoc3
- name: Build docs with pdoc
run: |
mkdir -p docs
pdoc --config latex_math=True --html -o docs --force quagmire
# Note deploy key needs the ----BEGIN ... KEY---- lines too
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.GH_PAGES_DEPLOY_PR_KEY }}
publish_dir: docs/quagmire
52 changes: 52 additions & 0 deletions .github/workflows/python_conda_build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Workflow to build dependencies with conda / install locally with pip
name: conda + pip

on:
push

jobs:
build_and_test:
name: Build test (${{matrix.os}}, py ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ 'macos-latest', 'ubuntu-latest' ]
python-version: [ '3.7' ]

# exclude:
# - os: ubuntu-latest
# python-version: '2.7'
# - os: macos-latest
# python-version: '2.7'

steps:

- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies with conda
shell: bash -l {0}
run: |
conda install pip
conda install -c conda-forge compilers numpy scipy sympy
conda install -c conda-forge petsc4py petsc mpi4py h5py
conda install -c conda-forge pint
conda install -c underworldcode stripy
conda install pytest
- name: Install (self)
shell: bash -l {0}
run: |
python --version
pip install -e .
- name: Test with pytest
shell: bash -l {0}
run: |
pytest
83 changes: 83 additions & 0 deletions .github/workflows/python_conda_upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: conda -c underworldcode

on:
release:
types: [created, edited]
push:
branches:
- dev

# Limited to ubuntu and macos because of petsc / petsc4py
# py27 seems problematic in stripy builds

jobs:
catch_and_release:
name: ${{matrix.os}} build and test on py (${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'macos-latest']
python-version: [ '3.7']

steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
python-version: ${{ matrix.python-version }}
- name: Conda info
shell: bash -l {0}
run: conda info

- name: Install dependencies with conda
shell: bash -l {0}
run: |
conda install conda-build anaconda-client
conda install -c conda-forge compilers numpy scipy sympy
conda install -c conda-forge petsc4py petsc mpi4py h5py
conda install -c conda-forge pint
conda install -c underworldcode stripy
conda install pytest
conda config --add channels underworldcode
conda config --add channels conda-forge
- name: Reinvent the wheel / upload (UBUNTU)
if: matrix.os == 'ubuntu-latest'

env:
ANACONDA_USERNAME: ${{ secrets.ANACONDA_USERNAME}}
ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD}}

shell: bash -l {0}
run: |
# Conda version
anaconda logout
printf Y | anaconda login --username $ANACONDA_USERNAME --password $ANACONDA_PASSWORD --hostname quagy-virtual-${{ matrix.os}}-${{ matrix.python-version }}
python setup.py bdist_conda # this will upload to lmoresi in the first instance ...
anaconda upload -u underworldcode --skip-existing /usr/share/miniconda/envs/test/conda-bld/*/*.tar.bz2
anaconda logout
- name: Reinvent the wheel / upload (MACOS)
if: matrix.os == 'macos-latest'

env:
ANACONDA_USERNAME: ${{ secrets.ANACONDA_USERNAME}}
ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD}}

shell: bash -l {0}
run: |
# Conda version
anaconda logout
printf Y | anaconda login --username $ANACONDA_USERNAME --password $ANACONDA_PASSWORD --hostname quagy-virtual-${{ matrix.os}}-${{ matrix.python-version }}
python setup.py bdist_conda # this will upload to lmoresi in the first instance ...
anaconda upload -u underworldcode --skip-existing /usr/local/miniconda/envs/test/conda-bld/*/*.tar.bz2
anaconda logout
39 changes: 39 additions & 0 deletions .github/workflows/python_deploy_release_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Upload Python Package to PYPI

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'

- name: Install gfortran
run: |
sudo apt-get install -y gfortran
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy
pip install scipy
pip install Cython
pip install sympy
pip install pint
pip install stripy
pip install pdoc3
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
51 changes: 51 additions & 0 deletions .github/workflows/python_pypi_upload_macos_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PYPI wheels macos

on:
release:
types: [created, edited]


jobs:
deploy_to_pypi:
name: ${{matrix.os}} build and deploy on pypi (${{ matrix.python-version }})

strategy:
fail-fast: false
matrix:
os: [ 'macos-latest']
python-version: ['2.7', '3.7', '3.8']

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
python-version: ${{ matrix.python-version }}
- name: Conda info
shell: bash -l {0}
run: conda info

- name: Install dependencies with conda
shell: bash -l {0}
run: |
conda install pip
conda install -c conda-forge compilers numpy scipy sympy
conda install -c conda-forge petsc4py petsc mpi4py h5py
conda install -c conda-forge pint
conda install -c underworldcode stripy
conda install pytest
- name: Build the wheel
shell: bash -l {0}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

run: |
pip install setuptools wheel twine
pip install delocate
python setup.py bdist_wheel
delocate-wheel -d -w fixed_wheels dist/*whl
twine upload fixed_wheels/*whl --skip-existing
41 changes: 41 additions & 0 deletions .github/workflows/python_pypi_upload_mlinux_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PYPI wheels manylinux

on:
release:
types: [created, edited]

jobs:
deploy_to_pypi:
name: build and deploy manylinux on pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
# Not sure how to fix this ... petsc from system packages ?

- name: Build manylinux Python wheels
uses: RalfG/[email protected]_x86_64
with:
python-versions: 'cp27-cp27m cp36-cp36m cp37-cp37m cp38-cp38'
build-requirements: 'cython numpy scipy'
system-packages: 'libgfortran'
package-path: ''
pip-wheel-args: '--no-deps'

- name: Build the wheel
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

run: |
twine upload wheelhouse/*-manylinux*.whl --skip-existing
37 changes: 37 additions & 0 deletions .github/workflows/python_pypi_upload_source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PYPI source

on:
release:
types: [created, edited]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'

- name: Install gfortran
run: |
sudo apt-get install -y gfortran
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy
pip install scipy
pip install Cython
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install setuptools wheel twine
python setup.py sdist
twine upload dist/*
Loading

0 comments on commit 68db177

Please sign in to comment.