From 68db17766bcc45af4187a1e7b6e082e7e7bbf89c Mon Sep 17 00:00:00 2001 From: lmoresi <> Date: Wed, 18 Mar 2020 21:35:14 +1100 Subject: [PATCH] Copy in the quagmire workflows --- .github/workflows/build_deploy_pdoc.yml | 48 +++++++++++ .github/workflows/python_conda_build_test.yml | 52 ++++++++++++ .github/workflows/python_conda_upload.yml | 83 +++++++++++++++++++ .../workflows/python_deploy_release_pypi.yml | 39 +++++++++ .../python_pypi_upload_macos_wheel.yml | 51 ++++++++++++ .../python_pypi_upload_mlinux_wheel.yml | 41 +++++++++ .../workflows/python_pypi_upload_source.yml | 37 +++++++++ .../python_pypi_upload_windows_wheel.yml | 43 ++++++++++ 8 files changed, 394 insertions(+) create mode 100644 .github/workflows/build_deploy_pdoc.yml create mode 100644 .github/workflows/python_conda_build_test.yml create mode 100644 .github/workflows/python_conda_upload.yml create mode 100644 .github/workflows/python_deploy_release_pypi.yml create mode 100644 .github/workflows/python_pypi_upload_macos_wheel.yml create mode 100644 .github/workflows/python_pypi_upload_mlinux_wheel.yml create mode 100644 .github/workflows/python_pypi_upload_source.yml create mode 100644 .github/workflows/python_pypi_upload_windows_wheel.yml diff --git a/.github/workflows/build_deploy_pdoc.yml b/.github/workflows/build_deploy_pdoc.yml new file mode 100644 index 0000000..cc1710e --- /dev/null +++ b/.github/workflows/build_deploy_pdoc.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/python_conda_build_test.yml b/.github/workflows/python_conda_build_test.yml new file mode 100644 index 0000000..a39b2cf --- /dev/null +++ b/.github/workflows/python_conda_build_test.yml @@ -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 + + + diff --git a/.github/workflows/python_conda_upload.yml b/.github/workflows/python_conda_upload.yml new file mode 100644 index 0000000..86b754a --- /dev/null +++ b/.github/workflows/python_conda_upload.yml @@ -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 + + + + diff --git a/.github/workflows/python_deploy_release_pypi.yml b/.github/workflows/python_deploy_release_pypi.yml new file mode 100644 index 0000000..68c7899 --- /dev/null +++ b/.github/workflows/python_deploy_release_pypi.yml @@ -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/* diff --git a/.github/workflows/python_pypi_upload_macos_wheel.yml b/.github/workflows/python_pypi_upload_macos_wheel.yml new file mode 100644 index 0000000..8a2b48d --- /dev/null +++ b/.github/workflows/python_pypi_upload_macos_wheel.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/python_pypi_upload_mlinux_wheel.yml b/.github/workflows/python_pypi_upload_mlinux_wheel.yml new file mode 100644 index 0000000..371cefd --- /dev/null +++ b/.github/workflows/python_pypi_upload_mlinux_wheel.yml @@ -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/python-wheels-manylinux-build@v0.2.2-manylinux2010_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 \ No newline at end of file diff --git a/.github/workflows/python_pypi_upload_source.yml b/.github/workflows/python_pypi_upload_source.yml new file mode 100644 index 0000000..cc1d231 --- /dev/null +++ b/.github/workflows/python_pypi_upload_source.yml @@ -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/* diff --git a/.github/workflows/python_pypi_upload_windows_wheel.yml b/.github/workflows/python_pypi_upload_windows_wheel.yml new file mode 100644 index 0000000..2f84f6a --- /dev/null +++ b/.github/workflows/python_pypi_upload_windows_wheel.yml @@ -0,0 +1,43 @@ +name: PYPI wheels windows + +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: [ 'windows-latest'] + python-version: ['3.6', '3.7'] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install numpy + pip install scipy + pip install Cython + + - name: Build the wheel + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + + run: | + pip install setuptools wheel twine + python setup.py bdist_wheel + twine upload dist/* --skip-existing