Skip to content
Snippets Groups Projects
Verified Commit 583f0f85 authored by Duncan Macleod's avatar Duncan Macleod :flag_scotland:
Browse files

ci: reworked CI

parent 21cf3531
No related branches found
No related tags found
1 merge request!10Added missing setuptools runtime dependency
stages:
- test
- dist
- build
- test
- deploy
# -- test -------------------
.test: &test
before_script:
- python -m pip install setuptools
script:
- python -m pip install .
- python -c "import ligo"
- python setup.py test
test:2.7:
<<: *test
image: python:2.7
test:3.4:
<<: *test
image: python:3.4
.dist-artifacts: &dist-artifacts
after_script:
# list files
- find dist
artifacts:
expire_in: 18h
paths:
- dist
test:3.5:
<<: *test
image: python:3.5
# -- dist -------------------
test:3.6:
<<: *test
dist:tarball:
<<: *dist-artifacts
stage: dist
image: python:3.6
test:3.7:
<<: *test
image: python:3.7
script:
- python -m pip install setuptools
- python setup.py sdist bdist_wheel
# -- build ------------------
.build: &build
<<: *dist-artifacts
stage: build
artifacts:
expire_in: 3h
paths:
- dist
dependencies:
- dist:tarball
build:pypi:
.build:el: &build-rhel
<<: *build
image: python
script:
- python setup.py sdist bdist_wheel --universal
build:el7:
<<: *build
image: ligo/base:el7
before_script:
- mkdir -p dist/el7
- yum install -yq
rpm-build epel-rpm-macros
python-rpm-macros
# install enough to create a src RPM and parse the build dependencies
- yum -y -q install
yum-utils
rpm-build
python34
python3-rpm-macros
python-setuptools
python34-setuptools
script:
- python setup.py sdist
- rpmbuild -tb dist/ligo-common-*.tar.gz
- mv ~/rpmbuild/RPMS/*/python*-ligo-common-*.rpm dist/el7/
after_script:
- rm -rf dist/*.tar.gz
.build:debian: &build_debian
- DIST_NAME=${CI_JOB_NAME#build:rhel:}
- mkdir -pv dist/${DIST_NAME}
# build src rpm
- SRC_RPM=$(rpmbuild -ts dist/ligo-common*.tar.gz | cut -d\ -f2)
# install build dependencies for src rpm
- yum-builddep -y -q ${SRC_RPM}
# build binary rpms
- rpmbuild --rebuild ${SRC_RPM}
# move things into dist/
- mv -v ~/rpmbuild/RPMS/*/python*-ligo-common-*.rpm dist/${DIST_NAME}/
.build:debian: &build-debian
<<: *build
variables:
before_script:
- DIST_PATH="dist/${CI_JOB_NAME##*:}"
- mkdir -p ${DIST_PATH}
- apt-get update -yqq
- apt-get install -yq
dpkg-dev
debhelper
dh-python
python-all-dev
python-setuptools
python3-all-dev
python3-setuptools
devscripts
script:
- dpkg-buildpackage -b -us -uc
- mv ../python*-ligo-common_*.deb ${DIST_PATH}/
build:debian:jessie:
<<: *build_debian
image: debian:jessie
- DIST_NAME=${CI_JOB_NAME#build:debian:}
- mkdir -pv dist/${DIST_NAME}
# unpack tarball
- mkdir -pv build
- tar -xvf dist/ligo-common-*.tar.gz -C ./build --strip-components=1
- pushd build
# install build dependencies
- mk-build-deps --tool "apt-get -y" --install --remove
# build debian packages
- dpkg-buildpackage -us -uc -b
# move things into dist/
- popd
- mv -v {python,python3}-ligo-common_*.deb ligo-common_*.{buildinfo,changes} dist/${DIST_NAME}/
build:rhel:el7:
<<: *build-rhel
image: ligo/base:el7
build:debian:stretch:
<<: *build_debian
image: debian:stretch
<<: *build-debian
image: ligo/base:stretch
# -- test -------------------
.test: &test
stage: test
image: python
dependencies:
- dist:tarball
before_script:
- python -m pip install dist/ligo-common-*.tar.gz
script:
- python -c "import ligo"
test:python2.7:
<<: *test
image: python:2.7
test:python3.5:
<<: *test
image: python:3.5
test:python3.6:
<<: *test
image: python:3.6
test:python3.7:
<<: *test
image: python:3.7
# -- deploy -----------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment