1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-09-19 04:52:21 +00:00

Compare commits

..

4 Commits

Author SHA1 Message Date
J. Fernando Sánchez
668a803d89 Will anything break this time? We shall see 2017-02-27 20:38:55 +01:00
J. Fernando Sánchez
9daae8dda7 Please, please, please let it pass!
Am I a complete moron?
2017-02-27 20:22:55 +01:00
J. Fernando Sánchez
c72094b94b Fixed IMAGE names in GL CI 2017-02-27 20:08:10 +01:00
J. Fernando Sánchez
15d456d048 Testing docker in travis 2017-02-27 19:51:53 +01:00
3 changed files with 42 additions and 39 deletions

View File

@@ -10,8 +10,7 @@ variables:
stages:
- test
- images
- release
- push
- clean
.test: &test_definition
@@ -31,43 +30,46 @@ test-2.7:
.image: &image_definition
stage: images
stage: push
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- make -e push-$PYTHON_VERSION
only:
- tags
- master
- triggers
image-3.5:
push-3.5:
<<: *image_definition
variables:
PYTHON_VERSION: "3.5"
VERSION: $CI_BUILD_TAG
IMAGENAME: $CI_REGISTRY_IMAGE
image-2.7:
push-2.7:
<<: *image_definition
variables:
PYTHON_VERSION: "2.7"
VERSION: $CI_BUILD_TAG
IMAGENAME: $CI_REGISTRY_IMAGE
image-latest:
stage: release
push-main:
<<: *image_definition
variables:
IMAGENAME: $CI_REGISTRY_IMAGE
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- make -e push-latest
PYTHON_VERSION: main
VERSION: $CI_BUILD_TAG
push-latest:
<<: *image_definition
variables:
PYTHON_VERSION: latest
VERSION: $CI_BUILD_TAG
only:
- master
- tags
- triggers
clean :
stage: clean
script:
- make -e clean
- make -e clean
only:
- master

View File

@@ -1,8 +1,13 @@
sudo: required
services:
- docker
language: python
python:
- "2.7"
- "3.4"
- "3.5"
install: "pip install -r requirements.txt"
env:
- PYV=2.7
- PYV=3.4
- PYV=3.5
# run nosetests - Tests
script: nosetests
script: make test-$PYV

View File

@@ -4,7 +4,8 @@ NAME=senpy
REPO=gsiupm
VERSION=$(shell git describe --tags --dirty 2>/dev/null)
TARNAME=$(NAME)-$(VERSION).tar.gz
IMAGENAME=$(REPO)/$(NAME):$(VERSION)
IMAGENAME=$(REPO)/$(NAME)
IMAGEWTAG=$(IMAGENAME):$(VERSION)
action="test-${PYMAIN}"
all: build run
@@ -35,14 +36,14 @@ quick_build: $(addprefix build-, $(PYMAIN))
build: $(addprefix build-, $(PYVERSIONS))
build-%: version Dockerfile-%
docker build -t '$(IMAGENAME)-python$*' -f Dockerfile-$* .;
docker build -t '$(IMAGEWTAG)-python$*' -f Dockerfile-$* .;
quick_test: $(addprefix test-,$(PYMAIN))
dev-%:
@docker start $(NAME)-dev || (\
$(MAKE) build-$*; \
docker run -d -w /usr/src/app/ -v $$PWD:/usr/src/app --entrypoint=/bin/bash -p 5000:5000 -ti --name $(NAME)-dev '$(IMAGENAME)-python$*'; \
docker run -d -w /usr/src/app/ -v $$PWD:/usr/src/app --entrypoint=/bin/bash -p 5000:5000 -ti --name $(NAME)-dev '$(IMAGEWTAG)-python$*'; \
)\
docker exec -ti $(NAME)-dev bash
@@ -52,7 +53,7 @@ dev: dev-$(PYMAIN)
test-all: $(addprefix test-,$(PYVERSIONS))
test-%: build-%
docker run --rm --entrypoint /usr/local/bin/python -w /usr/src/app $(IMAGENAME)-python$* setup.py test
docker run --rm --entrypoint /usr/local/bin/python -w /usr/src/app $(IMAGEWTAG)-python$* setup.py test
test: test-$(PYMAIN)
@@ -66,15 +67,6 @@ pip_test-%: sdist
pip_test: $(addprefix pip_test-,$(PYVERSIONS))
upload-%: test-%
docker push '$(IMAGENAME)-python$*'
upload: test $(addprefix upload-,$(PYVERSIONS))
docker tag '$(IMAGENAME)-python$(PYMAIN)' '$(IMAGENAME)'
docker tag '$(IMAGENAME)-python$(PYMAIN)' '$(REPO)/$(NAME)'
docker push '$(IMAGENAME)'
docker push '$(REPO)/$(NAME)'
clean:
@docker ps -a | awk '/$(REPO)\/$(NAME)/{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1;}}' | xargs docker rm -v 2>/dev/null|| true
@docker images | awk '/$(REPO)\/$(NAME)/{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1":"$$2;}}' | xargs docker rmi 2>/dev/null|| true
@@ -96,16 +88,20 @@ pip_upload:
pip_test: $(addprefix pip_test-,$(PYVERSIONS))
run-%: build-%
docker run --rm -p 5000:5000 -ti '$(IMAGENAME)-python$(PYMAIN)' --default-plugins
docker run --rm -p 5000:5000 -ti '$(IMAGEWTAG)-python$(PYMAIN)' --default-plugins
run: run-$(PYMAIN)
push-latest: build-$(PYMAIN)
docker tag $(IMAGENAME)-python$(PYMAIN) $(IMAGENAME)
docker push $(IMAGENAME)
docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGEWTAG)'
docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGENAME)'
docker push '$(IMAGENAME)'
docker push '$(IMAGEWTAG)'
push-main: push-$(PYMAIN)
push-%: build-%
docker push $(IMAGENAME)-python$*
docker push $(IMAGENAME):$(VERSION)-python$*
ci:
gitlab-runner exec docker --docker-volumes /var/run/docker.sock:/var/run/docker.sock --env CI_PROJECT_NAME=$(NAME) ${action}