stages: - dist - test - deploy # # Build Python source package. # sdist: image: python stage: dist script: - python setup.py sdist -d . artifacts: paths: - '*.tar.*' expire_in: 3 hours # # Build binary wheels for Linux and macOS. # .wheel:manylinux1: &wheel-manylinux1 # This container is derived from the official manylinux image provided by # python.org (see PEP 513), and includes all of the LALSuite # build-dependencies. image: containers.ligo.org/lscsoft/lalsuite-manylinux:master stage: dist script: # Build and install LALSuite - PYPREFIX=/opt/python/$(echo ${CI_JOB_NAME} | sed 's/.*:\(.*\)-manylinux1/\1/') - ${PYPREFIX}/bin/python setup.py bdist_wheel - auditwheel repair dist/*.whl - rm dist/* - mv wheelhouse/* . artifacts: paths: - '*.whl' expire_in: 3 hours .wheel:macos: &wheel-macos tags: - macos_elcapitan stage: dist script: - PYVERS=$(echo ${CI_JOB_NAME} | sed 's/.*:cp\(.\)\(.\).*/\1.\2/') # Enter virtualenv so that we have a controlled version of Numpy - virtualenv-${PYVERS} env - source env/bin/activate # FIXME: https://github.com/matthew-brett/delocate/pull/38 - pip install -q git+https://github.com/lpsinger/delocate@namespace-packages#egg=delocate 'numpy==1.14.5;python_version>="3.7"' 'numpy==1.7.0;python_version<"3.7"' # Build and audit wheel - python setup.py bdist_wheel - delocate-wheel -v -w wheelhouse dist/*.whl - rm -f *.whl - mv wheelhouse/* . artifacts: paths: - '*.whl' expire_in: 3 hours wheel:cp36-cp36m-manylinux1: <<: *wheel-manylinux1 wheel:cp37-cp37m-manylinux1: <<: *wheel-manylinux1 wheel:cp36-cp36m-macosx: <<: *wheel-macos wheel:cp37-cp37m-macosx: <<: *wheel-macos # # Build Docker containers for dependencies listed in requirements.txt, # plus dependencies for running the unit tests, collecting coverage data, # and generating the docs. # .dependencies: &dependencies stage: dist variables: IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_JOB_NAME:$CI_COMMIT_REF_NAME script: - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - | cat < Dockerfile FROM python:${CI_JOB_NAME#*python} COPY requirements.txt . RUN apt-get update -qq && apt-get -y install --no-install-recommends libchealpix-dev libgsl0-dev pkg-config && rm -rf /var/lib/apt/lists/* RUN pip --no-cache-dir install pytest-astropy pytest-xdist pytest-cov gcovr pycobertura sphinx sphinx-argparse sphinx-astropy flake8 RUN pip --no-cache-dir install -r requirements.txt RUN rm -f requirements.txt EOF - docker build -t $IMAGE_TAG . - docker push $IMAGE_TAG dependencies/python3.6: <<: *dependencies dependencies/python3.7: <<: *dependencies # # Generate documentation. # docs: image: $CI_REGISTRY_IMAGE/dependencies/python3.7:$CI_COMMIT_REF_NAME stage: test variables: GIT_STRATEGY: none script: - tar --strip-components 1 -xf *.tar.* - python setup.py build_docs dependencies: - sdist artifacts: paths: - docs/_build/html/ expire_in: 3 hours # # Test the wheels. # .test: &test variables: GIT_STRATEGY: none script: - pip install *.whl - python -c 'import sys; from ligo.skymap import test; sys.exit(test(verbose=True))' test/python3.6: <<: *test image: $CI_REGISTRY_IMAGE/dependencies/python3.6:$CI_COMMIT_REF_NAME dependencies: - wheel:cp36-cp36m-manylinux1 test/python3.7: <<: *test image: $CI_REGISTRY_IMAGE/dependencies/python3.7:$CI_COMMIT_REF_NAME dependencies: - wheel:cp37-cp37m-manylinux1 # # Measure test coverage: # - coverage.py for Python code # - gcov/gcovr for C code # # Export the results from both to Cobertura format because it's an XML format # that both coverage.py and gcovr can write, merge them by hand, and then # write HTML and text summaries. # # This would be a lot prettier if we could use coveralls or codecov.io, # which support multilingual test coverage. However, those products don't # integrate with git.ligo.org (or at least, they don't integrate for free). # test/coverage: stage: test image: $CI_REGISTRY_IMAGE/dependencies/python3.7:$CI_COMMIT_REF_NAME variables: CFLAGS: -coverage GIT_STRATEGY: none coverage: '/^TOTAL\s+.*\s+(\d+\.?\d*)%/' before_script: - tar --strip-components 1 -xf *.tar.* script: # Run tests. - python setup.py test --coverage -V # Write coverage reports in Cobertura format. - gcovr build/temp*/src -r . -x -o c-coverage.xml - coverage xml -o py-coverage.xml # Merge coverage reports. They're just XML, after all. - | python - <