-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
122 lines (108 loc) · 3 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
image: registry.heptapod.net:443/fluiddyn/fluidsimfoam/ci/default:stable
variables:
WM_PROJECT_DIR: "/usr/share/openfoam"
OMPI_ALLOW_RUN_AS_ROOT: "1"
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: "1"
PDM_CACHE_DIR: ${CI_PROJECT_DIR}/.pdm-cache
stages:
- image
- test
- publish
- build
- release
cache:
# Required to keep artifacts from old builds, e.g. from default
paths:
- public
# Build an image for the above tasks; this should be a scheduled job, as
# it is quite unnecessary to run on every invocation.
CI image:
stage: image
tags:
- container-registry-push
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_BUILD_IMAGES == "1"'
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
script:
- |
cat > /kaniko/.docker/config.json <<EOF
{
"auths": {
"$CI_REGISTRY": {
"username": "$CI_REGISTRY_USER",
"password": "$CI_REGISTRY_PASSWORD"
}
}
}
EOF
- >
/kaniko/executor --context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile
--single-snapshot
--cleanup
--destination registry.heptapod.net:443/fluiddyn/fluidsimfoam/ci/$CI_COMMIT_HG_BRANCH:stable
pytest:
stage: test
script:
- pdm sync --clean -G test -G pyvista -G solvers
- pdm run pytest tests doc/examples --cov --cov-report term --cov-report xml
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
pages:
stage: publish
script:
- pdm sync --clean -G pyvista -G doc -G solvers
- pdm run xvfb-run --auto-servernum sphinx-build -W -b html -d doc/_build/doctrees doc doc/_build/html
- mkdir -p public/$CI_COMMIT_REF_NAME
- rsync -rvc --delete doc/_build/html/* public/$CI_COMMIT_REF_NAME/
# This directory can become too large leading to error.
# It can be purged with the botton "Clear runner caches"
# in https://foss.heptapod.net/fluiddyn/fluidsimfoam/-/pipelines
- ls public
- echo "CI_COMMIT_REF_NAME="$CI_COMMIT_REF_NAME
- echo See https://fluiddyn.pages.heptapod.net/fluidsimfoam/$CI_COMMIT_REF_NAME
needs: []
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- public
expire_in: 5 days
when: always
build:package:
stage: build
before_script:
- pdm config cache_dir ${PDM_CACHE_DIR}
script:
- pdm build || pdm lock --group :all --refresh
needs: []
artifacts:
when: always
paths:
- pdm.lock
- dist
expire_in: 24 hrs
cache:
when: always
key: pdmcache-$CI_COMMIT_BRANCH
paths:
- ${PDM_CACHE_DIR}
# manually set PDM_PUBLISH_PASSWORD in web interface to your pypi API token
release:package:
stage: release
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_TAG'
when: on_success
variables:
PDM_PUBLISH_USERNAME: __token__
script:
- pdm publish --no-build
needs: [ "build:package" ]