before_script: - git lfs pull # Advise GitLab that these environment vars should be loaded from the Variables config. variables: PYPI_USER: SECURE PYPI_PASSWORD: SECURE stages: - test - deploy - cleanup test_py_tools_ds: stage: test script: - source /root/anaconda3/bin/activate - export GDAL_DATA=/root/anaconda3/share/gdal - export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later - make nosetests - make docs artifacts: paths: - htmlcov/ - docs/_build/html/ - nosetests.html - nosetests.xml when: always test_styles: stage: test script: - source /root/anaconda3/bin/activate - export GDAL_DATA=/root/anaconda3/share/gdal - export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later - make lint artifacts: paths: - tests/linting/flake8.log - tests/linting/pycodestyle.log - tests/linting/pydocstyle.log when: always test_py_tools_ds_install: stage: test script: - source /root/anaconda3/bin/activate - export GDAL_DATA=/root/anaconda3/share/gdal - conda create -y -q --name py_tools_ds python=3 - source activate py_tools_ds # resolve some requirements with conda - conda install --yes -q -c conda-forge numpy gdal scikit-image pyproj rasterio shapely # run installer - python setup.py install # test if its importable - cd .. - pwd - ls - python -c "import py_tools_ds; print(py_tools_ds)" - python -c "from py_tools_ds.geo.vector.geometry import boxObj" only: - master pages: # this job must be called 'pages' to advise GitLab to upload content to GitLab Pages stage: deploy dependencies: - test_py_tools_ds script: # Create the public directory - rm -rf public - mkdir public - mkdir -p public/doc - mkdir -p public/coverage - mkdir -p public/nosetests_reports # Copy over the docs - cp -r docs/_build/html/* public/doc/ # Copy over the coverage reports - cp -r htmlcov/* public/coverage/ # Copy over the nosetests reports - cp nosetests.* public/nosetests_reports/ # Check if everything is working great - ls -al public - ls -al public/doc artifacts: paths: - public expire_in: 30 days only: - master deploy_pypi: stage: deploy dependencies: - test_py_tools_ds script: # Configure the PyPI credentials, then push the package, and cleanup the creds. - source /root/anaconda3/bin/activate - printf "[distutils]\nindex-servers =\n pypi\n\n" >> ~/.pypirc - printf "[pypi]\n""repository:"" https://upload.pypi.org/legacy/\n" >> ~/.pypirc - printf "username= ${PYPI_USER}\n" >> ~/.pypirc - printf "password= ${PYPI_PASSWORD}\n" >> ~/.pypirc - python setup.py check sdist upload -r pypi # This will fail if your creds are bad. - echo "" > ~/.pypirc && rm ~/.pypirc # If the above fails, this won't run. only: - /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags) except: - dev cleanup_pypirc: stage: cleanup when: always # this is important; run even if preceding stages failed. script: - rm -vf ~/.pypirc # we don't want to leave these around, but GitLab may clean up anyway.