-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy path.gitlab-ci.yml
94 lines (88 loc) · 2.64 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
stages:
- checks
- test
- tests
- build-and-publish
- generate-data-model
include:
- project: nci-gdc/gitlab-templates
ref: master
file:
- templates/artifacts/python-library.yaml
execute_plaster:
extends: .job-with-ssh-keys
image: docker.osdc.io/ncigdc/python3.9-builder:${BASE_CONTAINER_VERSION}
stage: generate-data-model
script:
- export root_dir=$(pwd)
- echo $root_dir
- pip install "setuptools_scm>=6.2"
- export DICT_VERSION=$(python -m setuptools_scm)
- echo $DICT_VERSION
- mkdir -p gdcdictionary/$DICT_VERSION
- cp -r src/gdcdictionary/schemas/* gdcdictionary/$DICT_VERSION
- git clone [email protected]:NCI-GDC/gdcdatamodel2.git
- cd gdcdatamodel2
- git checkout "$CI_COMMIT_REF_NAME" || git checkout -b "$CI_COMMIT_REF_NAME"
- git log -1
- echo $CI_TRIGGER_BRANCH
- |
if [ ${CI_TRIGGER_BRANCH+x} ]; then
pip install "gdc-plaster==$CI_TRIGGER_BRANCH" "psqlgml>=0.2.4"
else
pip install "gdc-plaster>=1.1.2" "psqlgml>=0.2.4"
fi
- plaster --version
- psqlgml --version
- |
plaster generate-no-profile \
-i $root_dir \
--dict-name gdcdictionary \
--dict-version $DICT_VERSION \
-o src/gdcdatamodel2/models \
-s src/gdcdatamodel2/partial_dictionary
- pip install pre-commit==${PRE_COMMIT_VERSION}
- pre-commit run -a || true
- git status
artifacts:
paths:
- gdcdatamodel2
expire_in: 1 week
push_datamodels_to_github:
extends: .job-with-ssh-keys
image: docker.osdc.io/ncigdc/python3.9-builder:${BASE_CONTAINER_VERSION}
stage: generate-data-model
needs:
- execute_plaster
script:
- cd gdcdatamodel2
- cat setup.cfg
- git status
- git add .
- git commit -m "Use gdcdictionary $CI_COMMIT_REF_NAME $CI_COMMIT_SHA" || true
- git rev-parse --short HEAD
- git push origin "$CI_COMMIT_REF_NAME" || true
dependencies:
- execute_plaster
artifacts:
paths:
- gdcdatamodel2
expire_in: 1 week
push_datamodels_tag_to_github:
extends: .job-with-ssh-keys
image: docker.osdc.io/ncigdc/python3.8-builder:${BASE_CONTAINER_VERSION}
stage: generate-data-model
needs:
- push_datamodels_to_github
script:
- cd gdcdatamodel2
- git push origin --delete "$CI_COMMIT_REF_NAME" || true # delete branch with tag name
- git log -1
- echo "gdcdictionary $CI_COMMIT_SHORT_SHA gdcdatamodel2 $(git rev-parse --short HEAD)"
- git tag -a $CI_COMMIT_TAG -m "gdcdictionary $CI_COMMIT_SHORT_SHA gdcdatamodel2 $(git rev-parse --short HEAD)"
- git push --tags
dependencies:
- push_datamodels_to_github
only:
- tags