-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
85 lines (78 loc) · 2.15 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
default:
image: code.usgs.gov:5001/devops/images/usgs/python:3.12-build
tags:
- build
# - shakecast-dev
before_script:
- python --version
- export PATH="/home/usgs-user/.local/bin:$PATH"
- apt-get install tree
# repository rules
.fork: &fork
if: >
$CI_PROJECT_PATH != 'ghsc/esi/groundmotion-processing'
&& $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
variables:
ENVIRONMENT: development
.upstream: &upstream
if: >
$CI_PROJECT_PATH == 'ghsc/esi/groundmotion-processing'
&& $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
ENVIRONMENT: staging
stages:
- test
- build
- docs
run tests and coverage:
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: junit.xml
rules:
- *fork
- *upstream
script:
- pip install -e .[test]
- strec_cfg update --datafolder /home/usgs-user/ --gcmt
- mkdir /home/usgs-user/slabs
- cp tests/data/slab_data/*.grd /home/usgs-user/slabs/.
- pytest -x --cov=src/gmprocess/ --cov-report xml:coverage.xml --cov-report term --junitxml junit.xml
- coverage xml
stage: test
run upload pypi:
rules:
# Run this job when a tag is created manually
- if: $CI_COMMIT_TAG
script:
- pip install .[build]
- python -m build
- python -m zipfile --list dist/*whl
- check-wheel-contents --package src/gmprocess/ --package-omit src/gmprocess/data/asdf dist/
- |
if [ $? -eq 0 ]; then
echo "check-wheel-contents has passed, uploading to PyPi ..."
python -m twine upload dist/*
else
echo "check-wheel-contents failed, wheel will not be uploaded to PyPi ..."
fi
stage: build
pages:
artifacts:
paths:
# The folder that contains the files to be exposed at the Page URL
- public
rules:
# This ensures that only merges to the default branch will trigger
# a pages deploy
- <<: *upstream
when: on_success
script:
- pip install .[doc]
- strec_cfg update --datafolder /home/usgs-user/ --gcmt
- cd docs
- bash makedocs.sh
stage: docs