# This software is based on https://gitlab.com/singularityhub/gitlab-ci, # with DOI: https://doi.org/10.5281/zenodo.3834833 # provided under the following license: ### BSD 3-Clause License ### ### Copyright (c) 2018, Vanessa Sochat ### All rights reserved. ### ### Redistribution and use in source and binary forms, with or without ### modification, are permitted provided that the following conditions are met: ### ### * Redistributions of source code must retain the above copyright notice, this ### list of conditions and the following disclaimer. ### ### * Redistributions in binary form must reproduce the above copyright notice, ### this list of conditions and the following disclaimer in the documentation ### and/or other materials provided with the distribution. ### ### * Neither the name of the copyright holder nor the names of its ### contributors may be used to endorse or promote products derived from ### this software without specific prior written permission. ### ### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ### AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ### IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ### DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ### FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ### DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ### SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ### CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ### OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ### OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### stages: - test - build - deploy 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 - conda env create -f environment.yml - conda activate escape_template - python setup.py install - pytest . build_image: stage: build image: singularityware/singularity:gitlab-2.6 script: # step 1. build the container! - /bin/bash .gitlabci/build.sh Singularity - mkdir -p build && cp *.simg build - mkdir -p build && cp Singularity* build # You can add any other sregistry push commands here, and specify a client # (and make sure your define the encrypted environment credentials in gitlab # to push to your storage locations of choice. # Have a look at https://gitlab.com/singularityhub/gitlab-ci/-/blob/master/.gitlab-ci.yml. Ex: #- /bin/bash build.sh --uri collection/container --cli registry Singularity artifacts: paths: - build/Singularity.simg - build/Singularity only: - master - tags deploy_zenodo: stage: deploy image: singularityware/singularity:gitlab-2.6 dependencies: - build_image script: # Step 2. Install dependencies in the image and upload the files to Zenodo - apt-get -y update - apt-get install python3 - apt-get install wget - apt -y install python3-pip - pip3 --version - pip3 install requests - python3 --version # It is python3.5 - The image is a Debian GNU/Linux 9 (stretch). # # For testing purposes try uploading a file of small size to sandobox.zenodo.org (e.g., the singularity receipt) # - rm ./build/Singularity.simg # - python3 .zenodoci/upload_new_deposit.py --sandbox_zenodo True -i ./build --token $SANDBOX_ZENODO_TOKEN # # To deploy a NEW DEPOSIT to sandbox.zenodo # - python3 .zenodoci/upload_new_deposit.py --sandbox_zenodo True -i ./build --token $SANDBOX_ZENODO_TOKEN # # To deploy a NEW DEPOSIT to Zenodo - > python3 .zenodoci/upload_new_deposit.py --sandbox_zenodo False --input-directory ./build --token $ZENODO_TOKEN # # For deploying a NEW VERSION to Zenodo. The deposit id of the entry to be `new_versioned` MUST be provided. # You will need to provide also th e version of the last release (or parsed yourself via the api ;-) ) - export VER=2.0 - > wget -O template_project_escape-V"$VER".zip https://gitlab.in2p3.fr/escape2020/escape/template_project_escape/-/archive/V"$VER"/template_project_escape-V"$VER".zip - mv template_project_escape-V"$VER".zip ./build - ls ./build - > python3 .zenodoci/upload_new_version_deposit.py --sandbox_zenodo False --input-directory ./build --token $ZENODO_TOKEN --deposit_id $DEPOSIT_ID_ESCAPE_TEMPLATE --new_deposit_version $VER only: - tags