-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
66 lines (61 loc) · 2.1 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
stages:
- tests
- pages
- zenodo
default:
image: mambaorg/micromamba
variables:
GIT_STRATEGY: clone
tests:
stage: tests
script:
- micromamba install -c conda-forge -y conda-merge
- conda-merge environment.yml environment-notebook.yml > /tmp/environment-merge.yml
- micromamba create -y -n simplestac -f /tmp/environment-merge.yml
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate simplestac
- micromamba env list
- pip install -e .
- pytest -s
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH =~ /.*/
pages:
stage: pages
script:
- micromamba install -c conda-forge -y conda-merge
- conda-merge environment.yml environment-doc.yml > /tmp/environment-merge.yml
- micromamba create -n simplestac -f /tmp/environment-merge.yml
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate simplestac
- micromamba env list
- pip install -e .
# - version=`python -m setuptools_scm --strip-dev`
# - echo $version
# - echo "{\"version\":\"$version\"}" > badges.json
- cp -r examples docs/
- jupytext --to markdown docs/examples/*.py
- portray as_html -c pyproject_doc.toml
- mv site public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "pages" || $CI_COMMIT_BRANCH == "main"
zenodo:
stage: zenodo
image: python:3.7
rules:
- if: $CI_COMMIT_TAG =~ /^v?[0-9]+\.[0-9]+/
variables:
VERSION: $CI_COMMIT_TAG
script:
# - git fetch --all
- echo $(git tag)
- pip install git+https://gitlab.com/sbeniamine/gitlab2zenodo
- git archive --format zip --worktree-attributes --prefix ${CI_PROJECT_TITLE}-${VERSION}/ --output ${CI_PROJECT_TITLE}-${VERSION}.zip ${VERSION}
- unzip -l ${CI_PROJECT_TITLE}-${VERSION}.zip
- g2z-get-meta -i $zenodo_record -o .zenodo.json
- vdate=$(git log -1 --format=%cd --date=short ${VERSION}) && sed -i "s/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/${vdate}/g" .zenodo.json
- cat .zenodo.json
- g2z-send -t $zenodo_token -m .zenodo.json -v ${VERSION} ${CI_PROJECT_TITLE}-${VERSION}.zip