Commit 14c58fad authored by Robert Bruntz's avatar Robert Bruntz
Browse files

Merge branch 'update-ci' into 'master'

Revamp the CI to use gitlab-ci-templates

See merge request !72
parents dfd36d5e df3d6354
Pipeline #249227 passed with stages
in 12 minutes and 14 seconds
include:
- project: computing/gitlab-ci-templates
file:
- debian.yml
- python.yml
- rhel.yml
stages:
- dist
- source
- build
- package
- test
- lint
- docs
- deploy
# -- build ------------------
# -- macros
build:sdist:
stage: build
image: python
script:
- python setup.py sdist -d .
artifacts:
paths:
- '*.tar.gz'
.el7:
image: igwn/base:el7-testing
variables:
EPEL: "true"
build:wheel:manylinux1:
stage: build
image: quay.io/pypa/manylinux1_x86_64
script:
- set -ex;
for PYTHON in /opt/python/*/bin/python; do
$PYTHON setup.py bdist_wheel;
done
- set -ex;
for WHEEL in dist/*; do
auditwheel repair -w . ${WHEEL};
done
artifacts:
paths:
- '*.whl'
.el8:
image: igwn/base:el8-testing
variables:
EPEL: "true"
allow_failure: true
build:wheel:macos:
stage: build
tags:
- macos
script:
- set -ex;
for VIRTUALENV in /opt/local/bin/virtualenv-?.?; do
rm -rf env;
$VIRTUALENV --system-site-packages env;
source env/bin/activate;
python setup.py bdist_wheel;
done
- pip install delocate
- delocate-wheel -w . dist/*
artifacts:
paths:
- '*.whl'
.buster:
image: igwn/base:buster
.bullseye:
image: igwn/base:bullseye
allow_failure: true
# -- package ----------------
# -- dist -------------------
#
# This job makes the gwdatafind-X.Y.Z.tar.gz
# distribution and uploads it as a job
# artifact
#
.package:debian: &package-debian
stage: package
dependencies:
- build:sdist
tarball:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/python/#.python:build
- .python:build
image: python:3
stage: dist
variables:
GIT_STRATEGY: none
before_script:
- apt-get update
- apt-get -y install dpkg-dev devscripts lintian
script:
# unpack tarball
- mkdir -p src
- tar -C ./src --strip-components 1 -xf *.tar.*
- cd src
# install build dependencies
- mk-build-deps --tool "apt-get -y" --install --remove
# build debian packages
- dpkg-buildpackage -us -uc -b
# lint
- lintian --pedantic ../*.{deb,changes}
artifacts:
paths:
- '*.deb'
- '*.changes'
WHEEL: "false"
package:stretch:
<<: *package-debian
image: ligo/base:stretch
# -- source packages --------
#
# These jobs make src RPMs
#
.package:el7: &package-el
stage: package
dependencies:
- build:sdist
.source:
stage: source
needs:
- tarball
variables:
GIT_STRATEGY: none
before_script:
- yum install -y yum-utils rpm-build rpmlint epel-rpm-macros
script:
# prep
- mkdir -p ~/rpmbuild/{SOURCES,SPECS}
- tar -C ~/rpmbuild/SPECS -xf *.tar.* --strip-components 2 '*/etc/glue.spec'
- mv *.tar.* ~/rpmbuild/SOURCES
# install build dependencies
- yum-builddep -y ~/rpmbuild/SPECS/*.spec
# build binary rpms
- rpmbuild -ba ~/rpmbuild/SPECS/*.spec
- mv $(find ~/rpmbuild/{RPMS,SPECS,SRPMS} -type f) .
# lint
- echo "from Config import *; addFilter(\"python-bytecode-wrong-magic-value\")" >> rpmlintrc
- rpmlint -f rpmlintrc *.{rpm,spec}
artifacts:
paths:
- '*.rpm'
- '*.spec'
TARBALL: "lscsoft-glue*.tar.*"
.srpm:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/rhel/#.rhel:srpm
- .rhel:srpm
- .source
srpm:el7:
extends:
- .srpm
- .el7
srpm:el8:
extends:
- .srpm
- .el8
.dsc:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/debian/#.debian:dsc
- .debian:dsc
- .source
dsc:buster:
extends:
- .dsc
- .buster
dsc:bullseye:
extends:
- .dsc
- .bullseye
# -- binary packages --------
#
# These jobs generate binary RPMs
# from the src RPMs
#
package:el7:
<<: *package-el
image: ligo/base:el7
.binary:
stage: build
.rpm:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/rhel/#.rhel:rpm
- .rhel:rpm
- .binary
rpm:el7:
extends:
- .rpm
- .el7
needs:
- srpm:el7
rpm:el8:
extends:
- .rpm
- .el8
needs:
- srpm:el8
.deb:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/debian/#.debian:deb
- .debian:deb
- .binary
variables:
DSC: "lscsoft-glue*.dsc"
deb:buster:
extends:
- .deb
- .buster
needs:
- dsc:buster
deb:bullseye:
extends:
- .deb
- .bullseye
needs:
- dsc:bullseye
# -- test -------------------
#
# These jobs run the tests on
# all supported platforms
#
# -- test with pip
.test: &test
.test:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/python/#.python:test
- .python:test
stage: test
image: python
dependencies:
- build:sdist
needs:
- tarball
variables:
# don't need the git repo
GIT_STRATEGY: none
# default to PYTHON3
PYTHON: "python3"
# command to use for coverage
COVERAGE: "${PYTHON} -m coverage run --omit \"*.so\" --parallel-mode --source glue"
before_script:
- python -m pip install *.tar.*
- python -m pip install lalsuite
# test requirements
- ${PYTHON} -m pip install
"coverage>=4.1"
lalsuite
# install this project
- ${PYTHON} -m pip install lscsoft-glue-*.tar.*
script:
- make -C test
test:python2.7:
<<: *test
image: python:2.7
test:python3.4:
<<: *test
image: python:3.4
# extract tests from tarball
- tar -xf lscsoft-glue*.tar.* --wildcards --strip-components 1 */test
# run tests
- make -C test check -j 4 PYTHON="${COVERAGE}"
after_script:
# combine coverage from different processes
- ${PYTHON} -m coverage combine test/.coverage*
# run the usual after_script
- !reference [".python:test", after_script]
test:python3.5:
<<: *test
extends:
- .test
image: python:3.5
test:python3.6:
<<: *test
extends:
- .test
image: python:3.6
test:python3.7:
<<: *test
extends:
- .test
image: python:3.7
test:python3.8:
extends:
- .test
image: python:3.8
test:python3.9:
extends:
- .test
image: python:3.9
# -- test RHEL
.test:el:
extends:
- .test
before_script:
# set up yum caching
- !reference [".rhel:base", before_script]
# configure EPEL
- yum -y -q install epel-release && yum -y -q install epel-rpm-macros
# install testing dependencies
- if [[ "${PYTHON}" == "python3"* ]]; then
PYX=$(rpm --eval '%{?python3_pkgversion:%{python3_pkgversion}}%{!?python3_pkgversion:3}');
else
PYX="2";
fi
- yum -y -q install
make
python${PYX}-lal
python${PYX}-matplotlib
python${PYX}-pip
- yum -y install python${PYX}-*glue*.rpm
# force a good enough version of coverage.py
- ${PYTHON} -m pip install "coverage >=4.1"
test:el7:
extends:
- .test:el
- .el7
needs:
- tarball
- rpm:el7
test:el7:python2:
stage: test
image: ligo/lalsuite-dev:el7
dependencies:
- package:el7
- build:sdist
variables:
GIT_STRATEGY: none
script:
# install glue
- yum -y --nogpgcheck localinstall python2-*glue*.rpm
# install lal
- yum -y --nogpgcheck localinstall python2-lal
# extract and run the tests
- tar -xf *.tar.* --strip-components 1 lscsoft-glue*/test
- make -C test PYTHON=python2
test:el7:python3:
stage: test
image: ligo/lalsuite-dev:el7
dependencies:
- package:el7
- build:sdist
variables:
GIT_STRATEGY: none
script:
# install glue
- yum -y --nogpgcheck localinstall python3*glue*.rpm
# install lal
- yum -y install python3-lal
# extract and run the tests
- tar -xf *.tar.* --strip-components 1 lscsoft-glue*/test
- make -C test PYTHON=python3
test:stretch:python2:
stage: test
image: ligo/lalsuite-dev:stretch
dependencies:
- package:stretch
- build:sdist
extends:
- test:el7
variables:
GIT_STRATEGY: none
PYTHON: "python2"
test:el8:
extends:
- .test:el
- .el8
needs:
- tarball
- rpm:el8
# -- test Debian
.test:debian:
extends:
- .test
- .debian:base
before_script:
- apt-get update
- apt-get install -y python-lal python-lalburst
script:
- dpkg --install python-*.deb || { apt-get -y -f install; dpkg --install python-*.deb; }
# extract and run the tests
- tar -xf *.tar.* --strip-components 1 --wildcards lscsoft-glue*/test
- make -C test PYTHON=python
# set up apt
- !reference [".debian:base", before_script]
- apt-get -y -q -q install dpkg
# install testing dependencies
- apt-get -y -q install
make
python3-coverage
python3-lal
python3-pip
# install our package(s)
- dpkg --install *.deb || { apt-get -q -y -f install; dpkg -i python${PYX}-*.deb; }
test:stretch:python3:
stage: test
image: ligo/lalsuite-dev:stretch
dependencies:
- package:stretch
- build:sdist
test:buster:
extends:
- .test:debian
- .buster
needs:
- tarball
- deb:buster
test:bullseye:
extends:
- .test:debian
- .bullseye
needs:
- tarball
- deb:bullseye
# -- lint -------------------
#
# These jobs check the code
# for quality issues
#
.lint:
stage: lint
flake8:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/python/#.python:flake8
- .python:flake8
- .lint
needs: []
allow_failure: true
# ... for now
.rpmlint:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/rhel/#.rhel:lint
- .rhel:lint
- .lint
variables:
GIT_STRATEGY: none
before_script:
- apt-get update
- apt-get install -y python3-lal python3-lalburst
script:
- dpkg --install python3-*.deb || { apt-get -y -f install; dpkg --install python3-*.deb; }
# extract and run the tests
- tar -xf *.tar.* --strip-components 1 --wildcards lscsoft-glue*/test
- make -C test PYTHON=python3
GIT_STRATEGY: fetch
RPMLINT_OPTIONS: '--info --file .rpmlintrc'
rpmlint:el7:
extends:
- .rpmlint
- .el7
needs:
- rpm:el7
rpmlint:el8:
extends:
- .rpmlint
- .el8
needs:
- rpm:el8
.lintian:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/debian/#.debian:lint
- .debian:lint
- .lint
variables:
LINTIAN_OPTIONS: "--color always --allow-root --pedantic"
lintian:buster:
extends:
- .lintian
- .buster
needs:
- deb:buster
lintian:bullseye:
extends:
- .lintian
- .bullseye
needs:
- deb:bullseye
# -- docs -------------------
#
# This job generates the
# project documentation using
# sphinx-apidoc
#
docs:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/python/#.python:sphinx
- .python:sphinx
stage: docs
image: python:3.7
image: python:3.8
needs: []
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
REQUIREMENTS: "sphinx_rtd_theme"
before_script:
# install docs requirements
- python -m pip install sphinx sphinx_rtd_theme
- !reference [".python:sphinx", before_script]
# install glue and lalsuite (everything else is in setup.py)
- python -m pip install . lalsuite
script:
- glue_version=$(python setup.py --version)
- mkdir -v docs
- cd docs
# generate docs skeleton
- glue_version=$(python setup.py --version)
- python -m sphinx.ext.apidoc
--module-first
--separate
......@@ -236,29 +387,23 @@ docs:
--doc-project "lscsoft-glue"
--doc-author "The LIGO Scientific Collaboration and The Virgo Collaboration"
--doc-version "${glue_version}"
--output-dir .
../glue
--output-dir ${SOURCEDIR}
glue
# use module page as index
- mv -v glue.rst index.rst
- mv -v docs/glue.rst docs/index.rst
# use sphinx_rtd_theme
- sed -i 's/alabaster/sphinx_rtd_theme/g' conf.py
- sed -i 's/alabaster/sphinx_rtd_theme/g' docs/conf.py
# run sphinx to generate docs
- python -m sphinx -M html . build
artifacts:
paths:
- docs/build
cache:
paths:
- .cache/pip
- !reference [".python:sphinx", script]
pages:
stage: deploy
dependencies:
needs:
- docs
only:
- tags
script:
- mv docs/build/html public
- mv html public
artifacts:
paths:
- public
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment