.gitlab-ci.yml 2.72 KB
Newer Older
Enrique's avatar
Enrique committed
1
stages:
2
 - test
Enrique Garcia's avatar
Enrique Garcia committed
3
 - testContainer
Enrique's avatar
Enrique committed
4 5 6
 - build
 - deploy

7 8 9 10 11 12 13
build_test_project:
    stage: test
    # Please notice that we are using a different image just for easier syntax in the testing of the building and
    #  testing of the repository
    image: continuumio/miniconda3:latest
    script:
      - . /opt/conda/etc/profile.d/conda.sh
Enrique's avatar
Enrique committed
14
      - conda env create -f environment.yml
15 16 17 18
      - conda activate escape_template
      - python setup.py install
      - pytest .

Enrique Garcia's avatar
Enrique Garcia committed
19 20 21 22 23 24 25 26 27
test_docker_registry:
    stage: testContainer
    image: gitlab-registry.in2p3.fr/escape2020/wp3/template_project_escape/escape_template_project:v1.0
    script:
      - source activate escape_template
      - square_number -i -12.5
    only:
      - tags

Enrique's avatar
Enrique committed
28 29 30 31
build_image:
    stage: build
    image: singularityware/singularity:gitlab-2.6
    script:
32
        # Build the container!
Enrique's avatar
Enrique committed
33 34 35 36 37 38 39 40 41
        - /bin/bash .gitlabci/build.sh Singularity

        - mkdir -p build && cp *.simg build
        - mkdir -p build && cp Singularity* build

    artifacts:
        paths:
            - build/Singularity.simg
            - build/Singularity
42
    only:
43
      # - master
44 45
      - tags

Enrique's avatar
Enrique committed
46 47
deploy_zenodo:
    stage: deploy
Enrique Garcia's avatar
Enrique Garcia committed
48
    image: python:3.6.11-buster
49 50
    dependencies:
      - build_image
Enrique's avatar
Enrique committed
51
    script:
52
      # 1 - Install dependencies in the image and upload the files to Zenodo
Enrique's avatar
Enrique committed
53
      - apt-get -y update
Enrique's avatar
Enrique committed
54

55
      ### python, pip and wget are already installed in the container
Enrique Garcia's avatar
Enrique Garcia committed
56 57
      #- cat /etc/os-release  # Debian GNU/Linux 10 (buster)
      #- pip3 --version       # pip 20.1.1
58
      #- python3 --version    # 3.6.11 as the tag of the image specifies
Enrique's avatar
Enrique committed
59 60
      - pip3 install requests

61
      ### 2 - Get the last tag/release of the repository
62
      - export REPOSITORY_NAME=template_project_escape
Enrique's avatar
Enrique committed
63
      - export REPOSITORY_URL=https://gitlab.in2p3.fr/escape2020/wp3/$REPOSITORY_NAME
Enrique's avatar
Enrique committed
64

65
      ### 3 - Download the repository and move it to the build directory
66
      - mkdir -p build
Enrique's avatar
Enrique committed
67
      - /bin/bash .zenodoci/parse_last_release.sh $REPOSITORY_NAME $REPOSITORY_URL
68 69 70

      - ls ./build

71
      ### 4 - To deploy a NEW DEPOSIT to ZENODO SANDBOX
Enrique's avatar
done  
Enrique committed
72 73 74 75 76
      #- >
      #  python3 .zenodoci/upload_new_deposit.py
      #  --token $SANDBOX_ZENODO_TOKEN
      #  --sandbox_zenodo True
      #  --input-directory ./build
77

78
      ### 4 - To deploy a NEW DEPOSIT to ZENODO
Enrique Garcia's avatar
Enrique Garcia committed
79 80
      #- >
      #    python3 .zenodoci/upload_new_deposit.py
81
      #    --token $ZENODO_TOKEN
Enrique Garcia's avatar
Enrique Garcia committed
82 83
      #    --sandbox_zenodo False
      #    --input-directory ./build
84

85
      ### 4 - To deploy a NEW VERSION to ZENODO: The deposit_id of the entry to be `new_versioned` MUST be provided.
Enrique's avatar
done  
Enrique committed
86 87 88 89 90
      - >
        python3 .zenodoci/upload_new_version_deposit.py
        --sandbox_zenodo False
        --token $ZENODO_TOKEN
        --deposit_id $DEPOSIT_ID_ESCAPE_TEMPLATE
Enrique Garcia's avatar
Enrique Garcia committed
91

92
    only:
Enrique's avatar
Enrique committed
93
      - tags