Skip to content

Commit

Permalink
Merge 487b562 into 1ee0b4c
Browse files Browse the repository at this point in the history
  • Loading branch information
bwinkel committed Jan 10, 2020
2 parents 1ee0b4c + 487b562 commit 1b01d80
Showing 1 changed file with 272 additions and 0 deletions.
272 changes: 272 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
trigger:
tags:
include:
- v*
branches:
include:
- master

pr:
- master

variables:
package_name: pycraf
is.tag: ${{ startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}
publish.wheels: ${{ startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}
is.pullrequest: ${{ startsWith(variables['Build.Reason'], 'PullRequest') }}
# is.tag: ${{ true }}
# publish.wheels: ${{ true }}
# why is the following not working?
is.linux: $[ startsWith(variables['Agent.OS'], 'Linux') ]
is.macos: ${{ startsWith(variables['Agent.OS'], 'Darwin') }}
is.win: ${{ startsWith(variables['Agent.OS'], 'Windows') }}

jobs:

- job:
displayName: Job

variables:
arch: x86_64
plat: manylinux2010_x86_64
image: quay.io/pypa/manylinux2010_x86_64
# for very old systems, the following would also be an alternative:
# plat: manylinux1_x86_64
# image: skhep/manylinuxgcc-x86_64
python.architecture: x64
${{ if not(startsWith(variables['Agent.OS'], 'Windows')) }}:
srtmdata: ${{ format('{0}/srtm', variables['Agent.BuildDirectory']) }}
${{ if startsWith(variables['Agent.OS'], 'Windows') }}:
srtmdata: ${{ format('{0}\srtm', variables['Agent.BuildDirectory']) }}

strategy:
matrix:
# linux35:
# imageName: 'ubuntu-16.04'
# python.version: '3.5'
# py_whl: 35
# numpy.version: '1.13.1'
linux36:
imageName: 'ubuntu-16.04'
python.version: '3.6'
py_whl: 36
numpy.version: '1.13.1'
astropy.version: '3.0'
# docs should only be published by one thread, as they are version-
# independent; and only if not on a PR
publish.docs: ${{ not(eq(variables['is.pullrequest'], true)) }}
${{ if eq(variables['is.tag'], true) }}:
docs.target: '.'
${{ if eq(variables['is.tag'], false) }}:
docs.target: 'latest'
# tarball should only be published by one thread, as it is version-
# independent
build.tarball: ${{ true }}
publish.tarball: ${{ eq(variables['is.tag'], true) }}
linux37:
imageName: 'ubuntu-16.04'
python.version: '3.7'
py_whl: 37
numpy.version: '1.16'
astropy.version: '4.0'
# linux38:
# imageName: 'ubuntu-16.04'
# python.version: '3.8'
# py_whl: 38
# numpy.version: '1.14.5'
# mac35:
# imageName: 'macos-10.13'
# python.version: '3.5'
# numpy.version: '1.13.1'
mac36:
imageName: 'macos-10.13'
python.version: '3.6'
numpy.version: '1.13.1'
astropy.version: '3'
# mac37:
# imageName: 'macos-10.13'
# python.version: '3.7'
# numpy.version: '1.14.5'
# mac38:
# imageName: 'macos-10.13'
# python.version: '3.8'
# numpy.version: '1.14.5'
# win35:
# imageName: 'vs2017-win2016'
# python.version: '3.5'
# numpy.version: '1.13.1'
win36:
imageName: 'vs2017-win2016'
python.version: '3.6'
numpy.version: '1.13.1'
astropy.version: '3'
win37:
imageName: 'vs2017-win2016'
python.version: '3.7'
numpy.version: '1.16'
astropy.version: '4.0'
# win38:
# imageName: 'vs2017-win2016'
# python.version: '3.8'
# numpy.version: '1.14.5'

pool:
vmImage: $(imageName)

steps:

- bash: |
echo "##vso[task.prependpath]$CONDA/bin"
echo "##vso[task.setvariable variable=conda.activate]source activate"
displayName: Add conda to PATH, Linux/MacOS
# condition: not(eq(variables['is.win'], true))
condition: not(startsWith(variables['Agent.OS'], 'Windows'))
- powershell: |
Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
echo "##vso[task.setvariable variable=conda.activate]call activate"
displayName: Add conda to PATH, Windows
# condition: eq(variables['is.win'], true)
condition: startsWith(variables['Agent.OS'], 'Windows')
- script: |
echo "Build.SourceBranch" $(Build.SourceBranch)
echo "Agent.BuildDirectory" $(Agent.BuildDirectory)
echo "Agent.OS" $(Agent.OS) "/" $[ variables['Agent.OS'] ]
echo "is.linux" $(is.linux) "/" ${{ variables['is.linux'] }}
echo "is.macos" $(is.macos) "/" ${{ variables['is.macos'] }}
echo "is.win" $(is.win) "/" ${{ variables['is.win'] }}
echo "srtmdata" $(srtmdata)
echo "conda.activate" $(conda.activate)
echo "is.tag" $(is.tag)
echo "publish.docs" $(publish.docs)
echo "is.pullrequest" $(is.pullrequest)
echo "docs.target" $(docs.target)
echo "publish.wheels" $(publish.wheels)
echo "python.version" $(python.version)
echo "py_whl" $(py_whl)
echo "numpy.version" $(numpy.version)
echo "astropy.version" $(astropy.version)
echo "imageName" $(imageName)
displayName: Show Vars
- script: conda create --yes --quiet --name pycraf-env -c conda-forge
displayName: Create Anaconda environment

# note: with project.toml it should not be necessary to have cython
# installed already, but on PRs building wheels and the tarball still fails
# for some reason!? therefore, we add it here (should also be faster than
# pip installation)
- script: |
$(conda.activate) pycraf-env
conda install --yes --quiet -c conda-forge python=$(python.version) astropy=$(astropy.version) cython h5py matplotlib numpy==$(numpy.version) pip 'pyproj>2' 'pyqt>=5' pytest pytest-astropy pytest-doctestplus pytest-qt scipy sgp4 sphinx-astropy twine wheel
displayName: Install Anaconda packages
# need to fix cctools and ld64 to slightly older version, otherwise an
# error ("ld: library not found for -lSystem") occurs during build
- script: |
$(conda.activate) pycraf-env
conda install --yes --quiet --name pycraf-env -c conda-forge clang_osx-64 clangxx_osx-64 llvm-openmp openmp cctools==921 ld64==409.12
displayName: Prepare clang, MacOS
# condition: and(succeeded(), eq(variables['is.macos'], true))
condition: and(succeeded(), startsWith(variables['Agent.OS'], 'Darwin'))
- script: |
$(conda.activate) pycraf-env
pip install -e .
displayName: Building
# pytest -rsx --doctest-rst docs pycraf
- script: |
$(conda.activate) pycraf-env
pip install pytest-azurepipelines
python setup.py test --remote-data=any
displayName: Testing
# sphinx-build docs docs/_build/html -W -b html
# conda install --yes --quiet --name pycraf-env -c conda-forge sphinx-astropy
- script: |
$(conda.activate) pycraf-env
python setup.py build_docs
displayName: Make docs
condition: succeeded()
# - task: DownloadSecureFile@1
# inputs:
# secureFile: ghpages_deploy_key_pycraf
# displayName: 'Get the deploy key'
# condition: and(succeeded(), eq(variables['publish.docs'], true))

# - bash: |
# mkdir ~/.ssh && mv $DOWNLOADSECUREFILE_SECUREFILEPATH ~/.ssh/id_rsa
# chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
# ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
# mkdir gh_pages && cd gh_pages
# git init
# git config --local user.name "Benjamin Winkel"
# git config --local user.email "bwinkel@mpifr.de"
# git remote add github git@github.com:bwinkel/pycraf.git
# git fetch github gh-pages
# git checkout --track github/gh-pages
# # mkdir -p ./$DOCS_TARGET
# rsync -av ../docs/_build/html/ ${DOCS_TARGET}/
# docs_version=$(python -c "import pycraf; print(pycraf.__version__)")
# git add -A && git commit -m "Update docs for $docs_version ***NO_CI***"
# bash ../retry.sh git push github
# displayName: Publish docs
# condition: and(succeeded(), eq(variables['publish.docs'], true))

# - task: TwineAuthenticate@1
# inputs:
# pythonUploadServiceConnection: pypi
# displayName: 'Twine Authenticate'

# - bash: |
# docker run -e NPY_NUM_BUILD_JOBS=4 -e PLAT=$(plat) -e package_name=$(package_name) -e py_whl=$(py_whl) --rm -v `pwd`:/io $(image) /io/.ci/build-wheels.sh
# ls -lh wheelhouse/
# mkdir -p dist
# cp wheelhouse/$(package_name)*.whl dist/.
# ls dist
# displayName: Build wheels, Linux
# condition: and(succeeded(), startsWith(variables['Agent.OS'], 'Linux'))

# - script: |
# $(conda.activate) pycraf-env
# python setup.py bdist_wheel
# displayName: Build wheels, MacOS/Windows
# condition: and(succeeded(), not(startsWith(variables['Agent.OS'], 'Linux')))

# # twine upload with python 3.5 doesn't work?
# # (pkg_resources.DistributionNotFound: The 'readme-renderer>=21.0' distribution was not found)
# # will use system python for upload
# - task: UsePythonVersion@0
# inputs:
# versionSpec: '3.6'

# - script: |
# pip install twine
# python -m twine upload -r "pypi" --config-file $(PYPIRC_PATH) dist/*.whl
# displayName: Upload wheels, Linux/MacOS
# condition: and(succeeded(), eq(variables['publish.wheels'], true), not(startsWith(variables['Agent.OS'], 'Windows')))

# - script: |
# pip install twine
# python -m twine upload -r "pypi" --config-file %PYPIRC_PATH% dist/*.whl
# displayName: Upload wheels, Windows
# condition: and(succeeded(), eq(variables['publish.wheels'], true), startsWith(variables['Agent.OS'], 'Windows'))

# - script: |
# $(conda.activate) pycraf-env
# python setup.py sdist
# displayName: Build tarball
# condition: and(succeeded(), eq(variables['build.tarball'], true))

# - script: |
# $(conda.activate) pycraf-env
# python -m twine upload -r "pypi" --config-file $(PYPIRC_PATH) dist/*.tar.gz
# displayName: Upload tarball
# condition: and(succeeded(), eq(variables['publish.tarball'], true))

# - script: rm ~/.ssh/id_rsa || true
# displayName: 'Cleanup docs deploy key'
# condition: and(always(), eq(variables['publish.docs'], true))

0 comments on commit 1b01d80

Please sign in to comment.