diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5da3389c5c7ae5e5610d53eeab9d9e547c3d86a6..18dc4e14d27edc6e85a20bb5f14a7a421102069a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,41 +4,44 @@ stages: - release variables: - CONTAINER_TEST_IMAGE: boileaum/rosen:$CI_COMMIT_REF_NAME - CONTAINER_RELEASE_IMAGE: boileaum/rosen:latest - -before_script: - - echo $DOCKERHUB_PASSWD | docker login -u boileaum --password-stdin + CONTAINER_USERNAME: boileaum + CONTAINER_TEST_IMAGE: $CONTAINER_USERNAME/rosen:$CI_COMMIT_REF_NAME + CONTAINER_RELEASE_IMAGE: $CONTAINER_USERNAME/rosen:latest b:docker: stage: build tags: - shell, docker script: + - echo $DOCKERHUB_PASSWD | docker login -u $CONTAINER_USERNAME --password-stdin - docker build --pull -t $CONTAINER_TEST_IMAGE -f ./docker/Dockerfile-rosen . - docker push $CONTAINER_TEST_IMAGE -t:helloworld: +t:rosen-py36: stage: test + image: $CONTAINER_TEST_IMAGE tags: - - shell, docker + - tp-gitlab-ci, docker-exec script: - - docker pull $CONTAINER_TEST_IMAGE - - docker run $CONTAINER_TEST_IMAGE /bin/bash -c 'python test_helloworld.py' + - make clean && make + - pytest -v -t:rosen: +t:rosen-py27: stage: test + image: $CONTAINER_TEST_IMAGE tags: - - shell, docker + - tp-gitlab-ci, docker-exec script: - - docker pull $CONTAINER_TEST_IMAGE - - docker run $CONTAINER_TEST_IMAGE /bin/bash -c 'pytest -v' + - source /home/euler/py27/bin/activate + - make clean && make + - pytest -v r:docker: stage: release tags: - shell, docker script: + - echo $DOCKERHUB_PASSWD | docker login -u $CONTAINER_USERNAME --password-stdin - docker pull $CONTAINER_TEST_IMAGE - docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE - docker push $CONTAINER_RELEASE_IMAGE diff --git a/docker/Dockerfile-pythran b/docker/Dockerfile-pythran index 136d8bdc1a2cd4f074bc0394d9233cd96c069d0e..aa699953fad1a613987e613d7ad1ab5e70480416 100644 --- a/docker/Dockerfile-pythran +++ b/docker/Dockerfile-pythran @@ -1,21 +1,27 @@ FROM python:3 MAINTAINER Matthieu Boileau <matthieu.boileau@math.unistra.fr> -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - RUN apt-get update --fix-missing && \ apt-get install -y \ + python-dev \ vim RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN pip install --no-cache-dir virtualenv +RUN pip install --no-cache-dir --upgrade pip +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + RUN useradd -m -s /bin/bash euler ENV HOME /home/euler RUN chown -R euler:euler /home/euler USER euler WORKDIR $HOME -CMD /bin/bash +RUN virtualenv --python=/usr/bin/python2.7 $HOME/py27 +COPY requirements.txt /tmp/ +RUN $HOME/py27/bin/pip install --no-cache-dir -r /tmp/requirements.txt +CMD /bin/bash diff --git a/docker/Dockerfile-rosen b/docker/Dockerfile-rosen index 27c7e60f9e0751c2170b03a160e4fb27985b9a29..160abec68e4077775a85012d9805dfe74d595931 100644 --- a/docker/Dockerfile-rosen +++ b/docker/Dockerfile-rosen @@ -1,4 +1,5 @@ FROM boileaum/pythran:latest +MAINTAINER Matthieu Boileau <matthieu.boileau@math.unistra.fr> ENV HOME /home/euler ADD . $HOME/rosen diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 21e8d04051b45814e607fe85b075d127c45441d5..fd50ef613a740caab196f7b17b8c9b173950d317 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,6 +1,7 @@ version: '2' services: + env: build: context: ../ diff --git a/helloworld.c b/helloworld.c deleted file mode 100644 index 9ddb72cb07c4babbe075b3d5bdd5485f73bb7861..0000000000000000000000000000000000000000 --- a/helloworld.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main(void) -{ - printf("hello, world\n"); - return 0; -} diff --git a/makefile b/makefile index e7a80f96542ee3394002c269abcc29178b661699..6a94f6141833ddc28bacba005e1e5003ef29b6da 100644 --- a/makefile +++ b/makefile @@ -1,10 +1,4 @@ -all: helloworld pythran - -helloworld: - gcc helloworld.c -o helloworld.e - -test: helloworld - python test_helloworld.py +all: pythran pythran: pythran rosenbrock.py -o rosenbrock_pythran.so diff --git a/test_helloworld.py b/test_helloworld.py deleted file mode 100644 index 7e6deb4e2f145112fceba9037469141e9454f938..0000000000000000000000000000000000000000 --- a/test_helloworld.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -Test helloworld.c -""" - -import os -assert os.popen('./helloworld.e', 'r').read() == "hello, world\n"