.gitlab-ci.yml
image: gyptis/gyptis:dev
variables:
TERM: "xterm"
DISPLAY: ":99.0"
PYVISTA_OFF_SCREEN: "true"
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
include:
- template: Code-Quality.gitlab-ci.yml
stages:
- badge
- zenodo
- trigdoc
- trigdocker
- test
- deploy
badge:
stage: badge
image:
name: alpine/git:latest
entrypoint: [""]
script:
- echo "collecting stats for badges"
- commits=`git rev-list --all --count`
- latest_release_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
- logo=$(cat ./docs/_assets/opt.svg | tr '"' "'")
- echo {\"schemaVersion\":"1", \"commits\":\"$commits\", \"release_tag\":\"$latest_release_tag\"} > badges.json
- echo {\"schemaVersion\":"1", \"logoSvg\":\"$logo\", \"label\":\"release\", \"message\":\"$latest_release_tag\", \"color\":\"d25f5f\", \"labelColor\":\"dedede\", \"style\":\"for-the-badge\"} > logobadge.json
artifacts:
paths:
- badges.json
- logobadge.json
container:
stage: trigdocker
trigger: gyptis/docker
only:
- tags
staging:
stage: trigdoc
trigger: gyptis/gyptis.gitlab.io
only:
- tags
.test-script: &test-script
- mamba env update -f environment.yml
- conda activate gyptis
- python --version
- pip install -e .
- make test-req
- make test
- coverage xml
.test:
stage: test
script:
- source ~/.bashrc
- *test-script
only:
- master
# test-python-3.8:
# extends: .test
# before_script:
# - sed -i 's/python>3.7/python=3.8/g' environment.yml
# test-python-3.9:
# extends: .test
# before_script:
# - sed -i 's/python>3.7/python=3.9/g' environment.yml
# test-python-3.10:
# extends: .test
# before_script:
# - sed -i 's/python>3.7/python=3.10/g' environment.yml
# test-python-3.11:
# extends: .test
# before_script:
# - sed -i 's/python>3.7/python=3.11/g' environment.yml
test-python-3.12:
extends: .test
before_script:
- sed -i 's/python>3.7/python=3.12/g' environment.yml
coverage: '/TOTAL.*\s([.\d]+)%/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
send-snapshot:
stage: zenodo
image: python:3.6
script:
- pip install gitlab2zenodo
- git archive --format zip --output ${CI_COMMIT_TAG#v}.zip ${CI_COMMIT_TAG}
- g2z-send -i $zenodo_record -t $zenodo_token -s -m .zenodo.json ${CI_COMMIT_TAG#v}.zip
only:
- tags
pypi:
image: python:latest
stage: deploy
cache: {}
script:
- pip install twine build
- python3 -m build --sdist --wheel .
- twine upload dist/*
only:
- tags
sonarcloud-check:
stage: test
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- sonar-scanner
only:
- merge_requests
- master
- develop