-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
118 lines (108 loc) · 3.5 KB
/
.gitlab-ci.yml
File metadata and controls
118 lines (108 loc) · 3.5 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
image: python:3.12.4
stages:
- test
- deploy
.build-env: &build-env
- pip install uv
- uv sync --index https://gitlab-ci-token:$INTERNAL_REGISTRY_TOKEN@$INTERNAL_REG_URL_SHORT
pipeline_status_dummy:
stage: test
script:
- echo "this job is to prevent a spinning status wheel in the pipeline status on merge request events with no trigger."
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
unit_test:
stage: test
script:
- *build-env
- chmod +x ./tools/test.sh
- ./tools/test.sh
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
artifacts:
when: always
reports:
junit: tests/report.xml
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ "/^development.*$/"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ "/^stable.*$/"'
- if: '$CI_COMMIT_REF_NAME =~ "/^development.*$/" || $CI_COMMIT_REF_NAME =~ "/^stable.*$/"'
docbuild_test:
stage: test
script:
- *build-env
- chmod +x ./tools/docs.sh
- ./tools/docs.sh html-ci
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ "/^development.*$/"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ "/^stable.*$/"'
- if: '$CI_COMMIT_REF_NAME =~ "/^development.*$/" || $CI_COMMIT_REF_NAME =~ "/^stable.*$/"'
pages:
stage: deploy
variables:
GIT_STRATEGY: clone
script:
- *build-env
# this fetches the remote and tracks all the origin branches
# as locals so that sphinx multiversion can recognize them
- git fetch --all
- git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
- chmod +x ./tools/docs.sh
- ./tools/docs.sh html-multiversioned-ci
# UNCOMMENT THIS BLOCK WHEN IPAGES REPO IS READY
# clone the ipages repo on github
- git clone https://oauth2:$NIST_IPAGES_TOKEN@github.com/usnistgov/rminstr-ipages.git nist-pages
- git config --global user.email "daniel.c.gray@nist.gov"
- git config --global user.name "d-c-gray"
# removes any subdirectories in the
# i-pages repo, those are build files.
- rm -rf nist-pages/*/
- cp -R public/* nist-pages
# move to the cloned folder
- cd nist-pages
- touch .nojekyll
- git add .
- git diff-index --quiet HEAD || git commit -m "updating docs - automated"
- git push
artifacts:
paths:
- public
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" # Runs automatically on schedule
project-package-registry:
stage: deploy
image: python:latest
variables:
TWINE_USERNAME: gitlab-ci-token
TWINE_PASSWORD: $CI_JOB_TOKEN
script:
- pip install uv
- pip install twine
- uv build
- python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* --verbose
rules:
- if: $CI_COMMIT_TAG
internal-package-registry:
stage: deploy
image: python:latest
variables:
TWINE_USERNAME: $INTERNAL_REGISTRY_TOKEN_NAME
TWINE_PASSWORD: $INTERNAL_REGISTRY_TOKEN
script:
- pip install uv
- pip install twine
- uv build
- python -m twine upload --repository-url ${CI_API_V4_URL}/projects/10154/packages/pypi dist/* --verbose
rules:
- if: $CI_COMMIT_TAG
pypi-release:
stage: deploy
image: python:latest
variables:
TWINE_USERNAME: $INTERNAL_REGISTRY_TOKEN_NAME
TWINE_PASSWORD: $INTERNAL_REGISTRY_TOKEN
script:
- pip install uv
- uv build
- uv publish --token $PYPI_TOKEN
rules:
- if: $CI_COMMIT_TAG