-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
130 lines (117 loc) · 3.39 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
123
124
125
126
127
128
129
130
stages:
- verify
- test
- release
- deploy
variables:
BUILD_IMAGE: $ARTIFACTORY_SERVER/sds/sdd-common-ci
include:
- project: 'sds-dev/releases'
ref: main
file: 'releases.yml'
backend-lint:
stage: verify
tags:
- docker-exec
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: $BUILD_IMAGE
before_script:
- pip install pre-commit tox mypy .[dev]
script:
- SKIP=no-commit-to-branch pre-commit run --all-files -c .pre-commit-config.yaml --show-diff-on-failure --color never
- tox -e docs
- tox -e bandit
spellcheck:
stage: verify
tags:
- docker-exec
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: $BUILD_IMAGE
before_script:
- pip install pyspelling
script:
- pyspelling
frontend-lint:
stage: verify
tags:
- docker-exec
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: $BUILD_IMAGE
before_script:
- pnpm --prefix swift_browser_ui_frontend install
script:
- pnpm --prefix swift_browser_ui_frontend lint
backend-test:
stage: test
tags:
- docker-exec
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: $BUILD_IMAGE
before_script:
- pnpm --prefix swift_browser_ui_frontend install --prod
- pip install .[test]
script:
- pnpm --prefix swift_browser_ui_frontend docker-build
- tox -e pytest
- coverage run -m pytest tests/
- coverage report --precision=1
coverage: '/TOTAL.*\s+(\d+\%)/'
wasm-test:
stage: test
tags:
- docker-exec
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: $BUILD_IMAGE
before_script:
- ruby --version
- gem --version
- gem install ceedling
script:
- cd swift_browser_ui_frontend/wasm
- ceedling
release-job:
extends: .automated-release
release:
description: $(cat release_changes.md)
assets:
links:
- name: ${ARTIFACTORY_SERVER}/sds/sd-connect:${RELEASE_VERSION}
url: https://${ARTIFACTORY_SERVER}/sds/sd-connect:${RELEASE_VERSION}
link_type: image
- name: ${ARTIFACTORY_SERVER}/sds/swiftui-upload-runner:${RELEASE_VERSION}
url: https://${ARTIFACTORY_SERVER}/sds/swiftui-upload-runner:${RELEASE_VERSION}
link_type: image
- name: ${ARTIFACTORY_SERVER}/sds/swift-x-account-sharing:${RELEASE_VERSION}
url: https://${ARTIFACTORY_SERVER}/sds/swift-x-account-sharing:${RELEASE_VERSION}
link_type: image
- name: ${ARTIFACTORY_SERVER}/sds/swift-sharing-request:${RELEASE_VERSION}
url: https://${ARTIFACTORY_SERVER}/sds/swift-sharing-request:${RELEASE_VERSION}
link_type: image
deploy:
rules:
# until this is https://gitlab.com/groups/gitlab-org/-/epics/4529 is merged
# ENVIRONMENT env var will not be sent downstream and it will default to devel branch
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
- if: '$CI_COMMIT_TAG !~ "/^$/"'
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
stage: deploy
tags:
- sds
variables:
GITLAB_PROJECT_ID: $GITLAB_SWIFT_BROWSER_CONFIG_BUILD
GITLAB_REF: main
BUILD_BRANCH: $CI_COMMIT_REF_NAME
script:
- >
curl --request POST
--form "token=$CI_JOB_TOKEN"
--form "ref=$GITLAB_REF"
--form "variables[ENVIRONMENT]=$BUILD_BRANCH"
"$GITLAB_CI_URL/api/v4/projects/$GITLAB_PROJECT_ID/trigger/pipeline"
allow_failure: true